Mercurial > public > mercurial-scm > hg
comparison mercurial/rewriteutil.py @ 45711:3d68b47e461b
rewriteutil: handle dropped commits when updating description hashes
In looking to leverage this with the absorb extension, the old -> new mapping
there allows the new value to be None. We could filter that out and not pass it
to this method, but it seems worth a message to the user. (I wonder if these
should be an info or warning, because it's unlikely people are using `-v`
regularly.)
Differential Revision: https://phab.mercurial-scm.org/D9181
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 08 Oct 2020 23:33:04 -0400 |
parents | 78861610ded8 |
children | b4694ef45db5 |
comparison
equal
deleted
inserted
replaced
45710:510995e249c0 | 45711:3d68b47e461b |
---|---|
109 successors = obsutil.successorssets(repo, ctx.node(), cache=cache) | 109 successors = obsutil.successorssets(repo, ctx.node(), cache=cache) |
110 | 110 |
111 # We can't make any assumptions about how to update the hash if the | 111 # We can't make any assumptions about how to update the hash if the |
112 # cset in question was split or diverged. | 112 # cset in question was split or diverged. |
113 if len(successors) == 1 and len(successors[0]) == 1: | 113 if len(successors) == 1 and len(successors[0]) == 1: |
114 newhash = node.hex(successors[0][0]) | 114 successor = successors[0][0] |
115 commitmsg = commitmsg.replace(h, newhash[: len(h)]) | 115 if successor is not None: |
116 newhash = node.hex(successor) | |
117 commitmsg = commitmsg.replace(h, newhash[: len(h)]) | |
118 else: | |
119 repo.ui.note( | |
120 _( | |
121 b'The stale commit message reference to %s could ' | |
122 b'not be updated\n(The referenced commit was dropped)\n' | |
123 ) | |
124 % h | |
125 ) | |
116 else: | 126 else: |
117 repo.ui.note( | 127 repo.ui.note( |
118 _( | 128 _( |
119 b'The stale commit message reference to %s could ' | 129 b'The stale commit message reference to %s could ' |
120 b'not be updated\n' | 130 b'not be updated\n' |