[PATCH 3 of 3 follow-up] dagop: check if stopdepth is greater than or equal to maxlogdepth

Anton Shestakov av6 at dwimlabs.net
Fri Jan 25 23:58:21 EST 2019


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1548476644 -28800
#      Sat Jan 26 12:24:04 2019 +0800
# Node ID 60b308740000fef7ed43891e667119035ccc3250
# Parent  88aef4c81971a828462c22f24e18246116c6715b
dagop: check if stopdepth is greater than or equal to maxlogdepth

Might prevent off-by-one errors.

diff --git a/mercurial/dagop.py b/mercurial/dagop.py
--- a/mercurial/dagop.py
+++ b/mercurial/dagop.py
@@ -221,7 +221,7 @@ def revdescendants(repo, revs, followfir
     Scan ends at the stopdepth (exlusive) if specified. Revisions found
     earlier than the startdepth are omitted.
     """
-    if startdepth is None and (stopdepth is None or stopdepth == maxlogdepth):
+    if startdepth is None and (stopdepth is None or stopdepth >= maxlogdepth):
         gen = _genrevdescendants(repo, revs, followfirst)
     else:
         gen = _genrevdescendantsofdepth(repo, revs, followfirst,


More information about the Mercurial-devel mailing list