changeset 6047:f6376261296d

pullrequests: better handling of revision range pullrequests with missing revisions - don't crash Trying to display a revision range PR with missing changesets would give a crash. 3f646f7bac39 solved a similar problem but caused another one when it did that c.cs_ranges could be empty.
author domruf <dominikruf@gmail.com>
date Wed, 15 Jun 2016 18:33:27 +0200
parents ed7e0730a973
children 19e619f3cde1
files kallithea/controllers/pullrequests.py
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py	Thu Jul 28 16:28:34 2016 +0200
+++ b/kallithea/controllers/pullrequests.py	Wed Jun 15 18:33:27 2016 +0200
@@ -581,11 +581,16 @@
         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
+        try:
+            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
+        except ChangesetDoesNotExistError: # probably because c.a_rev not found
+            pass
+        except IndexError: # probably because c.cs_ranges is empty, probably because revisions are missing
+            pass
 
         avail_revs = set()
         avail_show = []