# HG changeset patch # User domruf # Date 2016-06-15 18:33:27 # Node ID f6376261296d2e742e8f3342f6a818fc37abf291 # Parent ed7e0730a97394e8f2303ac28de5b8538a609010 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. diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -581,11 +581,16 @@ class PullrequestsController(BaseRepoCon 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 = []