log: drop unused expr from return value of getlogrevs()
authorYuya Nishihara <yuya@tcha.org>
Sun, 22 Oct 2017 22:49:11 +0900
changeset 35548 b14c8bcfbad9
parent 35547 b6dbc860570d
child 35549 94a127152e25
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.
mercurial/cmdutil.py
mercurial/commands.py
tests/test-glog.t
--- a/mercurial/cmdutil.py	Thu Jan 04 12:00:18 2018 +0900
+++ b/mercurial/cmdutil.py	Sun Oct 22 22:49:11 2017 +0900
@@ -2505,17 +2505,16 @@
     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 @@
         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,
--- a/mercurial/commands.py	Thu Jan 04 12:00:18 2018 +0900
+++ b/mercurial/commands.py	Sun Oct 22 22:49:11 2017 +0900
@@ -3410,7 +3410,7 @@
         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'):
--- a/tests/test-glog.t	Thu Jan 04 12:00:18 2018 +0900
+++ b/tests/test-glog.t	Sun Oct 22 22:49:11 2017 +0900
@@ -90,10 +90,16 @@
   >   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: