--- a/hgext/evolve.py Sat Aug 09 18:36:28 2014 -0400
+++ b/hgext/evolve.py Sat Aug 09 19:12:16 2014 -0400
@@ -27,6 +27,8 @@
from StringIO import StringIO
import struct
import urllib
+import re
+sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
import mercurial
from mercurial import util
@@ -909,6 +911,32 @@
destbookmarks = repo.nodebookmarks(dest.node())
nodesrc = orig.node()
destphase = repo[nodesrc].phase()
+ commitmsg = orig.description()
+
+ cache = {}
+ sha1s = re.findall(sha1re, commitmsg)
+ unfi = repo.unfiltered()
+ for sha1 in sha1s:
+ ctx = None
+ try:
+ ctx = unfi[sha1]
+ except error.RepoLookupError:
+ continue
+
+ if not ctx.obsolete():
+ continue
+
+ successors = obsolete.successorssets(repo, ctx.node(), cache)
+
+ # We can't make any assumptions about how to update the hash if the
+ # cset in question was split or diverged.
+ if len(successors) == 1 and len(successors[0]) == 1:
+ newsha1 = node.hex(successors[0][0])
+ commitmsg = commitmsg.replace(sha1, newsha1[:len(sha1)])
+ else:
+ repo.ui.note(_('The stale commit message reference to %s could '
+ 'not be updated') % sha1)
+
tr = repo.transaction('relocate')
try:
try:
@@ -919,7 +947,7 @@
'unresolved merge conflicts (see hg help resolve)')
cmdutil.duplicatecopies(repo, orig.node(), dest.node())
nodenew = rebase.concludenode(repo, orig.node(), dest.node(),
- node.nullid)
+ node.nullid, commitmsg)
except util.Abort, exc:
class LocalMergeFailure(MergeFailure, exc.__class__):
pass