Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 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 | 1c97df5e3b46 |
children | 08346a8fa65f |
comparison
equal
deleted
inserted
replaced
33553:9c4e2aa0a239 | 33554:2943141f5e07 |
---|---|
258 | 258 |
259 funcsused = revsetlang.funcsused(tree) | 259 funcsused = revsetlang.funcsused(tree) |
260 if not funcsused.issubset(revset.safesymbols): | 260 if not funcsused.issubset(revset.safesymbols): |
261 return MODE_KEYWORD, query | 261 return MODE_KEYWORD, query |
262 | 262 |
263 mfunc = revset.match(web.repo.ui, revdef) | 263 mfunc = revset.match(web.repo.ui, revdef, repo=web.repo) |
264 try: | 264 try: |
265 revs = mfunc(web.repo) | 265 revs = mfunc(web.repo) |
266 return MODE_REVSET, revs | 266 return MODE_REVSET, revs |
267 # ParseError: wrongly placed tokens, wrongs arguments, etc | 267 # ParseError: wrongly placed tokens, wrongs arguments, etc |
268 # RepoLookupError: no such revision, e.g. in 'revision:' | 268 # RepoLookupError: no such revision, e.g. in 'revision:' |