# HG changeset patch # User Kyle Lippincott # Date 1649877257 25200 # Node ID 532b649c1deb39e9ac64161f945d14cd632502ef # Parent 80579e597439c9e720cbce06cee1c48369187b53 rebase: while rewriting desc hashes, ignore ambiguous prefix "hashes" If a repo is sufficiently large, a six digit number "hash prefix" can somewhat easily reference an ambiguous hash prefix. Differential Revision: https://phab.mercurial-scm.org/D12552 diff -r 80579e597439 -r 532b649c1deb mercurial/rewriteutil.py --- a/mercurial/rewriteutil.py Wed Apr 13 13:15:33 2022 -0700 +++ b/mercurial/rewriteutil.py Wed Apr 13 12:14:17 2022 -0700 @@ -215,9 +215,9 @@ for h in hashes: 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. + except (error.WdirUnsupported, error.AmbiguousPrefixLookupError): + # Someone has an fffff... or some other prefix that's ambiguous in a + # commit message we're rewriting. Don't try rewriting that. continue if fullnode is None: continue diff -r 80579e597439 -r 532b649c1deb tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t Wed Apr 13 13:15:33 2022 -0700 +++ b/tests/test-rebase-inmemory.t Wed Apr 13 12:14:17 2022 -0700 @@ -1027,8 +1027,7 @@ $ hg ci -qAm 'The previous two (parentless) commits had a hash prefix of b04363. Check that rewrite_hash_refs will not fail because of that.' $ hg rebase -r . -d 5 rebasing 8:5c4cdabf5769 tip "The previous two (parentless) commits had a hash prefix of b04363. Check that rewrite_hash_refs will not fail because of that." - abort: 00changelog@b04363: ambiguous identifier (known-bad-output !) - [50] + saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/5c4cdabf5769-335e1828-rebase.hg $ cd ..