# HG changeset patch
# User Angel Ezquerra <[email protected]>
# Date 1456619241 -3600
# Sun Feb 28 01:27:21 2016 +0100
# Branch stable
# Node ID bbc39c3861f8b5c0823610362697427af0b357e3
# Parent 9303d22fa788628d9f441477f8d1d70c026578bf
file_browser: properly handle subrepos using relative paths
Mercurial subrepos can point to relative or absolute paths. It is usually
recommended that Mercurial subrepos should be "simple", which means that they
must be declared as follows in their .hgsub file:
path = path
Where path is the relative path of the subrepo to the root of the repository.
Up until now Kallithea did not really support subrepos with relative paths. This
revision tries to fix that.
# NOTES:
This version is RFC because the link that is created for relative subrepos seems
correct but does not work for me (on Firefox on windows) when I left click on
it. It _does_ work if I right click it and select "Open Link in New Window" or
"Open Link in New Tab".
diff --git a/kallithea/templates/files/files_browser.html
b/kallithea/templates/files/files_browser.html
--- a/kallithea/templates/files/files_browser.html
+++ b/kallithea/templates/files/files_browser.html
@@ -9,7 +9,13 @@
</%def>
<%def name="file_url(node, c)">
%if node.is_submodule():
- <%return node.url or '#'%>
+ %if '://' in node.url:
+ ## submodule pointing to an absolute URL
+ <%return node.url or '#'%>
+ %else:
+ ## submodule pointing to a relative URL (as is recommended for
Mercurial subrepos
+ <%return h.url('changeset_home', repo_name=(c.db_repo.repo_name +
'/' + node.url), revision=node.changeset.raw_id)%>
+ %endif
%else:
<%return h.url('files_home', repo_name=c.repo_name,
revision=c.changeset.raw_id, f_path=h.safe_unicode(node.path))%>
%endif
# HG changeset patch
# User Angel Ezquerra <[email protected]>
# Date 1456619241 -3600
# Sun Feb 28 01:27:21 2016 +0100
# Branch stable
# Node ID bbc39c3861f8b5c0823610362697427af0b357e3
# Parent 9303d22fa788628d9f441477f8d1d70c026578bf
file_browser: properly handle subrepos using relative paths
Mercurial subrepos can point to relative or absolute paths. It is usually
recommended that Mercurial subrepos should be "simple", which means that they
must be declared as follows in their .hgsub file:
path = path
Where path is the relative path of the subrepo to the root of the repository.
Up until now Kallithea did not really support subrepos with relative paths. This
revision tries to fix that.
# NOTES:
This version is RFC because the link that is created for relative subrepos seems
correct but does not work for me (on Firefox on windows) when I left click on
it. It _does_ work if I right click it and select "Open Link in New Window" or
"Open Link in New Tab".
diff --git a/kallithea/templates/files/files_browser.html b/kallithea/templates/files/files_browser.html
--- a/kallithea/templates/files/files_browser.html
+++ b/kallithea/templates/files/files_browser.html
@@ -9,7 +9,13 @@
</%def>
<%def name="file_url(node, c)">
%if node.is_submodule():
- <%return node.url or '#'%>
+ %if '://' in node.url:
+ ## submodule pointing to an absolute URL
+ <%return node.url or '#'%>
+ %else:
+ ## submodule pointing to a relative URL (as is recommended for Mercurial subrepos
+ <%return h.url('changeset_home', repo_name=(c.db_repo.repo_name + '/' + node.url), revision=node.changeset.raw_id)%>
+ %endif
%else:
<%return h.url('files_home', repo_name=c.repo_name, revision=c.changeset.raw_id, f_path=h.safe_unicode(node.path))%>
%endif
_______________________________________________
kallithea-general mailing list
[email protected]
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general