diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-04-15 12:42:21 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-04-15 12:42:21 -0400 |
commit | 28b6825da28519b6ca0e8b3bce57700a1120ca9a (patch) | |
tree | 7fb99d73ba8103752259eacd93920e343c2e38eb /b4/ty.py | |
parent | 4be04f0af9a22087d0052838e013ef2de1ce2ac3 (diff) | |
download | b4-28b6825da28519b6ca0e8b3bce57700a1120ca9a.tar.gz |
Switch to using patchwork-compatible hashes
Using strict attestation hashes for auto-thankinator is problematic,
because "git am" uses a certain degree of fuzzing, so when we try to
find applied patches by running "git diff" on actual commits, line
counts may not be bit-for-bit identical.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/ty.py')
-rw-r--r-- | b4/ty.py | 41 |
1 files changed, 24 insertions, 17 deletions
@@ -158,7 +158,8 @@ def get_all_commits(gitdir, branch, since='1.week', committer=None): for line in lines: commit_id, subject = line.split(maxsplit=1) ecode, out = git_get_rev_diff(gitdir, commit_id) - pwhash = b4.LoreMessage.get_patch_hash(out) + pwhash = b4.LoreMessage.get_patchwork_hash(out) + logger.debug('phash=%s', pwhash) MY_COMMITS[pwhash] = (commit_id, subject) return MY_COMMITS @@ -171,6 +172,7 @@ def auto_locate_series(gitdir, jsondata, branch, since='1.week', loose=False): # We need to find all of them in the commits found = list() for patch in jsondata['patches']: + logger.debug('Checking %s', patch) if patch[1] in patchids: logger.debug('Found: %s', patch[0]) found.append(commits[patch[1]]) @@ -182,6 +184,7 @@ def auto_locate_series(gitdir, jsondata, branch, since='1.week', loose=False): break if len(found) == len(jsondata['patches']): + logger.debug('Found all the patches') return found return None @@ -376,21 +379,24 @@ def send_selected(cmdargs): logger.info('Nothing to do') sys.exit(0) - listing = list() - for num in cmdargs.send: - try: - index = int(num) - 1 - listing.append(tracked[index]) - except ValueError: - logger.critical('Please provide the number of the message') - logger.info('---') - write_tracked(tracked) - sys.exit(1) - except IndexError: - logger.critical('Invalid index: %s', num) - logger.info('---') - write_tracked(tracked) - sys.exit(1) + if 'all' in cmdargs.discard: + listing = tracked + else: + listing = list() + for num in cmdargs.send: + try: + index = int(num) - 1 + listing.append(tracked[index]) + except ValueError: + logger.critical('Please provide the number of the message') + logger.info('---') + write_tracked(tracked) + sys.exit(1) + except IndexError: + logger.critical('Invalid index: %s', num) + logger.info('---') + write_tracked(tracked) + sys.exit(1) if not len(listing): logger.info('Nothing to do') sys.exit(0) @@ -453,12 +459,13 @@ def get_wanted_branch(cmdargs): gitdir = cmdargs.gitdir if not cmdargs.branch: # Find out our current branch - gitargs = ['branch', '--show-current'] + gitargs = ['rev-parse', '--abbrev-ref', 'HEAD'] ecode, out = b4.git_run_command(gitdir, gitargs) if ecode > 0: logger.critical('Not able to get current branch (git branch --show-current)') sys.exit(1) wantbranch = out.strip() + logger.debug('will check branch=%s', wantbranch) else: # Make sure it's a real branch gitargs = ['branch', '--format=%(refname:short)', '--list'] |