changeset 33554:2943141f5e07

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 15 Jul 2017 15:51:57 -0700
parents 9c4e2aa0a239
children 6755b719048c
files mercurial/hgweb/webcommands.py mercurial/templater.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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: