• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

修订版89e2acfba56bf3474294aa7f9652c3d25d7e6775 (tree)
时间2011-03-23 23:35:21
作者John Hoffmann <jwh@geek...>
CommiterRick Copeland

Log Message

[#1570] Refactor the https instructions, making if available on every repo view for all 3 scm types.

Signed-off-by: John Hoffmann <jwh@geek.net>

更改概述

差异

--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -233,6 +233,10 @@ class Repository(Artifact):
233233 tpl = string.Template(tg.config.get('scm.host.rw.%s' % self.tool))
234234 return tpl.substitute(dict(username=username, path=self.url_path+self.name))
235235
236+ def readwrite_https_path(self, username):
237+ tpl = string.Template(tg.config.get('scm.host.https.%s' % self.tool))
238+ return tpl.substitute(dict(username=username, path=self.url_path+self.name))
239+
236240 def merge_requests_by_statuses(self, *statuses):
237241 return MergeRequest.query.find(dict(
238242 app_config_id=self.app.config._id,
--- a/Allura/allura/templates/repo/repo_master.html
+++ b/Allura/allura/templates/repo/repo_master.html
@@ -20,6 +20,13 @@
2020 class="selectText"
2121 value="{{repo.readwrite_clone_command()}}"/>
2222 </div>
23+ <p>The repository is also available via HTTPS for those who are unable to use the above methods due to firewall restrictions. HTTPS is slower and requires more bandwidth than any other access method.</p>
24+ <label for="rw_https" class="grid-3">Read / write</label>
25+ <div class="grid-16">
26+ <input id="rw_https" style="width:40em;" readonly type="text"
27+ class="selectText"
28+ value="{{repo.readwrite_https_command()}}"/>
29+ </div>
2330 <br style="clear:both;"/>
2431 {% endif %}
2532 {% endif %}
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -69,10 +69,13 @@ static.url_base = /nf/%(build_key)s/_static_/
6969
7070 scm.host.ro.git = git://git.localhost$path
7171 scm.host.rw.git = ssh://$username@localhost:8022/scm-repo$path
72+scm.host.https.git = https://$username@localhost:8022/scm-repo$path
7273 scm.host.ro.hg = http://hg.localhost$path
7374 scm.host.rw.hg = ssh://$username@localhost:8022/scm-repo$path
75+scm.host.https.hg = https://$username@localhost:8022/scm-repo$path
7476 scm.host.ro.svn = http://svn.localhost$path
7577 scm.host.rw.svn = svn+ssh://$username@localhost:8022/scm-repo$path
78+scm.host.https.svn = https://$username@localhost:8022/scm-repo$path
7679
7780 gitweb.cgi = /usr/lib/cgi-bin/gitweb.cgi
7881
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -37,6 +37,10 @@ class Repository(M.Repository):
3737 tpl = string.Template(tg.config.get('scm.host.rw.%s' % self.tool))
3838 return tpl.substitute(dict(username=username, path=self.url_path+self.name[:-4]))
3939
40+ def readwrite_https_path(self, username):
41+ tpl = string.Template(tg.config.get('scm.host.https.%s' % self.tool))
42+ return tpl.substitute(dict(username=username, path=self.url_path+self.name[:-4]))
43+
4044 def readonly_clone_command(self):
4145 ro_path = self.readonly_path(c.user.username)
4246 if ro_path:
@@ -48,6 +52,10 @@ class Repository(M.Repository):
4852 rw_path = self.readwrite_path(c.user.username)
4953 return 'git clone %s %s' % (rw_path, c.project.shortname.replace('/','.'))
5054
55+ def readwrite_https_command(self):
56+ rw_https_path = self.readwrite_https_path(c.user.username)
57+ return 'git clone %s %s' % (rw_https_path, c.project.shortname.replace('/','.'))
58+
5159 def merge_command(self, merge_request):
5260 '''Return the command to merge a given commit to a given target branch'''
5361 return 'git checkout %s;\ngit fetch git://%s %s;\ngit merge %s' % (
--- a/ForgeGit/forgegit/templates/git/index.html
+++ b/ForgeGit/forgegit/templates/git/index.html
@@ -10,24 +10,8 @@
1010
1111 {% block header %}{{c.app.config.options.mount_label}}{% endblock %}
1212
13-{% macro https_instructions(repo) %}
14- {% if repo %}
15- {% if h.has_artifact_access('write')() %}
16- <p>The repository is also available via HTTPS for those who are unable to use the SSH or git methods due to firewall restrictions. HTTP is slower and requires more bandwidth than any other access method.</p>
17- <label for="rw_https" class="grid-3">Read / write</label>
18- <div class="grid-16">
19- <input id="rw_https" style="width:40em;" readonly type="text"
20- class="selectText"
21- value="{{repo.readwrite_clone_command().replace('ssh://','https://')}}"/>
22- </div>
23- <br style="clear:both;"/>
24- {% endif %}
25- {% endif %}
26-{% endmacro %}
27-
2813 {% block content %}
2914 {{ clone_info(c.app.repo) }}
30- {{ https_instructions(c.app.repo) }}
3115 {% if log %}
3216 <h2>Recent Commits{% if branch %} on {{branch}}{% endif %}</h2>
3317 {{c.log_widget.display(value=log, show_paging=False,
--- a/ForgeHg/forgehg/model/hg.py
+++ b/ForgeHg/forgehg/model/hg.py
@@ -45,6 +45,10 @@ class Repository(M.Repository):
4545 rw_path = self.readwrite_path(c.user.username)
4646 return 'hg clone %s %s' % (rw_path, c.project.shortname.replace('/','.'))
4747
48+ def readwrite_https_command(self):
49+ rw_https_path = self.readwrite_https_path(c.user.username)
50+ return 'hg clone %s %s' % (rw_https_path, c.project.shortname.replace('/','.'))
51+
4852 def merge_command(self, merge_request):
4953 '''Return the command to merge a given commit into a given target branch'''
5054 return 'hg checkout %s;\nhg pull -r %s hg://%s; hg merge %s' % (
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -45,6 +45,10 @@ class Repository(M.Repository):
4545 rw_path = self.readwrite_path(c.user.username)
4646 return 'svn checkout %s %s' % (rw_path, c.project.shortname.replace('/','.'))
4747
48+ def readwrite_https_command(self):
49+ rw_https_path = self.readwrite_https_path(c.user.username)
50+ return 'svn checkout %s %s' % (rw_https_path, c.project.shortname.replace('/','.'))
51+
4852 def _log(self, rev, skip, max_count):
4953 ci = self.commit(rev)
5054 if ci is None: return []