changeset 18718:c8c3887a24c1

convert: stabilize cvsps commitid sort order
author Matt Mackall <mpm@selenic.com>
date Fri, 22 Feb 2013 16:40:27 -0600
parents fcc4b55876c3
children 9ad13296c581
files hgext/convert/cvsps.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/cvsps.py	Fri Feb 22 15:17:33 2013 -0600
+++ b/hgext/convert/cvsps.py	Fri Feb 22 16:40:27 2013 -0600
@@ -508,9 +508,15 @@
 
     ui.status(_('creating changesets\n'))
 
+    # try to order commitids by date
+    mindate = {}
+    for e in log:
+        if e.commitid:
+            mindate[e.commitid] = min(e.date, mindate.get(e.commitid))
+
     # Merge changesets
-    log.sort(key=lambda x: (x.commitid, x.comment, x.author, x.branch, x.date,
-                            x.branchpoints))
+    log.sort(key=lambda x: (mindate.get(x.commitid), x.commitid, x.comment,
+                            x.author, x.branch, x.date, x.branchpoints))
 
     changesets = []
     files = set()