Show More
@@ -79,12 +79,18 b' def skip_empty_successor(ui, command):' | |||
|
79 | 79 | ) |
|
80 | 80 | |
|
81 | 81 | |
|
82 | def update_hash_refs(repo, commitmsg): | |
|
82 | def update_hash_refs(repo, commitmsg, pending=None): | |
|
83 | 83 | """Replace all obsolete commit hashes in the message with the current hash. |
|
84 | 84 | |
|
85 | 85 | If the obsolete commit was split or is divergent, the hash is not replaced |
|
86 | 86 | as there's no way to know which successor to choose. |
|
87 | ||
|
88 | For commands that update a series of commits in the current transaction, the | |
|
89 | new obsolete markers can be considered by setting ``pending`` to a mapping | |
|
90 | of ``pending[oldnode] = [successor_node1, successor_node2,..]``. | |
|
87 | 91 | """ |
|
92 | if not pending: | |
|
93 | pending = {} | |
|
88 | 94 | cache = {} |
|
89 | 95 | sha1s = re.findall(sha1re, commitmsg) |
|
90 | 96 | unfi = repo.unfiltered() |
@@ -94,8 +100,12 b' def update_hash_refs(repo, commitmsg):' | |||
|
94 | 100 | continue |
|
95 | 101 | ctx = unfi[fullnode] |
|
96 | 102 | if not ctx.obsolete(): |
|
103 | successors = pending.get(fullnode) | |
|
104 | if successors is None: | |
|
97 | 105 | continue |
|
98 | ||
|
106 | # obsutil.successorssets() returns a list of list of nodes | |
|
107 | successors = [successors] | |
|
108 | else: | |
|
99 | 109 | successors = obsutil.successorssets(repo, ctx.node(), cache=cache) |
|
100 | 110 | |
|
101 | 111 | # We can't make any assumptions about how to update the hash if the |
General Comments 0
You need to be logged in to leave comments.
Login now