KeyError exceptions importing from CVS
Matt Mackall
mpm at selenic.com
Fri Feb 8 17:03:00 CST 2008
On Fri, 2008-02-08 at 20:59 +0000, Frank A. Kingswood wrote:
> 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
>
>
> When convert/cvs.py tries to add the 1.1->1.1.2.1 patchset it can not
> find 1.1 in the filerevids dictionary and fails with a KeyError, as
> shown before.
Ok, looks like we should trust Ancestor branch if nothing tells us
otherwise. Try this:
diff -r 7d53ca113e35 hgext/convert/cvs.py
--- a/hgext/convert/cvs.py Wed Feb 06 20:44:25 2008 -0600
+++ b/hgext/convert/cvs.py Fri Feb 08 17:01:18 2008 -0600
@@ -71,7 +71,7 @@
elif l.startswith("Ancestor branch"):
ancestor = l[17:-1]
# figure out the parent later
- self.parent[id] = None
+ self.parent[id] = lastbranch[ancestor]
elif l.startswith("Author"):
author = self.recode(l[8:-1])
elif l.startswith("Tag:") or l.startswith("Tags:"):
@@ -101,13 +101,14 @@
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,
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list