Patchwork [3,of,6] graphlog: remove useless check for empty repo when --follow is specified

mail settings
Submitter Yuya Nishihara
Date Feb. 6, 2015, 2:40 p.m.
Message ID <9897709778e4f046ac4c.1423233659@mimosa>
Download mbox | patch
Permalink /patch/7711/
State Accepted
Commit 4fa72a09c73df58cc94e7094082ebba8adf8c7f0
Headers show


Yuya Nishihara - Feb. 6, 2015, 2:40 p.m.
# HG changeset patch
# User Yuya Nishihara <>
# Date 1423148807 -32400
#      Fri Feb 06 00:06:47 2015 +0900
# Node ID 9897709778e4f046ac4c82de07808505ffa90379
# Parent  423f43b4a5ed798c5d1340e3f35dd44a58e9eed0
graphlog: remove useless check for empty repo when --follow is specified

This prepares for extracting common part from getgraphlogrevs() and
getlogrevs(). getlogrevs() does not handle empty repo specially.

When it was added at d74099ac2ac1, revs were build by old-style query, '.:0'.
So I think the purpose of "len(repo) > 0" was to handle the case of . = null.
Currently it isn't necessary for 'reverse(:.)', and it does not work if repo
is not empty but p1 is null.

  $ hg up null
  $ hg glog --follow -T '{rev}:{node|short}\n'
  o  0:0a04b987be5a

The subsequent patch will fix this problem, so drops the wrong version for now.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1837,7 +1837,7 @@  def getgraphlogrevs(repo, pats, opts):
     if opts.get('rev'):
         revs = scmutil.revrange(repo, opts['rev'])
-        if follow and len(repo) > 0:
+        if follow:
             revs = repo.revs('reverse(:.)')
             revs = revset.spanset(repo)