##// END OF EJS Templates
convert: add tagmap logic...
Sean Farley -
r20378:9616b031 default
parent child Browse files
Show More
@@ -208,7 +208,8 b' class converter_sink(object):'
208 208 mapping equivalent authors identifiers for each system."""
209 209 return None
210 210
211 def putcommit(self, files, copies, parents, commit, source, revmap):
211 def putcommit(self, files, copies, parents, commit, source,
212 revmap, tagmap):
212 213 """Create a revision with all changed files listed in 'files'
213 214 and having listed parents. 'commit' is a commit object
214 215 containing at a minimum the author, date, and message for this
@@ -121,6 +121,7 b' class converter(object):'
121 121 self.splicemap = self.parsesplicemap(opts.get('splicemap'))
122 122 self.branchmap = mapfile(ui, opts.get('branchmap'))
123 123 self.closemap = self.parseclosemap(opts.get('closemap'))
124 self.tagmap = mapfile(ui, opts.get('tagmap'))
124 125
125 126 def parseclosemap(self, path):
126 127 """ check and validate the closemap format and
@@ -448,7 +449,7 b' class converter(object):'
448 449 commit.extra['close'] = 1
449 450
450 451 newnode = self.dest.putcommit(files, copies, parents, commit,
451 source, self.map)
452 source, self.map, self.tagmap)
452 453 source.close()
453 454 self.source.converted(rev, newnode)
454 455 self.map[rev] = newnode
@@ -484,6 +485,9 b' class converter(object):'
484 485 self.ui.progress(_('converting'), None)
485 486
486 487 tags = self.source.gettags()
488 tags = dict((self.tagmap.get(k, k), v)
489 for k, v in tags.iteritems())
490
487 491 ctags = {}
488 492 for k in tags:
489 493 v = tags[k]
@@ -120,7 +120,7 b' class mercurial_sink(converter_sink):'
120 120 self.repo.pull(prepo, [prepo.lookup(h) for h in heads])
121 121 self.before()
122 122
123 def _rewritetags(self, source, revmap, data):
123 def _rewritetags(self, source, revmap, tagmap, data):
124 124 fp = cStringIO.StringIO()
125 125 for line in data.splitlines():
126 126 s = line.split(' ', 1)
@@ -129,17 +129,18 b' class mercurial_sink(converter_sink):'
129 129 revid = revmap.get(source.lookuprev(s[0]))
130 130 if not revid:
131 131 continue
132 fp.write('%s %s\n' % (revid, s[1]))
132 fp.write('%s %s\n' % (revid, tagmap.get(s[1], s[1])))
133 133 return fp.getvalue()
134 134
135 def putcommit(self, files, copies, parents, commit, source, revmap):
135 def putcommit(self, files, copies, parents, commit, source,
136 revmap, tagmap):
136 137
137 138 files = dict(files)
138 139 def getfilectx(repo, memctx, f):
139 140 v = files[f]
140 141 data, mode = source.getfile(f, v)
141 142 if f == '.hgtags':
142 data = self._rewritetags(source, revmap, data)
143 data = self._rewritetags(source, revmap, tagmap, data)
143 144 return context.memfilectx(f, data, 'l' in mode, 'x' in mode,
144 145 copies.get(f))
145 146
@@ -1183,7 +1183,8 b' class svn_sink(converter_sink, commandli'
1183 1183 def revid(self, rev):
1184 1184 return u"svn:%s@%s" % (self.uuid, rev)
1185 1185
1186 def putcommit(self, files, copies, parents, commit, source, revmap):
1186 def putcommit(self, files, copies, parents, commit, source,
1187 revmap, tagmap):
1187 1188 for parent in parents:
1188 1189 try:
1189 1190 return self.revid(self.childmap[parent])
General Comments 0
You need to be logged in to leave comments. Login now