convert: record the source revision in the changelog
authorBrendan Cully <brendan@kublai.com>
Fri, 13 Jul 2007 08:28:57 -0700
changeset 4873 28b23b9073a8
parent 4872 419a6f715c6a
child 4874 d9e385a7a806
convert: record the source revision in the changelog
hgext/convert/common.py
hgext/convert/git.py
hgext/convert/hg.py
hgext/convert/subversion.py
--- a/hgext/convert/common.py	Thu Jul 12 22:55:44 2007 -0700
+++ b/hgext/convert/common.py	Fri Jul 13 08:28:57 2007 -0700
@@ -4,6 +4,9 @@
 
 class commit(object):
     def __init__(self, **parts):
+        self.rev = None
+        self.branch = None
+
         for x in "author date desc parents".split():
             if not x in parts:
                 raise util.Abort("commit missing field %s" % x)
--- a/hgext/convert/git.py	Thu Jul 12 22:55:44 2007 -0700
+++ b/hgext/convert/git.py	Fri Jul 13 08:28:57 2007 -0700
@@ -80,7 +80,8 @@
         date = tm + " " + str(tz)
         author = author or "unknown"
 
-        c = commit(parents=parents, date=date, author=author, desc=message)
+        c = commit(parents=parents, date=date, author=author, desc=message,
+                   rev=version)
         return c
 
     def gettags(self):
--- a/hgext/convert/hg.py	Thu Jul 12 22:55:44 2007 -0700
+++ b/hgext/convert/hg.py	Fri Jul 13 08:28:57 2007 -0700
@@ -54,11 +54,11 @@
 
         text = commit.desc
         extra = {}
-        try:
-            extra["branch"] = commit.branch
-        except AttributeError:
-            pass
-
+        if commit.branch:
+            extra['branch'] = commit.branch
+        if commit.rev:
+            extra['convert_revision'] = commit.rev
+            
         while parents:
             p1 = p2
             p2 = parents.pop(0)
--- a/hgext/convert/subversion.py	Thu Jul 12 22:55:44 2007 -0700
+++ b/hgext/convert/subversion.py	Fri Jul 13 08:28:57 2007 -0700
@@ -484,7 +484,8 @@
                           desc=log, 
                           parents=parents,
                           copies=copies,
-                          branch=branch)
+                          branch=branch,
+                          rev=rev.encode('utf-8'))
 
             self.commits[rev] = cset
             if self.child_cset and not self.child_cset.parents: