##// END OF EJS Templates
convert: replace old sha1s in the description...
Sean Farley -
r20372:45562379 default
parent child Browse files
Show More
@@ -25,6 +25,9 b' from mercurial import hg, util, context,'
25
25
26 from common import NoRepo, commit, converter_source, converter_sink
26 from common import NoRepo, commit, converter_source, converter_sink
27
27
28 import re
29 sha1re = re.compile(r'\b[0-9a-f]{6,40}\b')
30
28 class mercurial_sink(converter_sink):
31 class mercurial_sink(converter_sink):
29 def __init__(self, ui, path):
32 def __init__(self, ui, path):
30 converter_sink.__init__(self, ui, path)
33 converter_sink.__init__(self, ui, path)
@@ -157,6 +160,14 b' class mercurial_sink(converter_sink):'
157 p2 = parents.pop(0)
160 p2 = parents.pop(0)
158
161
159 text = commit.desc
162 text = commit.desc
163
164 sha1s = re.findall(sha1re, text)
165 for sha1 in sha1s:
166 oldrev = source.lookuprev(sha1)
167 newrev = revmap.get(oldrev)
168 if newrev is not None:
169 text = text.replace(sha1, newrev[:len(sha1)])
170
160 extra = commit.extra.copy()
171 extra = commit.extra.copy()
161 if self.branchnames and commit.branch:
172 if self.branchnames and commit.branch:
162 extra['branch'] = commit.branch
173 extra['branch'] = commit.branch
@@ -119,7 +119,7 b' test tag rewriting'
119 0 add baz
119 0 add baz
120 $ cd new-filemap
120 $ cd new-filemap
121 $ hg tags
121 $ hg tags
122 tip 2:6f4fd1df87fb
122 tip 2:3c74706b1ff8
123 some-tag 0:ba8636729451
123 some-tag 0:ba8636729451
124 $ cd ..
124 $ cd ..
125
125
General Comments 0
You need to be logged in to leave comments. Login now