changeset 1257:fe7fbfdb066d

Clamp negative rev numbers at zero. Prior to this change, trying to run "hg log -r -50:" in a repo with less than 50 changes caused an error. Now that we clamp at zero: no more error.
author Bryan O'Sullivan <bos@serpentine.com>
date Thu, 15 Sep 2005 00:04:29 -0700
parents e825dfea3823
children f75567782aba
files mercurial/commands.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Sep 14 22:32:12 2005 -0700
+++ b/mercurial/commands.py	Thu Sep 15 00:04:29 2005 -0700
@@ -163,9 +163,9 @@
             num = int(val)
             if str(num) != val:
                 raise ValueError
-            if num < 0:
-                num += revcount
-            if not (0 <= num < revcount):
+            if num < 0: num += revcount
+            if num < 0: num = 0
+            elif num >= revcount:
                 raise ValueError
         except ValueError:
             try: