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

Martin von Zweigbergk martinvonz at google.com
Thu Jan 18 00:31:00 EST 2018


Queued (actually many hours ago, but I forgot to let you know until
now). Thank you.

On Wed, Jan 17, 2018 at 10:33 AM, Boris Feld <boris.feld at octobus.net> wrote:
> # 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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list