[PATCH 2 of 3] cvsps: fix crash when log message refers to non-existent branch (issue1615)

Greg Ward greg-hg at gerg.ca
Sun Apr 19 12:13:40 CDT 2009


# HG changeset patch
# User Greg Ward <greg-hg at gerg.ca>
# Date 1240161140 14400
# Node ID 341830bc285a92aa3affb33d229872b2bbb8c7db
# Parent  3707631f3790212be62820046dbe276184d9dee4
cvsps: fix crash when log message refers to non-existent branch (issue1615).

diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py
--- a/hgext/convert/cvsps.py
+++ b/hgext/convert/cvsps.py
@@ -637,7 +637,12 @@
                 m = m.group(1)
                 if m == 'HEAD':
                     m = None
-                candidate = changesets[branches[m]]
+                try:
+                    candidate = changesets[branches[m]]
+                except KeyError:
+                    ui.warn("warning: CVS commit message references "
+                            "non-existent branch %r:\n%s\n"
+                            % (m, c.comment))
                 if m in branches and c.branch != m and not candidate.synthetic:
                     c.parents.append(candidate)
 


More information about the Mercurial-devel mailing list