changeset 25570:7cc1d33f0ba6

convert: always track the hg source revision in the internal commit object This will be needed in the next patch to determine if phases need to be adjusted. The insertion of the source revision in 'extras{}' is still controlled by the config property.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 14 Jun 2015 13:04:00 -0400
parents 2612e6dab189
children 1abfe639a70c
files hgext/convert/common.py hgext/convert/hg.py
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/common.py	Sat Jun 13 00:51:43 2015 -0700
+++ b/hgext/convert/common.py	Sun Jun 14 13:04:00 2015 -0400
@@ -44,7 +44,7 @@
 
 class commit(object):
     def __init__(self, author, date, desc, parents, branch=None, rev=None,
-                 extra={}, sortkey=None):
+                 extra={}, sortkey=None, saverev=True):
         self.author = author or 'unknown'
         self.date = date or '0 0'
         self.desc = desc
@@ -53,6 +53,7 @@
         self.rev = rev
         self.extra = extra
         self.sortkey = sortkey
+        self.saverev = saverev
 
 class converter_source(object):
     """Conversion source interface"""
--- a/hgext/convert/hg.py	Sat Jun 13 00:51:43 2015 -0700
+++ b/hgext/convert/hg.py	Sun Jun 14 13:04:00 2015 -0400
@@ -243,7 +243,7 @@
 
         if self.branchnames and commit.branch:
             extra['branch'] = commit.branch
-        if commit.rev:
+        if commit.rev and commit.saverev:
             extra['convert_revision'] = commit.rev
 
         while parents:
@@ -473,15 +473,13 @@
     def getcommit(self, rev):
         ctx = self.changectx(rev)
         parents = [p.hex() for p in self.parents(ctx)]
-        if self.saverev:
-            crev = rev
-        else:
-            crev = None
+        crev = rev
+
         return commit(author=ctx.user(),
                       date=util.datestr(ctx.date(), '%Y-%m-%d %H:%M:%S %1%2'),
                       desc=ctx.description(), rev=crev, parents=parents,
                       branch=ctx.branch(), extra=ctx.extra(),
-                      sortkey=ctx.rev())
+                      sortkey=ctx.rev(), saverev=self.saverev)
 
     def gettags(self):
         # This will get written to .hgtags, filter non global tags out.