[PATCH 6 of 6] log: drop unused expr from return value of getlogrevs()
Yuya Nishihara
yuya at tcha.org
Thu Jan 4 08:36:47 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1508680151 -32400
# Sun Oct 22 22:49:11 2017 +0900
# Node ID d944bd7c3801f1fb4fa36f428abe79ab714297a8
# Parent a7ad7ce089a3d9473c98d094da670834ba40bdb6
log: drop unused expr from return value of getlogrevs()
Future patches will move some processing of the --follow option out of
_makelogrevset(), where the returned 'expr' value will be less consistent
with the 'revs'. So let's remove it from the public interface.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2505,17 +2505,16 @@ def _logrevs(repo, opts):
return revs
def getlogrevs(repo, pats, opts):
- """Return (revs, expr, filematcher) where revs is an iterable of
- revision numbers, expr is a revset string built from log options
- and file patterns or None, and used to filter 'revs'. If --stat or
- --patch are not passed filematcher is None. Otherwise it is a
- callable taking a revision number and returning a match objects
+ """Return (revs, filematcher) where revs is a smartset
+
+ If --stat or --patch is not passed, filematcher is None. Otherwise it
+ is a callable taking a revision number and returning a match objects
filtering the files to be detailed when displaying the revision.
"""
limit = loglimit(opts)
revs = _logrevs(repo, opts)
if not revs:
- return smartset.baseset(), None, None
+ return smartset.baseset(), None
expr, filematcher = _makelogrevset(repo, pats, opts, revs)
if opts.get('graph') and opts.get('rev'):
# User-specified revs might be unsorted, but don't sort before
@@ -2527,7 +2526,7 @@ def getlogrevs(repo, pats, opts):
revs = matcher(repo, revs)
if limit is not None:
revs = revs.slice(0, limit)
- return revs, expr, filematcher
+ return revs, filematcher
def _parselinerangelogopt(repo, opts):
"""Parse --line-range log option and return a list of tuples (filename,
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3401,7 +3401,7 @@ def log(ui, repo, *pats, **opts):
del opts['follow']
repo = scmutil.unhidehashlikerevs(repo, opts.get('rev'), 'nowarn')
- revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts)
+ revs, filematcher = cmdutil.getlogrevs(repo, pats, opts)
hunksfilter = None
if opts.get('graph'):
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -90,10 +90,16 @@ o (0) root
> revsetlang,
> )
>
+ > def logrevset(repo, pats, opts):
+ > revs = cmdutil._logrevs(repo, opts)
+ > if not revs:
+ > return None
+ > return cmdutil._makelogrevset(repo, pats, opts, revs)[0]
+ >
> def uisetup(ui):
> def printrevset(orig, ui, repo, *pats, **opts):
> if opts.get('print_revset'):
- > expr = cmdutil.getlogrevs(repo, pats, opts)[1]
+ > expr = logrevset(repo, pats, opts)
> if expr:
> tree = revsetlang.parse(expr)
> else:
More information about the Mercurial-devel
mailing list