Patchwork D2661: hgweb: fix up trailing slash detection on Python 3

login
register
mail settings
Submitter phabricator
Date March 4, 2018, 6:12 p.m.
Message ID <differential-rev-PHID-DREV-xcti3qf3ohodla2q54lb-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28956/
State Superseded
Headers show

Comments

phabricator - March 4, 2018, 6:12 p.m.
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Fixes a couple of hgweb tests.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2661

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/hgweb/webcommands.py
  mercurial/hgweb/webutil.py

CHANGE DETAILS




To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -38,9 +38,9 @@ 
 )
 
 def up(p):
-    if p[0] != "/":
+    if p[0:1] != "/":
         p = "/" + p
-    if p[-1] == "/":
+    if p[-1:] == "/":
         p = p[:-1]
     up = os.path.dirname(p)
     if up == "/":
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -495,7 +495,7 @@ 
     dirs = {}
     parity = paritygen(web.stripecount)
 
-    if path and path[-1] != "/":
+    if path and path[-1:] != "/":
         path += "/"
     l = len(path)
     abspath = "/" + path
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -130,6 +130,8 @@ 
 test-hghave.t
 test-hgignore.t
 test-hgk.t
+test-hgweb-bundle.t
+test-hgweb-descend-empties.t
 test-hgweb-removed.t
 test-histedit-arguments.t
 test-histedit-base.t