Mercurial > hg
annotate mercurial/rewriteutil.py @ 45447:e7c8a5030a90
merge: show number of ancestors in bid merge debug notes
A good number of times, we don't generate an action for a file in
manifestmerge() which can result in bid merge doing the wrong thing.
Mentioning the number of ancestors from which we are bidding will help spot such
cases where we are not returning an action.
Differential Revision: https://phab.mercurial-scm.org/D8967
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 26 Aug 2020 17:24:22 +0530 |
parents | 78861610ded8 |
children | 3d68b47e461b |
rev | line source |
---|---|
35242
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
1 # rewriteutil.py - utility functions for rewriting changesets |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
2 # |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
3 # Copyright 2017 Octobus <contact@octobus.net> |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
4 # |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
7 |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
8 from __future__ import absolute_import |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
9 |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
10 import re |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
11 |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
12 from .i18n import _ |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
13 |
35242
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
14 from . import ( |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
15 error, |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
16 node, |
35242
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
17 obsolete, |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
18 obsutil, |
35242
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
19 revset, |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
20 scmutil, |
35242
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
21 ) |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
22 |
43075
57875cf423c9
style: run a patched black on a subset of mercurial
Augie Fackler <augie@google.com>
parents:
40636
diff
changeset
|
23 |
45427
78861610ded8
rewriteutil: relax the sha1 hash references to handle future hash types
Matt Harbison <matt_harbison@yahoo.com>
parents:
45425
diff
changeset
|
24 NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
25 |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
26 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
27 def precheck(repo, revs, action=b'rewrite'): |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
28 """check if revs can be rewritten |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
29 action is used to control the error message. |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
30 |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
31 Make sure this function is called after taking the lock. |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
32 """ |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
33 if node.nullrev in revs: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
34 msg = _(b"cannot %s null changeset") % action |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
35 hint = _(b"no changeset checked out") |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
36 raise error.Abort(msg, hint=hint) |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
37 |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
38 if len(repo[None].parents()) > 1: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
39 raise error.Abort(_(b"cannot %s while merging") % action) |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
40 |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
41 publicrevs = repo.revs(b'%ld and public()', revs) |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
42 if publicrevs: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
43 msg = _(b"cannot %s public changesets") % action |
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
44 hint = _(b"see 'hg help phases' for details") |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
45 raise error.Abort(msg, hint=hint) |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
46 |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
47 newunstable = disallowednewunstable(repo, revs) |
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
48 if newunstable: |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
49 raise error.Abort(_(b"cannot %s changeset with children") % action) |
35243
490df753894d
rewriteutil: add a precheck function to check if revs can be rewritten
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35242
diff
changeset
|
50 |
43075
57875cf423c9
style: run a patched black on a subset of mercurial
Augie Fackler <augie@google.com>
parents:
40636
diff
changeset
|
51 |
35242
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
52 def disallowednewunstable(repo, revs): |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
53 """Checks whether editing the revs will create new unstable changesets and |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
54 are we allowed to create them. |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
55 |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
56 To allow new unstable changesets, set the config: |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
57 `experimental.evolution.allowunstable=True` |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
58 """ |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
59 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
60 if allowunstable: |
27d5c2d2db2b
rewriteutil: add utility function to check if we can create new unstable cset
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff
changeset
|
61 return revset.baseset() |
43077
687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Augie Fackler <augie@google.com>
parents:
43075
diff
changeset
|
62 return repo.revs(b"(%ld::) - %ld", revs, revs) |
45122
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
63 |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
64 |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
65 def skip_empty_successor(ui, command): |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
66 empty_successor = ui.config(b'rewrite', b'empty-successor') |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
67 if empty_successor == b'skip': |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
68 return True |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
69 elif empty_successor == b'keep': |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
70 return False |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
71 else: |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
72 raise error.ConfigError( |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
73 _( |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
74 b"%s doesn't know how to handle config " |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
75 b"rewrite.empty-successor=%s (only 'skip' and 'keep' are " |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
76 b"supported)" |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
77 ) |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
78 % (command, empty_successor) |
a391d0710f22
rewriteutil: add utility to check whether empty successors should be skipped
Manuel Jacob <me@manueljacob.de>
parents:
43077
diff
changeset
|
79 ) |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
80 |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
81 |
45425
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
82 def update_hash_refs(repo, commitmsg, pending=None): |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
83 """Replace all obsolete commit hashes in the message with the current hash. |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
84 |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
85 If the obsolete commit was split or is divergent, the hash is not replaced |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
86 as there's no way to know which successor to choose. |
45425
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
87 |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
88 For commands that update a series of commits in the current transaction, the |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
89 new obsolete markers can be considered by setting ``pending`` to a mapping |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
90 of ``pending[oldnode] = [successor_node1, successor_node2,..]``. |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
91 """ |
45425
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
92 if not pending: |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
93 pending = {} |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
94 cache = {} |
45427
78861610ded8
rewriteutil: relax the sha1 hash references to handle future hash types
Matt Harbison <matt_harbison@yahoo.com>
parents:
45425
diff
changeset
|
95 hashes = re.findall(NODE_RE, commitmsg) |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
96 unfi = repo.unfiltered() |
45427
78861610ded8
rewriteutil: relax the sha1 hash references to handle future hash types
Matt Harbison <matt_harbison@yahoo.com>
parents:
45425
diff
changeset
|
97 for h in hashes: |
78861610ded8
rewriteutil: relax the sha1 hash references to handle future hash types
Matt Harbison <matt_harbison@yahoo.com>
parents:
45425
diff
changeset
|
98 fullnode = scmutil.resolvehexnodeidprefix(unfi, h) |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
99 if fullnode is None: |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
100 continue |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
101 ctx = unfi[fullnode] |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
102 if not ctx.obsolete(): |
45425
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
103 successors = pending.get(fullnode) |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
104 if successors is None: |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
105 continue |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
106 # obsutil.successorssets() returns a list of list of nodes |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
107 successors = [successors] |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
108 else: |
f7e293e0475f
rewriteutil: also consider pending obsoletes when updating hashes in messages
Matt Harbison <matt_harbison@yahoo.com>
parents:
45424
diff
changeset
|
109 successors = obsutil.successorssets(repo, ctx.node(), cache=cache) |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
110 |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
111 # We can't make any assumptions about how to update the hash if the |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
112 # cset in question was split or diverged. |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
113 if len(successors) == 1 and len(successors[0]) == 1: |
45427
78861610ded8
rewriteutil: relax the sha1 hash references to handle future hash types
Matt Harbison <matt_harbison@yahoo.com>
parents:
45425
diff
changeset
|
114 newhash = node.hex(successors[0][0]) |
78861610ded8
rewriteutil: relax the sha1 hash references to handle future hash types
Matt Harbison <matt_harbison@yahoo.com>
parents:
45425
diff
changeset
|
115 commitmsg = commitmsg.replace(h, newhash[: len(h)]) |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
116 else: |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
117 repo.ui.note( |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
118 _( |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
119 b'The stale commit message reference to %s could ' |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
120 b'not be updated\n' |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
121 ) |
45427
78861610ded8
rewriteutil: relax the sha1 hash references to handle future hash types
Matt Harbison <matt_harbison@yahoo.com>
parents:
45425
diff
changeset
|
122 % h |
45424
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
123 ) |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
124 |
0a57ef4b3bdb
rewriteutil: extract evolve code used to replace obsolete hashes in commits
Matt Harbison <matt_harbison@yahoo.com>
parents:
45122
diff
changeset
|
125 return commitmsg |