mercurial/context.py
changeset 4640 178778ca648f
parent 4635 63b9d2deed48
parent 4638 3c7fc13c4bfa
child 4663 6b2e8cb39583
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -291,11 +291,10 @@ class filectx(object):
 
         # sort by revision (per file) which is a topological order
         visit = []
-        files.reverse()
         for f in files:
-            fn = [(n._filerev, n) for n in needed.keys() if n._path == f]
-            fn.sort()
+            fn = [(n.rev(), n) for n in needed.keys() if n._path == f]
             visit.extend(fn)
+        visit.sort()
         hist = {}
 
         for r, f in visit: