Patchwork [2,of,3] log: remove any ancestors of nullrev (issue3772)

login
register
mail settings
Submitter Sean Farley
Date Jan. 23, 2013, 6:28 a.m.
Message ID <d45b0b049d80d06939ca.1358922500@laptop.local>
Download mbox | patch
Permalink /patch/715/
State Accepted
Commit ac0c12123743b659bc933e859d408676d05c63e0
Headers show

Comments

Sean Farley - Jan. 23, 2013, 6:28 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1358921572 21600
# Branch stable
# Node ID d45b0b049d80d06939ca7c7f33eed4ecdb619d62
# Parent  a7d9ae27dce66975b899147b5ff8ffb679fc951b
log: remove any ancestors of nullrev (issue3772)

For the special case, ":null" we remove the implied revision 0 since that
wouldn't make any sense here. A test case is added to make sure only nullrev is
shown.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -4,10 +4,11 @@ 
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
 from i18n import _
+from mercurial.node import nullrev
 import util, error, osutil, revset, similar, encoding, phases
 import match as matchmod
 import os, errno, re, stat, sys, glob
 
 def nochangesfound(ui, repo, excluded=None):
@@ -645,10 +646,12 @@ 
 
             if _revrangesep in spec:
                 start, end = spec.split(_revrangesep, 1)
                 start = revfix(repo, start, 0)
                 end = revfix(repo, end, len(repo) - 1)
+                if end == nullrev and start <= 0:
+                    start = nullrev
                 rangeiter = repo.changelog.revs(start, end)
                 if not seen and not l:
                     # by far the most common case: revs = ["-1:0"]
                     l = list(rangeiter)
                     # defer syncing seen until next iteration
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1294,6 +1294,15 @@ 
   changeset:   0:65624cd9070a
   $ hg log -l1 .d6 | grep changeset
   changeset:   0:65624cd9070a
   $ hg log -l1 .d6/f1 | grep changeset
   changeset:   0:65624cd9070a
+
+issue3772: hg log -r :null showing revision 0 as well
+
+  $ hg log -r :null
+  changeset:   -1:000000000000
+  user:        
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  
+
   $ cd ..