From 0d5ee4eb083470b07e707e1666333a497e0a93e5 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 19 Jul 2024 15:55:16 +0200 Subject: [PATCH] app: project: Allow to diff against manifest revision Add an argument to the west diff command that allows to set the manifest revision as the merge-base. Signed-off-by: Pieter De Gendt --- src/west/app/project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/west/app/project.py b/src/west/app/project.py index 0ffe1e5..cf8ba8a 100644 --- a/src/west/app/project.py +++ b/src/west/app/project.py @@ -779,6 +779,8 @@ class Diff(_ProjectCommand): defaults to active cloned projects''') parser.add_argument('-a', '--all', action='store_true', help='include output for inactive projects') + parser.add_argument('-m', '--manifest', action='store_true', + help='show changes relative to the manifest revision') return parser def do_run(self, args, ignored): @@ -792,9 +794,10 @@ class Diff(_ProjectCommand): for project in self._cloned_projects(args, only_active=not args.all): # Use paths that are relative to the base directory to make it # easier to see where the changes are + merge_base = ['--merge-base', project.revision] if args.manifest else [] cp = project.git(['diff', f'--src-prefix={project.path}/', f'--dst-prefix={project.path}/', - '--exit-code'] + color, + '--exit-code'] + color + merge_base, capture_stdout=True, capture_stderr=True, check=False) if cp.returncode == 0: