Patchwork Fix revrange when multiple revs are specified

login
register
mail settings
Submitter Durham Goode
Date March 20, 2014, 5:41 p.m.
Message ID <1849b64f82a411e1b1d5.1395337311@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/4003/
State Accepted
Headers show

Comments

Durham Goode - March 20, 2014, 5:41 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1395334544 25200
#      Thu Mar 20 09:55:44 2014 -0700
# Node ID 1849b64f82a411e1b1d51f3a630979d8b651687c
# Parent  43054dc84abd65e8c6f5dd93cf96e54ecf2b2612
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.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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))
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -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