aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2013-01-18 01:48:07 +0100
committerMarcin Kuzminski <marcin@python-works.com>2013-01-18 01:48:07 +0100
commitde7d64eeafe3f5642befb6fe1b92880e889cc873 (patch)
treee43c7b8488ff5970d4cf771c3107b700c4a42be8
parentedf6d6401607e7e833276d42dc449430ae9e4dc4 (diff)
implemented #725 Pull Request View - Show origin repo URL
--HG-- branch : beta extra : amend_source : 329e7a6f060147bf11fa406382bfa9d21b678ffd
-rwxr-xr-xrhodecode/model/db.py27
-rw-r--r--rhodecode/public/css/style.css4
-rw-r--r--rhodecode/templates/pullrequests/pullrequest_show.html18
3 files changed, 48 insertions, 1 deletions
diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py
index 11a4e755..f388fa43 100755
--- a/rhodecode/model/db.py
+++ b/rhodecode/model/db.py
@@ -930,6 +930,25 @@ class Repository(Base, BaseModel):
def last_db_change(self):
return self.updated_on
+ def clone_url(self, **override):
+ from pylons import url
+ from urlparse import urlparse
+ import urllib
+ parsed_url = urlparse(url('home', qualified=True))
+ default_clone_uri = '%(scheme)s://%(user)s%(pass)s%(netloc)s%(prefix)s%(path)s'
+ decoded_path = safe_unicode(urllib.unquote(parsed_url.path))
+ args = {
+ 'user': '',
+ 'pass': '',
+ 'scheme': parsed_url.scheme,
+ 'netloc': parsed_url.netloc,
+ 'prefix': decoded_path,
+ 'path': self.repo_name
+ }
+
+ args.update(override)
+ return default_clone_uri % args
+
#==========================================================================
# SCM PROPERTIES
#==========================================================================
@@ -1794,6 +1813,14 @@ class PullRequest(Base, BaseModel):
def revisions(self, val):
self._revisions = ':'.join(val)
+ @property
+ def org_ref_parts(self):
+ return self.org_ref.split(':')
+
+ @property
+ def other_ref_parts(self):
+ return self.other_ref.split(':')
+
author = relationship('User', lazy='joined')
reviewers = relationship('PullRequestReviewers',
cascade="all, delete, delete-orphan")
diff --git a/rhodecode/public/css/style.css b/rhodecode/public/css/style.css
index 51f8c0aa..dc8b7cc7 100644
--- a/rhodecode/public/css/style.css
+++ b/rhodecode/public/css/style.css
@@ -2778,7 +2778,9 @@ h3.files_location {
margin: 0px 2px;
}
-.right .logtags .branchtag,.logtags .branchtag {
+.right .logtags .branchtag,
+.logtags .branchtag,
+.spantag {
padding: 1px 3px 1px 3px;
background-color: #bfbfbf;
font-size: 10px;
diff --git a/rhodecode/templates/pullrequests/pullrequest_show.html b/rhodecode/templates/pullrequests/pullrequest_show.html
index 9e8220b6..049aaf65 100644
--- a/rhodecode/templates/pullrequests/pullrequest_show.html
+++ b/rhodecode/templates/pullrequests/pullrequest_show.html
@@ -51,6 +51,24 @@
%endif
</div>
</div>
+ <div class="field">
+ <div class="label-summary">
+ <label>${_('Origin repository')}:</label>
+ </div>
+ <div class="input">
+ <div>
+ ##%if h.is_hg(c.pull_request.org_repo):
+ ## <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
+ ##%elif h.is_git(c.pull_request.org_repo):
+ ## <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
+ ##%endif
+ <span class="spantag">${c.pull_request.org_ref_parts[0]}</span>
+ :
+ <span class="spantag">${c.pull_request.org_ref_parts[1]}</span>
+ <span>${c.pull_request.org_repo.clone_url()}</span>
+ </div>
+ </div>
+ </div>
</div>
</div>
<div style="white-space:pre-wrap;padding:3px 3px 5px 20px">${h.literal(c.pull_request.description)}</div>