changeset 3170:2ab2eed4a70a beta

implemented #725 Pull Request View - Show origin repo URL
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 18 Jan 2013 01:48:07 +0100
parents a649599ad8b7
children 77e8781c5c9c
files rhodecode/model/db.py rhodecode/public/css/style.css rhodecode/templates/pullrequests/pullrequest_show.html
diffstat 3 files changed, 48 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/model/db.py	Fri Jan 18 01:11:28 2013 +0100
+++ b/rhodecode/model/db.py	Fri Jan 18 01:48:07 2013 +0100
@@ -930,6 +930,25 @@
     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 @@
     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")
--- a/rhodecode/public/css/style.css	Fri Jan 18 01:11:28 2013 +0100
+++ b/rhodecode/public/css/style.css	Fri Jan 18 01:48:07 2013 +0100
@@ -2778,7 +2778,9 @@
     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;
--- a/rhodecode/templates/pullrequests/pullrequest_show.html	Fri Jan 18 01:11:28 2013 +0100
+++ b/rhodecode/templates/pullrequests/pullrequest_show.html	Fri Jan 18 01:48:07 2013 +0100
@@ -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>