changeset 19505:7b815e38022a stable

convert: handle changeset sorting errors without traceback (issue3961)
author Frank Kingswood <frank@kingswood-consulting.co.uk>
date Fri, 26 Jul 2013 14:44:13 +0100
parents 2fa303619b4d
children f0d7721d7322
files hgext/convert/cvsps.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/cvsps.py	Thu Jul 25 14:43:15 2013 -0700
+++ b/hgext/convert/cvsps.py	Fri Jul 26 14:44:13 2013 +0100
@@ -496,6 +496,7 @@
         .branchpoints- the branches that start at the current entry or empty
     '''
     def __init__(self, **entries):
+        self.id = None
         self.synthetic = False
         self.__dict__.update(entries)
 
@@ -604,7 +605,8 @@
 
     # Sort changesets by date
 
-    def cscmp(l, r):
+    odd = set()
+    def cscmp(l, r, odd=odd):
         d = sum(l.date) - sum(r.date)
         if d:
             return d
@@ -626,7 +628,8 @@
 
         for e in r.entries:
             if le.get(e.rcs, None) == e.parent:
-                assert not d
+                if d:
+                    odd.add((l, r))
                 d = -1
                 break
 
@@ -769,6 +772,12 @@
     for i, c in enumerate(changesets):
         c.id = i + 1
 
+    if odd:
+        for l, r in odd:
+            if l.id is not None and r.id is not None:
+                ui.warn(_('changeset %d is both before and after %d\n')
+                        % (l.id, r.id))
+
     ui.status(_('%d changeset entries\n') % len(changesets))
 
     hook.hook(ui, None, "cvschangesets", True, changesets=changesets)