aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2019-01-08 12:48:25 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2019-01-08 12:48:25 -0500
commitabcd9b1a47ff01cfb336a25f99f4400de8e97289 (patch)
tree11e145701e757627913383395fd2525a5d59bc12
parenta1b5006aa45de10dc33c01e4842d20cdd6b93110 (diff)
downloadkorg-helpers-abcd9b1a47ff01cfb336a25f99f4400de8e97289.tar.gz
Add settable "fromstate" config variable
If a patch is marked as "Mainlined", then we don't want to go back to mark it as "Accepted". Unfortunately, patchwork does not expose the "work required" field of the state, so we can't rely on that. However, for the vast majority of cases, we only want to consider patches that are either "new" or "under review" (and we can tweak this via the config value if we need to add more states to that). Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-xgit-patchwork-bot.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/git-patchwork-bot.py b/git-patchwork-bot.py
index 939ff14..3ef29d7 100755
--- a/git-patchwork-bot.py
+++ b/git-patchwork-bot.py
@@ -996,6 +996,13 @@ def pwrun(repo, cmdconfig, nomail, dryrun):
if pwhash:
rpwhashes[refname].append((rev, logline, pwhash))
+ if 'fromstate' in settings:
+ fromstate = settings['fromstate'].split(',')
+ else:
+ fromstate = ['new', 'under review']
+
+ logger.debug('fromstate=%s', fromstate)
+
for project in settings['projects'].split(','):
count = 0
project = project.strip()
@@ -1019,8 +1026,8 @@ def pwrun(repo, cmdconfig, nomail, dryrun):
for patch_id in patch_ids:
pdata = rm.get_patch(patch_id)
- if pdata.get('state') in ('superseded', to_state):
- logger.debug('Ignoring patch_id=%d (%s)', patch_id, pdata.get('state'))
+ if pdata.get('state') not in fromstate:
+ logger.debug('Ignoring patch_id=%d due to state=%s', patch_id, pdata.get('state'))
continue
revs[patch_id] = rev
@@ -1071,7 +1078,7 @@ def pwrun(repo, cmdconfig, nomail, dryrun):
update_queue.append((spatch.get('name'), spatch_id, to_state, rev))
if update_queue:
- logger.info('Accepting series: %s', sdata.get('name'))
+ logger.info('Marking series "%s": %s', to_state, sdata.get('name'))
updated_series.append(sdata)
for name, spatch_id, to_state, rev in update_queue:
count += 1