[PATCH] revset: fix resolving strings from a list

Durham Goode durham at fb.com
Tue Sep 1 23:53:18 UTC 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1441151165 25200
#      Tue Sep 01 16:46:05 2015 -0700
# Node ID d4ca5e9300bd7a689834ff1158bf9fada625028e
# Parent  049005de325ea400893f45bd6221215cc9b26db0
revset: fix resolving strings from a list

When using multiple revsets that get optimized into a list (like
hg log -r r1235 -r r1237 in hgsubversion), the revset list code was assuming the
strings were resolvable via repo[X]. hgsubversion and other extensions override
def stringset() to allow processing different revision identifiers (such as
r1235 or g<githash>), and there for the _list() implementation was circumventing
that resolution.

The fix is to just call stringset(). The default implementaiton does the same
thing that _list was already doing (namely repo[X]).

This has always been broken, but it was recently exposed by 4ee4f7415095 which
made "--rev X --rev Y" produce a combined revset "X | Y".

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2067,14 +2067,17 @@ def _list(repo, subset, x):
             r = int(t)
             if str(r) != t or r not in cl:
                 raise ValueError
+            revs = [r]
         except ValueError:
-            r = repo[t].rev()
-        if r in seen:
-            continue
-        if (r in subset
-            or r == node.nullrev and isinstance(subset, fullreposet)):
-            ls.append(r)
-        seen.add(r)
+            revs = stringset(repo, subset, t)
+
+        for r in revs:
+            if r in seen:
+                continue
+            if (r in subset
+                or r == node.nullrev and isinstance(subset, fullreposet)):
+                ls.append(r)
+            seen.add(r)
     return baseset(ls)
 
 # for internal use


More information about the Mercurial-devel mailing list