Patchwork convert: handle changeset sorting errors without traceback (issue3961)

login
register
mail settings
Submitter Frank Kingswood
Date July 26, 2013, 1:57 p.m.
Message ID <eae49b0a95ff30d017f6.1374847036@andromeda.kingswood-consulting.co.uk>
Download mbox | patch
Permalink /patch/1975/
State Accepted
Commit 7b815e38022ac303df93d2a0b3cf1b330e4ce30b
Headers show

Comments

Frank Kingswood - July 26, 2013, 1:57 p.m.
# HG changeset patch
# User Frank Kingswood <frank@kingswood-consulting.co.uk>
# Date 1374846253 -3600
# Branch stable
# Node ID eae49b0a95ff30d017f69dec5fdd9bfb3efe40a0
# Parent  725507cd52169b979ecb67b51a177d6e99ae4616
convert: handle changeset sorting errors without traceback (issue3961)
Matt Mackall - July 26, 2013, 7:07 p.m.
On Fri, 2013-07-26 at 14:57 +0100, Frank Kingswood wrote:
> # HG changeset patch
> # User Frank Kingswood <frank@kingswood-consulting.co.uk>
> # Date 1374846253 -3600
> # Branch stable
> # Node ID eae49b0a95ff30d017f69dec5fdd9bfb3efe40a0
> # Parent  725507cd52169b979ecb67b51a177d6e99ae4616
> convert: handle changeset sorting errors without traceback (issue3961)

Thanks, queued for stable. Check-code sends its regards.

Patch

diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py
--- a/hgext/convert/cvsps.py
+++ b/hgext/convert/cvsps.py
@@ -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,11 @@ 
     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)