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