changeset 18466:ac0c12123743 stable

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.
author Sean Farley <sean.michael.farley@gmail.com>
date Wed, 23 Jan 2013 00:12:52 -0600
parents 3aa8b4b36b64
children e441657b372b
files mercurial/scmutil.py tests/test-log.t
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Tue Jan 22 18:40:23 2013 -0600
+++ b/mercurial/scmutil.py	Wed Jan 23 00:12:52 2013 -0600
@@ -6,6 +6,7 @@
 # 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
@@ -647,6 +648,8 @@
                 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"]
--- a/tests/test-log.t	Tue Jan 22 18:40:23 2013 -0600
+++ b/tests/test-log.t	Wed Jan 23 00:12:52 2013 -0600
@@ -1296,4 +1296,13 @@
   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 ..