[PATCH 1 of 3 STABLE] notify: use changelog API to iterate over revision number (issue5821)

Boris Feld boris.feld at octobus.net
Thu Apr 19 09:17:07 UTC 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1524056652 -7200
#      Wed Apr 18 15:04:12 2018 +0200
# Branch stable
# Node ID e4f85af0d409055650ee05d18596532bd08747d4
# Parent  afa8126a884b7ad4ba3c34533326a3ea336e6ab2
# EXP-Topic issue5821
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r e4f85af0d409
notify: use changelog API to iterate over revision number (issue5821)

This will avoid iterating over filtered revision.

diff --git a/hgext/notify.py b/hgext/notify.py
--- a/hgext/notify.py
+++ b/hgext/notify.py
@@ -469,8 +469,7 @@ def hook(ui, repo, hooktype, node=None, 
     count = 0
     author = ''
     if hooktype == 'changegroup' or hooktype == 'outgoing':
-        start, end = ctx.rev(), len(repo)
-        for rev in xrange(start, end):
+        for rev in repo.changelog.revs(start=ctx.rev()):
             if n.node(repo[rev]):
                 count += 1
                 if not author:


More information about the Mercurial-devel mailing list