# HG changeset patch # User Bryan O'Sullivan # Date 1185482076 25200 # Node ID be25decfdb13f0a9b19a95abed59a377622bb0d0 # Parent 89fbb0a5e8e3e1477bb6a65a7d9af6b272f2b6a9 convert: make commit constructor clearer and less magical diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py --- a/hgext/convert/__init__.py +++ b/hgext/convert/__init__.py @@ -193,7 +193,7 @@ class convert(object): 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: diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -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"""