Patchwork [V2] scmutil: changed revrange code not to use append

login
register
mail settings
Submitter Lucas Moscovicz
Date Feb. 24, 2014, 11:06 p.m.
Message ID <40d526f09065496c1212.1393283205@dev1037.prn2.facebook.com>
Download mbox | patch
Permalink /patch/3753/
State Accepted
Commit 165b117ffc1e0597331b7b3f9a0b666c8749df38
Headers show

Comments

Lucas Moscovicz - Feb. 24, 2014, 11:06 p.m.
# HG changeset patch
# User Lucas Moscovicz <lmoscovicz@fb.com>
# Date 1393262852 28800
#      Mon Feb 24 09:27:32 2014 -0800
# Node ID 40d526f09065496c12125bf622b741ca40e8c7b4
# Parent  dbb13949e05d8c576672ea0a49a978048c77ddf7
scmutil: changed revrange code not to use append

Removed one call to the append method
Matt Mackall - Feb. 24, 2014, 11:29 p.m.
On Mon, 2014-02-24 at 15:06 -0800, Lucas Moscovicz wrote:
> # HG changeset patch
> # User Lucas Moscovicz <lmoscovicz@fb.com>
> # Date 1393262852 28800
> #      Mon Feb 24 09:27:32 2014 -0800
> # Node ID 40d526f09065496c12125bf622b741ca40e8c7b4
> # Parent  dbb13949e05d8c576672ea0a49a978048c77ddf7
> scmutil: changed revrange code not to use append

Queued for default, thanks.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -480,7 +480,7 @@ 
             return defval
         return repo[val].rev()
 
-    seen, l = set(), []
+    seen, l = set(), revset.baseset([])
     for spec in revs:
         if l and not seen:
             seen = set(l)
@@ -501,7 +501,7 @@ 
                 rangeiter = repo.changelog.revs(start, end)
                 if not seen and not l:
                     # by far the most common case: revs = ["-1:0"]
-                    l = list(rangeiter)
+                    l = revset.baseset(rangeiter)
                     # defer syncing seen until next iteration
                     continue
                 newrevs = set(rangeiter)
@@ -517,7 +517,7 @@ 
                 if rev in seen:
                     continue
                 seen.add(rev)
-                l.append(rev)
+                l = l + [rev]
                 continue
         except error.RepoLookupError:
             pass