Show More
@@ -21,7 +21,7 b' from . import (' | |||||
21 | ) |
|
21 | ) | |
22 |
|
22 | |||
23 |
|
23 | |||
24 |
|
|
24 | NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | def precheck(repo, revs, action=b'rewrite'): |
|
27 | def precheck(repo, revs, action=b'rewrite'): | |
@@ -92,10 +92,10 b' def update_hash_refs(repo, commitmsg, pe' | |||||
92 | if not pending: |
|
92 | if not pending: | |
93 | pending = {} |
|
93 | pending = {} | |
94 | cache = {} |
|
94 | cache = {} | |
95 |
|
|
95 | hashes = re.findall(NODE_RE, commitmsg) | |
96 | unfi = repo.unfiltered() |
|
96 | unfi = repo.unfiltered() | |
97 |
for |
|
97 | for h in hashes: | |
98 |
fullnode = scmutil.resolvehexnodeidprefix(unfi, |
|
98 | fullnode = scmutil.resolvehexnodeidprefix(unfi, h) | |
99 | if fullnode is None: |
|
99 | if fullnode is None: | |
100 | continue |
|
100 | continue | |
101 | ctx = unfi[fullnode] |
|
101 | ctx = unfi[fullnode] | |
@@ -111,15 +111,15 b' def update_hash_refs(repo, commitmsg, pe' | |||||
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 |
newsh |
|
114 | newhash = node.hex(successors[0][0]) | |
115 |
commitmsg = commitmsg.replace( |
|
115 | commitmsg = commitmsg.replace(h, newhash[: len(h)]) | |
116 | else: |
|
116 | else: | |
117 | repo.ui.note( |
|
117 | repo.ui.note( | |
118 | _( |
|
118 | _( | |
119 | b'The stale commit message reference to %s could ' |
|
119 | b'The stale commit message reference to %s could ' | |
120 | b'not be updated\n' |
|
120 | b'not be updated\n' | |
121 | ) |
|
121 | ) | |
122 |
% |
|
122 | % h | |
123 | ) |
|
123 | ) | |
124 |
|
124 | |||
125 | return commitmsg |
|
125 | return commitmsg |
General Comments 0
You need to be logged in to leave comments.
Login now