[PATCH 5 of 5] win32text: use 'tiprev' when appropriate

Boris Feld boris.feld at octobus.net
Wed Jan 17 13:33:53 EST 2018


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1516190562 -3600
#      Wed Jan 17 13:02:42 2018 +0100
# Node ID 7ce8b78bbed0684bcd5529beb83cc04a8c456c34
# Parent  f345503e9327bb9a2967f5f75b3a49ecb302afc0
# EXP-Topic tiprev
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 7ce8b78bbed0
win32text: use 'tiprev' when appropriate

This is cleaner than the current 'len(repo) - 1' form.

diff --git a/hgext/win32text.py b/hgext/win32text.py
--- a/hgext/win32text.py
+++ b/hgext/win32text.py
@@ -139,7 +139,7 @@ def forbidnewline(ui, repo, hooktype, no
     # changegroup that contains an unacceptable commit followed later
     # by a commit that fixes the problem.
     tip = repo['tip']
-    for rev in xrange(len(repo) - 1, repo[node].rev() - 1, -1):
+    for rev in xrange(repo.changelog.tiprev(), repo[node].rev() - 1, -1):
         c = repo[rev]
         for f in c.files():
             if f in seen or f not in tip or f not in c:


More information about the Mercurial-devel mailing list