app: Allow passing arguments to git status/diff

west should pass unknown arguments to git status and diff commands.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-07-19 13:44:49 +02:00 committed by Carles Cufí
parent b69c85e2e5
commit 73aee32278
1 changed files with 10 additions and 3 deletions

View File

@ -769,7 +769,10 @@ class Diff(_ProjectCommand):
super().__init__(
'diff',
'"git diff" for one or more projects',
'Runs "git diff" on each of the specified projects.')
'''Runs "git diff" on each of the specified projects.
Unknown arguments are passed to "git diff".''',
accepts_unknown_args=True,
)
def do_add_parser(self, parser_adder):
parser = self._parser(parser_adder,
@ -783,7 +786,7 @@ class Diff(_ProjectCommand):
help='show changes relative to the manifest revision')
return parser
def do_run(self, args, ignored):
def do_run(self, args, user_args):
self.die_if_no_git()
failed = []
@ -798,6 +801,7 @@ class Diff(_ProjectCommand):
cp = project.git(['diff', f'--src-prefix={project.path}/',
f'--dst-prefix={project.path}/',
'--exit-code'] + color + merge_base,
extra_args=user_args,
capture_stdout=True, capture_stderr=True,
check=False)
if cp.returncode == 0:
@ -817,7 +821,10 @@ class Status(_ProjectCommand):
super().__init__(
'status',
'"git status" for one or more projects',
"Runs 'git status' for each of the specified projects.")
'''Runs "git status" for each of the specified projects.
Unknown arguments are passed to "git status".''',
accepts_unknown_args=True,
)
def do_add_parser(self, parser_adder):
parser = self._parser(parser_adder,