[PATCH] Fix revrange when multiple revs are specified
Durham Goode
durham at fb.com
Thu Mar 20 12:41:51 CDT 2014
# HG changeset patch
# User Durham Goode <durham at 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.
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
More information about the Mercurial-devel
mailing list