summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-10 11:19:42 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-10 11:19:42 -0400
commit39181293c0cb1780e56e3eaee9ac2cc8abd8d43f (patch)
tree479b4bdd27f20ca8389ce16086df7cd0bf69abe0
parent7210e188cc087f2f9a2aba23420d781d6d1a8691 (diff)
downloadb4-39181293c0cb1780e56e3eaee9ac2cc8abd8d43f.tar.gz
Don't use git patch-id for patch tracking
Looks like some of the patches sent from quilt (at least from Andrew Morton) are not properly parsed by git patch-id, so use our own patch hashing routines, even if this means we're likely going to miss some of the patches that were edited by maintainers. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/command.py2
-rw-r--r--b4/mbox.py11
-rw-r--r--b4/ty.py14
3 files changed, 11 insertions, 16 deletions
diff --git a/b4/command.py b/b4/command.py
index d195509..d1b43e8 100644
--- a/b4/command.py
+++ b/b4/command.py
@@ -149,7 +149,7 @@ def cmd():
sp_ty.add_argument('-s', '--send', nargs='+',
help='Generate thankyous for specified messages (use -l to get the list or "all")')
sp_ty.add_argument('-d', '--discard', nargs='+',
- help='Discard specified messages (use -l to get the list, or use "_all")')
+ help='Discard specified messages (use -l to get the list, or use "all")')
sp_ty.add_argument('-a', '--auto', action='store_true', default=False,
help='Use the Auto-Thankanator to figure out what got applied/merged')
sp_ty.add_argument('-b', '--branch', default=None,
diff --git a/b4/mbox.py b/b4/mbox.py
index b11d7d1..bafe754 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -155,16 +155,13 @@ def thanks_record_am(lser):
if entry == filename:
return
- # Get patch-id of each patch in the series
- gitargs = ['patch-id', '--stable']
patches = list()
for pmsg in lser.patches[1:]:
- ecode, out = b4.git_run_command(None, gitargs, stdin=pmsg.body.encode('utf-8'))
- if ecode > 0 or not len(out.strip()):
- logger.debug('Could not get patch-id of %s', pmsg.full_subject)
+ pmsg.load_hashes()
+ if pmsg.attestation is None:
+ logger.debug('Unable to get hashes for all patches, not tracking for thanks')
return
- chunks = out.split()
- patches.append((pmsg.subject, chunks[0]))
+ patches.append((pmsg.subject, pmsg.attestation.p))
lmsg = lser.patches[0]
if lmsg is None:
diff --git a/b4/ty.py b/b4/ty.py
index 245525a..8b76ff9 100644
--- a/b4/ty.py
+++ b/b4/ty.py
@@ -149,15 +149,13 @@ def get_all_commits(gitdir, branch, since='1.week', committer=None):
return MY_COMMITS
logger.info('Found %s of your comits since %s', len(lines), since)
- logger.info('Calculating patch-ids, may take a moment...')
- # Get patch-id of each commit
+ logger.info('Calculating patch hashes, may take a moment...')
+ # Get patch hash of each commit
for line in lines:
commit_id, subject = line.split(maxsplit=1)
ecode, out = git_get_rev_diff(gitdir, commit_id)
- gitargs = ['patch-id', '--stable']
- ecode, out = b4.git_run_command(None, gitargs, stdin=out.encode('utf-8'))
- chunks = out.split()
- MY_COMMITS[chunks[0]] = (commit_id, subject)
+ pwhash = b4.LoreMessage.get_patch_hash(out)
+ MY_COMMITS[pwhash] = (commit_id, subject)
return MY_COMMITS
@@ -235,7 +233,7 @@ def auto_thankanator(cmdargs):
sys.exit(1)
wantbranch = cmdargs.branch
- logger.info('Auto-thankinating using branch %s', wantbranch)
+ logger.info('Auto-thankinating commits in %s', wantbranch)
tracked = list_tracked()
if not len(tracked):
logger.info('Nothing to do')
@@ -366,7 +364,7 @@ def discard_selected(cmdargs):
logger.info('Nothing to do')
sys.exit(0)
- if '_all' in cmdargs.discard:
+ if 'all' in cmdargs.discard:
listing = tracked
else:
listing = list()