##// END OF EJS Templates
convert: always track the hg source revision in the internal commit object...
Matt Harbison -
r25570:7cc1d33f default
parent child Browse files
Show More
@@ -44,7 +44,7 b" SKIPREV = 'SKIP'"
44
44
45 class commit(object):
45 class commit(object):
46 def __init__(self, author, date, desc, parents, branch=None, rev=None,
46 def __init__(self, author, date, desc, parents, branch=None, rev=None,
47 extra={}, sortkey=None):
47 extra={}, sortkey=None, saverev=True):
48 self.author = author or 'unknown'
48 self.author = author or 'unknown'
49 self.date = date or '0 0'
49 self.date = date or '0 0'
50 self.desc = desc
50 self.desc = desc
@@ -53,6 +53,7 b' class commit(object):'
53 self.rev = rev
53 self.rev = rev
54 self.extra = extra
54 self.extra = extra
55 self.sortkey = sortkey
55 self.sortkey = sortkey
56 self.saverev = saverev
56
57
57 class converter_source(object):
58 class converter_source(object):
58 """Conversion source interface"""
59 """Conversion source interface"""
@@ -243,7 +243,7 b' class mercurial_sink(converter_sink):'
243
243
244 if self.branchnames and commit.branch:
244 if self.branchnames and commit.branch:
245 extra['branch'] = commit.branch
245 extra['branch'] = commit.branch
246 if commit.rev:
246 if commit.rev and commit.saverev:
247 extra['convert_revision'] = commit.rev
247 extra['convert_revision'] = commit.rev
248
248
249 while parents:
249 while parents:
@@ -473,15 +473,13 b' class mercurial_source(converter_source)'
473 def getcommit(self, rev):
473 def getcommit(self, rev):
474 ctx = self.changectx(rev)
474 ctx = self.changectx(rev)
475 parents = [p.hex() for p in self.parents(ctx)]
475 parents = [p.hex() for p in self.parents(ctx)]
476 if self.saverev:
476 crev = rev
477 crev = rev
477
478 else:
479 crev = None
480 return commit(author=ctx.user(),
478 return commit(author=ctx.user(),
481 date=util.datestr(ctx.date(), '%Y-%m-%d %H:%M:%S %1%2'),
479 date=util.datestr(ctx.date(), '%Y-%m-%d %H:%M:%S %1%2'),
482 desc=ctx.description(), rev=crev, parents=parents,
480 desc=ctx.description(), rev=crev, parents=parents,
483 branch=ctx.branch(), extra=ctx.extra(),
481 branch=ctx.branch(), extra=ctx.extra(),
484 sortkey=ctx.rev())
482 sortkey=ctx.rev(), saverev=self.saverev)
485
483
486 def gettags(self):
484 def gettags(self):
487 # This will get written to .hgtags, filter non global tags out.
485 # This will get written to .hgtags, filter non global tags out.
General Comments 0
You need to be logged in to leave comments. Login now