changeset 4279:5fdad98e5b2e

pull requests: don't crash on empty hg repos without any tip
author Mads Kiilerich <madski@unity3d.com>
date Fri, 18 Jul 2014 18:44:54 +0200
parents 62f43e26af28
children 27f498ee6db0
files kallithea/controllers/pullrequests.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py	Tue Dec 10 19:30:37 2013 +0100
+++ b/kallithea/controllers/pullrequests.py	Fri Jul 18 18:44:54 2014 +0200
@@ -146,7 +146,11 @@
         # prio 4: tip revision
         if not selected:
             if h.is_hg(repo):
-                selected = 'tag:tip:%s' % repo.tags['tip']
+                if 'tip' in repo.tags:
+                    selected = 'tag:tip:%s' % repo.tags['tip']
+                else:
+                    selected = 'tag:null:0'
+                    tags.append((selected, 'null'))
             else:
                 if 'master' in repo.branches:
                     selected = 'branch:master:%s' % repo.branches['master']