changeset 35683:ea3320015d54

log: remove dead code to follow descendants if ascending revisions specified It's been disabled since 8b4b9ee6001a "log: make -fr show complete history from the given revs" 2015-02-06, and we've got no bug report regarding this exact behavior. For details what the heck "followdescendants" is, please see the issue comment: https://bz.mercurial-scm.org/show_bug.cgi?id=4959#c72 "'rev(%d)' % startrev" can be replaced with '.' since revs are 'reversed(:.)'.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 10 Dec 2017 18:22:06 +0900
parents 8273c1a47282
children 1c929b4942a3
files mercurial/cmdutil.py mercurial/commands.py tests/test-glog.t
diffstat 3 files changed, 10 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun Dec 10 16:59:54 2017 +0900
+++ b/mercurial/cmdutil.py	Sun Dec 10 18:22:06 2017 +0900
@@ -2359,8 +2359,6 @@
     'only_merges':      ('merge()', None),
     '_ancestors':       ('ancestors(%r)', None),
     '_fancestors':      ('_firstancestors(%r)', None),
-    '_descendants':     ('descendants(%r)', None),
-    '_fdescendants':    ('_firstdescendants(%r)', None),
     '_matchfiles':      (None, '_matchfiles(%ps)'),
     'date':             ('date(%s)', None),
     'branch':           ('branch(%s)', '%lr'),
@@ -2372,7 +2370,7 @@
     'user':             ('user(%s)', '%lr'),
 }
 
-def _makelogrevset(repo, pats, opts, revs):
+def _makelogrevset(repo, pats, opts):
     """Return (expr, filematcher) where expr is a revset string built
     from log options and file patterns or None. If --stat or --patch
     are not passed filematcher is None. Otherwise it is a callable
@@ -2386,10 +2384,6 @@
         followfirst = 1
     else:
         followfirst = 0
-    # --follow with FILE behavior depends on revs...
-    it = iter(revs)
-    startrev = next(it)
-    followdescendants = startrev < next(it, startrev)
 
     # branch and only_branch are really aliases and must be handled at
     # the same time
@@ -2434,8 +2428,8 @@
                 slowpath = False
 
     fpats = ('_patsfollow', '_patsfollowfirst')
-    fnopats = (('_ancestors', '_fancestors'),
-               ('_descendants', '_fdescendants'))
+    fnopats = ('_ancestors', '_fancestors')
+
     if slowpath:
         # See walkchangerevs() slow path.
         #
@@ -2454,7 +2448,7 @@
             matchargs.append('x:' + p)
         opts['_matchfiles'] = matchargs
         if follow:
-            opts[fnopats[0][followfirst]] = '.'
+            opts[fnopats[followfirst]] = '.'
     else:
         if follow:
             if pats:
@@ -2462,8 +2456,8 @@
                 # manifest entry, so use match.files(), not pats.
                 opts[fpats[followfirst]] = list(match.files())
             else:
-                op = fnopats[followdescendants][followfirst]
-                opts[op] = 'rev(%d)' % startrev
+                op = fnopats[followfirst]
+                opts[op] = '.'
         else:
             opts['_patslog'] = list(pats)
 
@@ -2505,8 +2499,6 @@
     return expr, filematcher
 
 def _logrevs(repo, opts):
-    # Default --rev value depends on --follow but --follow behavior
-    # depends on revisions resolved from --rev...
     follow = opts.get('follow') or opts.get('follow_first')
     if opts.get('rev'):
         revs = scmutil.revrange(repo, opts['rev'])
@@ -2530,7 +2522,7 @@
     revs = _logrevs(repo, opts)
     if not revs:
         return smartset.baseset(), None
-    expr, filematcher = _makelogrevset(repo, pats, opts, revs)
+    expr, filematcher = _makelogrevset(repo, pats, opts)
     if opts.get('graph') and opts.get('rev'):
         # User-specified revs might be unsorted, but don't sort before
         # _makelogrevset because it might depend on the order of revs
--- a/mercurial/commands.py	Sun Dec 10 16:59:54 2017 +0900
+++ b/mercurial/commands.py	Sun Dec 10 18:22:06 2017 +0900
@@ -3280,7 +3280,7 @@
     File history is shown without following rename or copy history of
     files. Use -f/--follow with a filename to follow history across
     renames and copies. --follow without a filename will only show
-    ancestors or descendants of the starting revision.
+    ancestors of the starting revision.
 
     By default this command prints revision number and changeset id,
     tags, non-trivial parents, user, date and time, and a summary for
--- a/tests/test-glog.t	Sun Dec 10 16:59:54 2017 +0900
+++ b/tests/test-glog.t	Sun Dec 10 18:22:06 2017 +0900
@@ -95,7 +95,7 @@
   >     revs = cmdutil._logrevs(repo, opts)
   >     if not revs:
   >         return None
-  >     return cmdutil._makelogrevset(repo, pats, opts, revs)[0]
+  >     return cmdutil._makelogrevset(repo, pats, opts)[0]
   > 
   > def uisetup(ui):
   >     def printrevset(orig, repo, pats, opts):
@@ -1867,9 +1867,7 @@
   []
   (func
     (symbol '_firstancestors')
-    (func
-      (symbol 'rev')
-      (symbol '6')))
+    (symbol '.'))
   <filteredset
     <spanset- 0:7>,
     <generatorsetdesc+>>