changeset 4406:980691743559

pull requests: use name of branch of tip instead of tip - it is a confusing and moving target
author Mads Kiilerich <madski@unity3d.com>
date Thu, 24 Jul 2014 12:41:55 +0200
parents 4fa8656ab14d
children aba28699ec41
files kallithea/controllers/pullrequests.py
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py	Fri Aug 01 20:28:42 2014 +0200
+++ b/kallithea/controllers/pullrequests.py	Thu Jul 24 12:41:55 2014 +0200
@@ -107,11 +107,17 @@
                     peerbranches.add(abranch)
 
         selected = None
+        tiprev = repo.tags.get('tip')
+        tipbranch = None
 
         branches = []
         for abranch, branchrev in repo.branches.iteritems():
             n = 'branch:%s:%s' % (abranch, branchrev)
-            branches.append((n, abranch))
+            desc = abranch
+            if branchrev == tiprev:
+                tipbranch = abranch
+                desc = '%s (tip)' % desc
+            branches.append((n, desc))
             if rev == branchrev:
                 selected = n
             if branch == abranch:
@@ -137,9 +143,11 @@
 
         tags = []
         for tag, tagrev in repo.tags.iteritems():
+            if tag == 'tip':
+                continue
             n = 'tag:%s:%s' % (tag, tagrev)
             tags.append((n, tag))
-            if rev == tagrev and tag != 'tip':  # tip is not a real tag - and its branch is better
+            if rev == tagrev:
                 selected = n
 
         # prio 1: rev was selected as existing entry above
@@ -157,8 +165,8 @@
         # prio 4: tip revision
         if not selected:
             if h.is_hg(repo):
-                if 'tip' in repo.tags:
-                    selected = 'tag:tip:%s' % repo.tags['tip']
+                if tipbranch:
+                    selected = 'branch:%s:%s' % (tipbranch, tiprev)
                 else:
                     selected = 'tag:null:0'
                     tags.append((selected, 'null'))