Patchwork [1,of,6] py3: use bytes.endswith() instead of bytes[n]

login
register
mail settings
Submitter Yuya Nishihara
Date July 8, 2018, 12:30 p.m.
Message ID <21be76e071488bd19482.1531053042@mimosa>
Download mbox | patch
Permalink /patch/32687/
State Accepted
Headers show

Comments

Yuya Nishihara - July 8, 2018, 12:30 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1531035074 -32400
#      Sun Jul 08 16:31:14 2018 +0900
# Node ID 21be76e071488bd19482d75222bdced632425de4
# Parent  be441eb65f09603386f853b1604aae92bca6b53e
py3: use bytes.endswith() instead of bytes[n]

Patch

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -2,6 +2,7 @@  test-abort-checkin.t
 test-add.t
 test-addremove-similar.t
 test-addremove.t
+test-alias.t
 test-amend-subrepo.t
 test-amend.t
 test-ancestor.py
diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py
--- a/mercurial/pathutil.py
+++ b/mercurial/pathutil.py
@@ -226,7 +226,7 @@  def canonpath(root, cwd, myname, auditor
             if cwd != root:
                 canonpath(root, root, myname, auditor)
                 relpath = util.pathto(root, cwd, '')
-                if relpath[-1] == pycompat.ossep:
+                if relpath.endswith(pycompat.ossep):
                     relpath = relpath[:-1]
                 hint = (_("consider using '--cwd %s'") % relpath)
         except error.Abort: