# HG changeset patch # User Bryan O'Sullivan # Date 1126767869 25200 # Node ID fe7fbfdb066d2ff8f34978e3db0db868f3912e44 # Parent e825dfea382373b84378dcb3ea472a8ae7b27c38 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. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -163,9 +163,9 @@ def revrange(ui, repo, revs, revlog=None 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: