diff --git a/mercurial/dagop.py b/mercurial/dagop.py --- a/mercurial/dagop.py +++ b/mercurial/dagop.py @@ -32,8 +32,10 @@ def _genrevancestors(repo, revs, followf startdepth = 0 if stopdepth is None: stopdepth = _maxlogdepth - if stopdepth <= 0: + if stopdepth == 0: return + if stopdepth < 0: + raise error.ProgrammingError('negative stopdepth') cl = repo.changelog