# HG changeset patch # User Augie Fackler # Date 1627590225 14400 # Node ID 48da5c32575063bf8835f83544bd116fe08c33f8 # Parent 324c8a2993249a7d6fe2ab19e665caa4337cac8a rewriteutil: fix crash when a rewritten message references f{6,64} Without this, the rewriteutil logic thinks it's found a reference to the wdir pseudo-revision, and then tries to look it up and rewrite it. Stop it from doing that. Amusingly, I had trouble working with this changeset when I didn't describe the defect above using a regular expression, because it would trigger the bug in my installed version of hg. Differential Revision: https://phab.mercurial-scm.org/D11232 diff -r 324c8a299324 -r 48da5c325750 mercurial/rewriteutil.py --- a/mercurial/rewriteutil.py Thu Jul 29 16:18:35 2021 -0400 +++ b/mercurial/rewriteutil.py Thu Jul 29 16:23:45 2021 -0400 @@ -207,7 +207,12 @@ hashes = re.findall(NODE_RE, commitmsg) unfi = repo.unfiltered() for h in hashes: - fullnode = scmutil.resolvehexnodeidprefix(unfi, h) + try: + fullnode = scmutil.resolvehexnodeidprefix(unfi, h) + except error.WdirUnsupported: + # Someone has an fffff... in a commit message we're + # rewriting. Don't try rewriting that. + continue if fullnode is None: continue ctx = unfi[fullnode] diff -r 324c8a299324 -r 48da5c325750 tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t Thu Jul 29 16:18:35 2021 -0400 +++ b/tests/test-rebase-inmemory.t Thu Jul 29 16:23:45 2021 -0400 @@ -971,9 +971,9 @@ $ hg ci -m 'this will change hash' created new head $ echo changed >> update_hash_refs - $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but not 506e2454484b" + $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but not 506e2454484b. Also, ffffffffffffffff" $ hg tglog - @ 5: becd28036887 'this starts as the child of 98789aa60148 but not 506e2454484b' + @ 5: a8b42cbbde83 'this starts as the child of 98789aa60148 but not 506e2454484b. Also, ffffffffffffffff' | o 4: 98789aa60148 'this will change hash' | @@ -987,10 +987,10 @@ $ hg rebase -r '.^::' -d 3 rebasing 4:98789aa60148 "this will change hash" - rebasing 5:becd28036887 tip "this starts as the child of 98789aa60148 but not 506e2454484b" - saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-72ec40bd-rebase.hg + rebasing 5:a8b42cbbde83 tip "this starts as the child of 98789aa60148 but not 506e2454484b. Also, ffffffffffffffff" + saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-da3f4c2c-rebase.hg $ hg tglog - @ 5: a445b8426f4b 'this starts as the child of c16c25696fe7 but not 506e2454484b' + @ 5: 0fd2912e6cc1 'this starts as the child of c16c25696fe7 but not 506e2454484b. Also, ffffffffffffffff' | o 4: c16c25696fe7 'this will change hash' |