changeset 5012:be25decfdb13

convert: make commit constructor clearer and less magical
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 26 Jul 2007 13:34:36 -0700
parents 89fbb0a5e8e3
children 6c1029aacc9a
files hgext/convert/__init__.py hgext/convert/common.py
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/__init__.py	Thu Jul 26 13:34:36 2007 -0700
+++ b/hgext/convert/__init__.py	Thu Jul 26 13:34:36 2007 -0700
@@ -193,7 +193,7 @@
         c = self.commitcache[rev]
         files = self.source.getchanges(rev)
 
-        do_copies = (hasattr(c, 'copies') and hasattr(self.dest, 'copyfile'))
+        do_copies = hasattr(self.dest, 'copyfile')
 
         for f, v in files:
             try:
--- a/hgext/convert/common.py	Thu Jul 26 13:34:36 2007 -0700
+++ b/hgext/convert/common.py	Thu Jul 26 13:34:36 2007 -0700
@@ -3,16 +3,20 @@
 class NoRepo(Exception): pass
 
 class commit(object):
-    def __init__(self, **parts):
+    def __init__(self, author, date, desc, parents, branch=None, rev=None,
+                 copies={}):
         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)
-        self.__dict__.update(parts)
-        if not self.desc or self.desc.isspace():
+        self.author = author
+        self.date = date
+        if desc and not desc.isspace():
+            self.desc = desc
+        else:
             self.desc = '*** empty log message ***'
+        self.parents = parents
+        self.branch = branch
+        self.rev = rev
+        self.copies = copies
 
 class converter_source(object):
     """Conversion source interface"""