Patchwork [1,of,6] graphlog: remove too early return from getgraphlogrevs() for empty repo

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 6, 2015, 2:40 p.m.
Message ID <3935fb2aa125fd7ca099.1423233657@mimosa>
Download mbox | patch
Permalink /patch/7709/
State Accepted
Commit 8d295ce6e488a8f2db43648e2156da3961f45603
Headers show

Comments

Yuya Nishihara - Feb. 6, 2015, 2:40 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1423145684 -32400
#      Thu Feb 05 23:14:44 2015 +0900
# Node ID 3935fb2aa125fd7ca09979e0bbd7369a6a19935a
# Parent  a9b61dbdb827165a9fd9d44dd42b892dbd9fa07c
graphlog: remove too early return from getgraphlogrevs() for empty repo

Even if repository is empty, null revision should exist.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1830,8 +1830,6 @@  def getgraphlogrevs(repo, pats, opts):
     callable taking a revision number and returning a match objects
     filtering the files to be detailed when displaying the revision.
     """
-    if not len(repo):
-        return [], None, None
     limit = loglimit(opts)
     # Default --rev value depends on --follow but --follow behaviour
     # depends on revisions resolved from --rev...
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -1541,6 +1541,9 @@  have 2 filelog topological heads in a li
   $ testlog --follow
   []
   []
+  $ testlog -rnull
+  ['null']
+  []
   $ echo a > a
   $ echo aa > aa
   $ echo f > f