# HG changeset patch # User Matt Mackall # Date 2008-02-11 22:16:05 # Node ID fb259a3572e95861dfd30a6e32a2b6b5a4305ec0 # Parent 0ee885fea46452c8ffb39213d533e7b8ba1ba18f convert: try to be smarter about CVS branching Better handles this case: The output from cvsps -A -u --cvs-direct -q: --------------------- PatchSet 1 Date: 2008/02/08 20:33:28 Author: fk Branch: HEAD Tag: (none) Log: initial Members: file_one:INITIAL->1.1 --------------------- PatchSet 2 Date: 2008/02/08 20:33:32 Author: fk Branch: branch_name Ancestor branch: HEAD Tag: (none) Log: new file on branch Members: file_two:1.1->1.1.2.1 diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -71,7 +71,7 @@ class convert_cvs(converter_source): elif l.startswith("Ancestor branch"): ancestor = l[17:-1] # figure out the parent later - self.parent[id] = None + self.parent[id] = self.lastbranch[ancestor] elif l.startswith("Author"): author = self.recode(l[8:-1]) elif l.startswith("Tag:") or l.startswith("Tags:"): @@ -101,13 +101,14 @@ class convert_cvs(converter_source): p = [] if branch == "HEAD": branch = "" - if branch and p[0] == None: + if branch: latest = None # the last changeset that contains a base # file is our parent for r in oldrevs: - latest = max(filerevids[r], latest) - p = [latest] + latest = max(filerevids.get(r, None), latest) + if latest: + p = [latest] # add current commit to set c = commit(author=author, date=date, parents=p,