grim/hgwebplus

Parents 3c9b2c82af32
Children fa1b06d8a651
Use a new method for http_clone_url that Sean Farley found for us.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/COPYRIGHT Tue Nov 03 00:16:25 2020 -0600
@@ -0,0 +1,4 @@
+Gary Kramlich <grim@reaperworld.com>
+Sean Farley <sean@farley.io>
+AV6
+
--- a/ChangeLog Mon Nov 02 23:06:08 2020 -0600
+++ b/ChangeLog Tue Nov 03 00:16:25 2020 -0600
@@ -1,11 +1,14 @@
-0.6.2:
+0.6.3:
+ * A real working solution for http_clone_url. Sean Farley
+
+0.6.2: (2020-11-02)
* Gave up on making http_clone_url smart and instead add an additional
http_base_url and let the templates figure out what to do.
-0.6.1:
+0.6.1: (2020-11-02)
* Tweak the http_clone_path keyword.
-0.6.0:
+0.6.0: (2020-11-02)
* Added full support for http_base_url and http_clone_url.
* Beta support for titles and subtitles.
--- a/src/hgwebplus.py Mon Nov 02 23:06:08 2020 -0600
+++ b/src/hgwebplus.py Tue Nov 03 00:16:25 2020 -0600
@@ -252,9 +252,15 @@
easier for users to clone repositories.
"""
- ui = context.resource(mapping, b'ui')
+ urlbase = context.symbol(mapping, b'urlbase')
+ if urlbase.endswith(b'/'):
+ urlbase = urlbase[:-1]
- return ui.config(b'web', b'http_clone_url', b'')
+ path = context.symbol(mapping, b'url')
+ if path.startswith(b'/'):
+ path = path[1:]
+
+ return urlbase + b'/' + path
def http_base_url(context, mapping):
@@ -346,8 +352,7 @@
templatekeyword = registrar.templatekeyword(templater._proc._defaults)
- templatekeyword(b'http_clone_url', requires={b'ui'})(http_clone_url)
- templatekeyword(b'http_base_url', requires={b'ui'})(http_base_url)
+ templatekeyword(b'http_clone_url', requires=())(http_clone_url)
templatekeyword(b'readme', requires={b'ctx', b'repo'})(readme)
templatekeyword(b'ssh_clone_url', requires={b'ui', b'repo'})(ssh_clone_url)