revset: pass repo when passing ui
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 15 Jul 2017 15:51:57 -0700
changeset 33554 2943141f5e07
parent 33553 9c4e2aa0a239
child 33555 6755b719048c
revset: pass repo when passing ui The repo instance is currently only used to provide a changeset lookup function as part of parsing revsets. I /think/ this allows node fragments to resolve. I'm not sure why we wouldn't want this to always "just work" if parsing a revset string. Plus, an upcoming commit will introduce a new consumer that needs a handle on the repo. So passing it more often will make that code work more. Passing a repo instance in all callers of revset.match* results in a bunch of test changes. Notably, branch and tags caches get populated as part of evaluating revsets. I'm not sure if this is desirable. So this patch takes the conservative approach and only passes the repo if we're passing a ui instance. Differential Revision: https://phab.mercurial-scm.org/D97
mercurial/hgweb/webcommands.py
mercurial/templater.py
--- a/mercurial/hgweb/webcommands.py	Mon Jul 17 13:22:59 2017 -0500
+++ b/mercurial/hgweb/webcommands.py	Sat Jul 15 15:51:57 2017 -0700
@@ -260,7 +260,7 @@
         if not funcsused.issubset(revset.safesymbols):
             return MODE_KEYWORD, query
 
-        mfunc = revset.match(web.repo.ui, revdef)
+        mfunc = revset.match(web.repo.ui, revdef, repo=web.repo)
         try:
             revs = mfunc(web.repo)
             return MODE_REVSET, revs
--- a/mercurial/templater.py	Mon Jul 17 13:22:59 2017 -0500
+++ b/mercurial/templater.py	Sat Jul 15 15:51:57 2017 -0700
@@ -874,7 +874,7 @@
     repo = ctx.repo()
 
     def query(expr):
-        m = revsetmod.match(repo.ui, expr)
+        m = revsetmod.match(repo.ui, expr, repo=repo)
         return m(repo)
 
     if len(args) > 1: