@@ -45,7 +45,7 @@ from kallithea.lib import diffs
from kallithea.lib.exceptions import UserInvalidException
from kallithea.lib.utils import action_logger, jsonify
from kallithea.lib.vcs.utils import safe_str
from kallithea.lib.vcs.exceptions import EmptyRepositoryError
from kallithea.lib.vcs.exceptions import EmptyRepositoryError, ChangesetDoesNotExistError
from kallithea.lib.diffs import LimitedDiffContainer
from kallithea.model.db import PullRequest, ChangesetStatus, ChangesetComment, \
PullRequestReviewers, User
@@ -563,7 +563,11 @@ class PullrequestsController(BaseRepoCon
org_scm_instance = c.cs_repo.scm_instance # property with expensive cache invalidation check!!!
c.cs_repo = c.cs_repo
c.cs_ranges = [org_scm_instance.get_changeset(x) for x in c.pull_request.revisions]
try:
c.cs_ranges = [org_scm_instance.get_changeset(x)
for x in c.pull_request.revisions]
except ChangesetDoesNotExistError:
c.cs_ranges = []
c.cs_ranges_org = None # not stored and not important and moving target - could be calculated ...
revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
c.jsdata = json.dumps(graph_data(org_scm_instance, revs))
@@ -581,6 +585,7 @@ class PullrequestsController(BaseRepoCon
other_scm_instance = c.a_repo.scm_instance
c.update_msg = ""
c.update_msg_other = ""
if org_scm_instance.alias == 'hg' and c.a_ref_name != 'ancestor':
if c.cs_ref_type != 'branch':
c.cs_branch_name = org_scm_instance.get_changeset(c.cs_ref_name).branch # use ref_type ?
@@ -632,7 +637,10 @@ class PullrequestsController(BaseRepoCon
avail_show = sorted(show, reverse=True)
elif org_scm_instance.alias == 'git':
c.cs_repo.scm_instance.get_changeset(c.cs_rev) # check it exists - raise ChangesetDoesNotExistError if not
c.update_msg = _("Git pull requests don't support updates yet.")
c.update_msg = _('Error: revision %s was not found. Please create a new pull request!') % c.cs_rev
c.avail_revs = avail_revs
c.avail_cs = [org_scm_instance.get_changeset(r) for r in avail_show]
@@ -652,10 +660,12 @@ class PullrequestsController(BaseRepoCon
# we swap org/other ref since we run a simple diff on one repo
log.debug('running diff between %s and %s in %s',
c.a_rev, c.cs_rev, org_scm_instance.path)
txtdiff = org_scm_instance.get_diff(rev1=safe_str(c.a_rev), rev2=safe_str(c.cs_rev),
ignore_whitespace=ignore_whitespace,
context=line_context)
txtdiff = _("The diff can't be shown - the PR revisions could not be found.")
diff_processor = diffs.DiffProcessor(txtdiff or '', format='gitdiff',
diff_limit=diff_limit)
_parsed = diff_processor.prepare()
Status change: