Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

project.py: fix west diff --manifest to use manifest-rev #748

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/west/app/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ def do_add_parser(self, parser_adder):
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')
help='show changes relative to "manifest-rev"')
return parser

def do_run(self, args, user_args):
Expand All @@ -800,9 +800,16 @@ def do_run(self, args, user_args):
# which it won't do ordinarily since stdout is not a terminal.
color = ['--color=always'] if self.color_ui else []
for project in self._cloned_projects(args, only_active=not args.all):
diff_commit = (
['manifest-rev'] # see #719 and #747
# Special-case the manifest repository while it's
# still showing up in the 'projects' list. Yet
# more evidence we should tackle #327.
if args.manifest and not isinstance(project, ManifestProject)
else []
)
# Use paths that are relative to the base directory to make it
# easier to see where the changes are
diff_commit = [project.revision] if args.manifest else []
cp = project.git(['diff', f'--src-prefix={project.path}/',
f'--dst-prefix={project.path}/',
'--exit-code'] + color + diff_commit,
Expand Down
1 change: 1 addition & 0 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ def test_diff(west_init_tmpdir):
cmd('update net-tools')
cmd('diff')
cmd('diff --stat')
cmd('diff --manifest')

cmd('update Kconfiglib')

Expand Down
Loading