revset: ensure we are reversing a list (issue3530)
authorBryan O'Sullivan <bryano@fb.com>
Wed, 04 Jul 2012 09:38:07 -0700
changeset 17100 ee2370d866fc
parent 17099 1c55d1add24f
child 17101 6bc275593d07
revset: ensure we are reversing a list (issue3530)
mercurial/revset.py
tests/test-revset.t
--- a/mercurial/revset.py	Tue Jul 03 18:02:07 2012 +0200
+++ b/mercurial/revset.py	Wed Jul 04 09:38:07 2012 -0700
@@ -1151,6 +1151,8 @@
     Reverse order of set.
     """
     l = getset(repo, subset, x)
+    if not isinstance(l, list):
+        l = list(l)
     l.reverse()
     return l
 
--- a/tests/test-revset.t	Tue Jul 03 18:02:07 2012 +0200
+++ b/tests/test-revset.t	Wed Jul 04 09:38:07 2012 -0700
@@ -372,6 +372,17 @@
   4
   3
   2
+  $ log 'reverse(all())'
+  9
+  8
+  7
+  6
+  5
+  4
+  3
+  2
+  1
+  0
   $ log 'rev(5)'
   5
   $ log 'sort(limit(reverse(all()), 3))'