diff mercurial/revset.py @ 16640:592e0beee8b0 stable

revset: make matching() preserve input revision order
author Patrick Mezard <patrick@mezard.eu>
date Wed, 09 May 2012 18:45:14 +0200
parents 00290bd359fe
children 14913fcb30c6 47b8ec0eb7fb
line wrap: on
line diff
--- a/mercurial/revset.py	Thu May 10 14:17:05 2012 -0400
+++ b/mercurial/revset.py	Wed May 09 18:45:14 2012 +0200
@@ -996,7 +996,7 @@
     # is only one field to match)
     getinfo = lambda r: [f(r) for f in getfieldfuncs]
 
-    matches = []
+    matches = set()
     for rev in revs:
         target = getinfo(rev)
         for r in subset:
@@ -1006,10 +1006,8 @@
                     match = False
                     break
             if match:
-                matches.append(r)
-    if len(revs) > 1:
-        matches = sorted(set(matches))
-    return matches
+                matches.add(r)
+    return [r for r in subset if r in matches]
 
 def reverse(repo, subset, x):
     """``reverse(set)``