changeset 5449:43a4f3b285a6

pull requests: for "PRs" just showing ranges, just show a message instead of Target
author Mads Kiilerich <madski@unity3d.com>
date Wed, 26 Aug 2015 17:28:59 +0200
parents 666e4d4567f8
children 40e362a4ffc7
files kallithea/controllers/pullrequests.py kallithea/templates/pullrequests/pullrequest_show.html
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py	Wed Aug 26 17:28:59 2015 +0200
+++ b/kallithea/controllers/pullrequests.py	Wed Aug 26 17:28:59 2015 +0200
@@ -569,6 +569,13 @@
         revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
         c.jsdata = json.dumps(graph_data(org_scm_instance, revs))
 
+        c.is_range = False
+        if c.a_ref_type == 'rev': # this looks like a free range where target is ancestor
+            cs_a = org_scm_instance.get_changeset(c.a_rev)
+            root_parents = c.cs_ranges[0].parents
+            c.is_range = cs_a in root_parents
+            #c.merge_root = len(root_parents) > 1 # a range starting with a merge might deserve a warning
+
         avail_revs = set()
         avail_show = []
         c.cs_branch_name = c.cs_ref_name
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Wed Aug 26 17:28:59 2015 +0200
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Wed Aug 26 17:28:59 2015 +0200
@@ -120,10 +120,12 @@
               <label>${_('Target')}:</label>
           </div>
           <div class="input">
-              <div>
+            %if c.is_range:
+              ${_("This is just a range of changesets and doesn't have a target or a real merge ancestor.")}
+            %else:
               ${h.link_to_ref(c.pull_request.other_repo.repo_name, c.a_ref_type, c.a_ref_name)}
               ## we don't know other rev - c.a_rev is ancestor and not necessarily on other_name_branch branch
-              </div>
+            %endif
           </div>
         </div>
         <div class="field">