-
Notifications
You must be signed in to change notification settings - Fork 6
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
tag-delta: Allow listing only downgrades or only upgrades #19
Merged
jguiditta
merged 1 commit into
release-depot:master
from
compi-migui:downgrades-upgrades
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,20 @@ def main(): | |
help='Do not use inherit when checking tags') | ||
parser.add_argument('--skip-same', action='store_true', default=False, | ||
help='skip printing entries if they are the same') | ||
parser.add_argument('--skip-downgrades', action='store_true', default=False, | ||
help='skip printing entries if they are downgrades (left > right)') | ||
parser.add_argument('--skip-upgrades', action='store_true', default=False, | ||
help='skip printing entries if they are upgrades (right > left)') | ||
|
||
parser.add_argument('left_tag', help='left brew tag for comparison') | ||
parser.add_argument('right_tag', help='right brew tag for comparison') | ||
args = parser.parse_args() | ||
|
||
show_new = False | ||
show_removed = False | ||
show_same = True | ||
show_upgrades = True | ||
show_downgrades = True | ||
do_inherit = True | ||
|
||
if args.new: | ||
|
@@ -46,6 +53,12 @@ def main(): | |
show_removed = True | ||
if args.no_inherit: | ||
do_inherit = False | ||
if args.skip_same: | ||
show_same = False | ||
if args.skip_downgrades: | ||
show_downgrades = False | ||
if args.skip_upgrades: | ||
show_upgrades = False | ||
|
||
columns, rows = shutil.get_terminal_size() | ||
fw = str(int((int(columns) - 3) / 3)) | ||
|
@@ -69,39 +82,41 @@ def main(): | |
print('component,' + lname + ',' + rname + ',status') | ||
|
||
# Downgrades (normally bad) | ||
for c in sorted(delta_info['downgrades'].keys()): | ||
lnevr = delta_info['downgrades'][c]['old'] | ||
rnevr = delta_info['downgrades'][c]['new'] | ||
|
||
levr = evr_from_nevr(lnevr) | ||
revr = evr_from_nevr(rnevr) | ||
|
||
if sys.stdout.isatty(): | ||
f = '%' + fw + 's %s%' + fw + 's %s%' + fw + 's' | ||
print(f % (c, decor.HILIGHT, levr, decor.NORMAL, revr)) | ||
else: | ||
if delta_info['downgrades'][c]['rebase']: | ||
print(f'{c},{levr},{revr},rebase') | ||
if show_downgrades: | ||
for c in sorted(delta_info['downgrades'].keys()): | ||
lnevr = delta_info['downgrades'][c]['old'] | ||
rnevr = delta_info['downgrades'][c]['new'] | ||
|
||
levr = evr_from_nevr(lnevr) | ||
revr = evr_from_nevr(rnevr) | ||
|
||
if sys.stdout.isatty(): | ||
f = '%' + fw + 's %s%' + fw + 's %s%' + fw + 's' | ||
print(f % (c, decor.HILIGHT, levr, decor.NORMAL, revr)) | ||
else: | ||
print(f'{c},{levr},{revr},') | ||
if delta_info['downgrades'][c]['rebase']: | ||
print(f'{c},{levr},{revr},rebase') | ||
else: | ||
print(f'{c},{levr},{revr},') | ||
|
||
for c in sorted(delta_info['upgrades'].keys()): | ||
lnevr = delta_info['upgrades'][c]['old'] | ||
rnevr = delta_info['upgrades'][c]['new'] | ||
if show_upgrades: | ||
for c in sorted(delta_info['upgrades'].keys()): | ||
lnevr = delta_info['upgrades'][c]['old'] | ||
rnevr = delta_info['upgrades'][c]['new'] | ||
|
||
levr = evr_from_nevr(lnevr) | ||
revr = evr_from_nevr(rnevr) | ||
levr = evr_from_nevr(lnevr) | ||
revr = evr_from_nevr(rnevr) | ||
|
||
if sys.stdout.isatty(): | ||
f = '%' + fw + 's %' + fw + 's %s%' + fw + 's%s' | ||
print(f % (c, levr, decor.HILIGHT, revr, decor.NORMAL)) | ||
else: | ||
if delta_info['upgrades'][c]['rebase']: | ||
print(f'{c},{levr},{revr},rebase') | ||
if sys.stdout.isatty(): | ||
f = '%' + fw + 's %' + fw + 's %s%' + fw + 's%s' | ||
print(f % (c, levr, decor.HILIGHT, revr, decor.NORMAL)) | ||
else: | ||
print(f'{c},{levr},{revr},') | ||
if delta_info['upgrades'][c]['rebase']: | ||
print(f'{c},{levr},{revr},rebase') | ||
else: | ||
print(f'{c},{levr},{revr},') | ||
Comment on lines
+103
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above: |
||
|
||
if not args.skip_same: | ||
if show_same: | ||
f = '%' + fw + 's %' + fw + 's %' + fw + 's' | ||
for c in sorted(delta_info['common'].keys()): | ||
nevr = delta_info['common'][c] | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff is having a hard time with this. The block is indented one place right to be under the new
if show_downgrades:
conditional, there's no other changes.