[PATCH 1 of 1] revset: optimize stringset when subset == entire repo

Idan Kamara idankk86 at gmail.com
Fri Apr 15 12:10:39 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1302887264 -10800
# Node ID eab8d3d2dde5e1ad8a2aa5a0eaf623ffe4a64406
# Parent  e0e9949a54f8d2a261712ddf783a9a1777dcf459
revset: optimize stringset when subset == entire repo

if range(len(repo)) is passed to stringset and x is a valid rev (checked before) then
x is guaranteed to be in subset, we can check for that by comparing the lengths of the sets

diff -r e0e9949a54f8 -r eab8d3d2dde5 mercurial/revset.py
--- a/mercurial/revset.py	Fri Apr 15 16:35:32 2011 +0300
+++ b/mercurial/revset.py	Fri Apr 15 20:07:44 2011 +0300
@@ -123,7 +123,7 @@
     x = repo[x].rev()
     if x == -1 and len(subset) == len(repo):
         return [-1]
-    if x in subset:
+    if len(subset) == len(repo) or x in subset:
         return [x]
     return []
 


More information about the Mercurial-devel mailing list