changeset 11448:25430ff23cfa stable

glog: fix crash on empty revision range
author Eric Eisner <ede@mit.edu>
date Thu, 24 Jun 2010 21:35:52 -0700
parents ac256cd2cb36
children 05af334bac05
files hgext/graphlog.py tests/test-glog tests/test-glog.out
diffstat 3 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/graphlog.py	Fri Jun 25 19:59:22 2010 +0200
+++ b/hgext/graphlog.py	Thu Jun 24 21:35:52 2010 -0700
@@ -209,6 +209,8 @@
 def get_revs(repo, rev_opt):
     if rev_opt:
         revs = revrange(repo, rev_opt)
+        if len(revs) == 0:
+            return (nullrev, nullrev)
         return (max(revs), min(revs))
     else:
         return (len(repo) - 1, 0)
--- a/tests/test-glog	Fri Jun 25 19:59:22 2010 +0200
+++ b/tests/test-glog	Thu Jun 24 21:35:52 2010 -0700
@@ -146,6 +146,9 @@
 echo % unused arguments
 hg glog -q foo bar || echo failed
 
+echo % empty revision range - display nothing
+hg glog -r 1..0
+
 echo % from outer space
 cd ..
 hg glog -l1 repo
--- a/tests/test-glog.out	Fri Jun 25 19:59:22 2010 +0200
+++ b/tests/test-glog.out	Thu Jun 24 21:35:52 2010 -0700
@@ -548,6 +548,7 @@
 
 show revision history alongside an ASCII revision graph
 failed
+% empty revision range - display nothing
 % from outer space
 @  changeset:   34:fea3ac5810e0
 |  tag:         tip