convert: stabilize cvsps commitid sort order
authorMatt Mackall <mpm@selenic.com>
Fri, 22 Feb 2013 16:40:27 -0600
changeset 18718 c8c3887a24c1
parent 18717 fcc4b55876c3
child 18719 9ad13296c581
convert: stabilize cvsps commitid sort order
hgext/convert/cvsps.py
--- 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()