D2661: hgweb: fix up trailing slash detection on Python 3
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Sun Mar 4 18:12:31 UTC 2018
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
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
To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list