diff options
author | Kees Cook <keescook@chromium.org> | 2021-12-02 15:38:36 -0800 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2021-12-13 17:28:51 -0500 |
commit | ffe2576ac7731b7596e4bdb1c10ab9768f93ee09 (patch) | |
tree | 50fcf221eb4ee92696d904c0caa9aa734a2aa26f | |
parent | 8998144862b16cfa7a2ec07757d43ca269d59373 (diff) | |
download | korg-helpers-ffe2576ac7731b7596e4bdb1c10ab9768f93ee09.tar.gz |
patchwork-bot: Add --pwhash for debugging
Finding a 2-character whitespace difference between patches with different
patchwork hashes strained my sanity, so I want to keep the tooling I
built to track it down. Using "--pwhash PATCH-ID", patchwork-bot will
compare the given patch in patchwork (and its hash) against the diff
from stdin (and its hash).
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211202233836.2024510-3-keescook@chromium.org
-rwxr-xr-x | git-patchwork-bot.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/git-patchwork-bot.py b/git-patchwork-bot.py index 4e10385..980928c 100755 --- a/git-patchwork-bot.py +++ b/git-patchwork-bot.py @@ -1363,6 +1363,8 @@ if __name__ == '__main__': help='Domain to use when creating message-ids') parser.add_argument('--ancestors', default=None, help='During initial database creation, consider this many ancestor commits as fresh') + parser.add_argument('--pwhash', default=None, type=int, metavar='PATCH-ID', + help='Debug pwhash mismatches. Compare patchwork hash of diff from stdin to patch id') cmdargs = parser.parse_args() @@ -1411,6 +1413,24 @@ if __name__ == '__main__': if not os.path.isdir(CACHEDIR): os.makedirs(CACHEDIR, exist_ok=True) + if cmdargs.pwhash: + diff = sys.stdin.read() + pwhash = get_patchwork_hash(diff) + print(pwhash) + for pw in CONFIG['patchworks']: + print(f"Patchwork: {pw}") + for pname, psettings in CONFIG['patchworks'][pw]['projects'].items(): + print(f"Project: {pname}") + project, rm, rpc, pconfig = project_by_name(pname) + project_id = project['id'] + print(get_patchwork_patches_by_project_id_hash(rpc, project_id, pwhash)) + print('-------') + p = rm.get_patch(cmdargs.pwhash) + pwdiff = p.get('diff') + print(pwdiff) + print(get_patchwork_hash(pwdiff)) + sys.exit(0) + if cmdargs.housekeeping: for _pserver, _sconfig in CONFIG['patchworks'].items(): for _pname in _sconfig['projects']: |