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 a98e985d1dd1, 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.
This commit is contained in:
Yuya Nishihara 2015-02-06 00:06:47 +09:00
parent 454ee6ca93
commit bba83cb128

View File

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