Patchwork [1,of,3] scmutil: changed revrange to return lazysets for new style revsets

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 22, 2014, 7:19 p.m.
Message ID <857bff65281118fee59b.1393096772@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3739/
State Accepted
Commit efae655fd3635fec9e1730528a5fd5f220262652
Headers show

Comments

Lucas Moscovicz - Feb. 22, 2014, 7:19 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@fb.com>
# Date 1392247827 28800
#      Wed Feb 12 15:30:27 2014 -0800
# Node ID 857bff65281118fee59b3d636835409925cabafc
# Parent  be5b87453bdb33ea6d11d50b832d909224b746a3
scmutil: changed revrange to return lazysets for new style revsets

When there is an old style revset or both it will still return a baseset. This
may be changed in later patches.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -489,7 +489,7 @@ 
         try:
             if isinstance(spec, int):
                 seen.add(spec)
-                l.append(spec)
+                l = l + [spec]
                 continue
 
             if _revrangesep in spec:
@@ -510,7 +510,7 @@ 
                     seen.update(newrevs)
                 else:
                     seen = newrevs
-                l.extend(sorted(newrevs, reverse=start > end))
+                l = l + sorted(newrevs, reverse=start > end)
                 continue
             elif spec and spec in repo: # single unquoted rev
                 rev = revfix(repo, spec, None)
@@ -524,11 +524,14 @@ 
 
         # fall through to new-style queries if old-style fails
         m = revset.match(repo.ui, spec)
-        dl = [r for r in m(repo, revset.spanset(repo)) if r not in seen]
-        l.extend(dl)
-        seen.update(dl)
+        if seen or l:
+            dl = [r for r in m(repo, revset.spanset(repo)) if r not in seen]
+            l = l + dl
+            seen.update(dl)
+        else:
+            l = m(repo, revset.spanset(repo))
 
-    return revset.baseset(l)
+    return l
 
 def expandpats(pats):
     if not util.expandglobs: