scmutil: fix revrange when multiple revs are specified
authorDurham Goode <durham@fb.com>
Thu, 20 Mar 2014 09:55:44 -0700
changeset 20798 170d6d591a7d
parent 20797 e286ab22e461
child 20799 069bf1b821c8
scmutil: fix revrange when multiple revs are specified revrange was trying to add a list to a revset class, but revset classes only support adding with other revset classes. So wrap the lists in basesets.
mercurial/scmutil.py
tests/test-revset.t
--- a/mercurial/scmutil.py	Thu Mar 20 00:01:59 2014 -0400
+++ b/mercurial/scmutil.py	Thu Mar 20 09:55:44 2014 -0700
@@ -499,7 +499,7 @@
         try:
             if isinstance(spec, int):
                 seen.add(spec)
-                l = l + [spec]
+                l = l + revset.baseset([spec])
                 continue
 
             if _revrangesep in spec:
@@ -520,14 +520,14 @@
                     seen.update(newrevs)
                 else:
                     seen = newrevs
-                l = l + sorted(newrevs, reverse=start > end)
+                l = l + revset.baseset(sorted(newrevs, reverse=start > end))
                 continue
             elif spec and spec in repo: # single unquoted rev
                 rev = revfix(repo, spec, None)
                 if rev in seen:
                     continue
                 seen.add(rev)
-                l = l + [rev]
+                l = l + revset.baseset([rev])
                 continue
         except error.RepoLookupError:
             pass
@@ -536,7 +536,7 @@
         m = revset.match(repo.ui, spec, repo)
         if seen or l:
             dl = [r for r in m(repo, revset.spanset(repo)) if r not in seen]
-            l = l + dl
+            l = l + revset.baseset(dl)
             seen.update(dl)
         else:
             l = m(repo, revset.spanset(repo))
--- a/tests/test-revset.t	Thu Mar 20 00:01:59 2014 -0400
+++ b/tests/test-revset.t	Thu Mar 20 09:55:44 2014 -0700
@@ -734,6 +734,16 @@
   hg: parse error: ^ expects a number 0, 1, or 2
   [255]
 
+multiple revspecs
+
+  $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n'
+  8
+  9
+  4
+  5
+  6
+  7
+
 aliases:
 
   $ echo '[revsetalias]' >> .hg/hgrc