bug: 'unknown revision' when opening a pull request

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Mar 3 16:49:45 EST 2015

Hi Mads,

As discussed on IRC, there is currently a bug in the pullrequest
display code that can trigger for pullrequests between different
repositories, when the head of the destination repo branch is not
available in the originating repository.

You already provided some code suggestion (below), which removes the
500 server error, but there is one remaining issue: the block that
shows changesets that can be used to update the pullrequest is not
correct: in my current case it detects that there are at least one
candidate changesets for update, but the 'show' set calculated is
empty. I assume that the revset used to calculate this set needs some
tweaking after having moved to the unionrepo stuff.

Could you have a look at that?

FYI, the code you suggested and which displays the issue is:

diff --git a/kallithea/controllers/pullrequests.py
--- a/kallithea/controllers/pullrequests.py
+++ b/kallithea/controllers/pullrequests.py
@@ -36,6 +36,7 @@ from pylons import request, tmpl_context
 from pylons.controllers.util import redirect
 from pylons.i18n.translation import _

+from kallithea.lib.vcs.utils.hgcompat import unionrepo
 from kallithea.lib.compat import json
 from kallithea.lib.base import BaseRepoController, render
 from kallithea.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator,\
@@ -594,7 +595,13 @@ class PullrequestsController(BaseRepoCon
                 if len(avail_revs) > 1: # more than just revs[0]
                     # also show changesets that not are descendants
but would be merged in
                     targethead =
-                    show = set(org_scm_instance._repo.revs('::%ld &
!::%s & !::%s',
+                    if org_scm_instance.path != other_scm_instance.path:
+                        hgrepo =
+                    else:
+                        hgrepo = org_scm_instance
+                    show = set(hgrepo.revs('::%ld & !::%s & !::%s',

avail_revs, revs[0], targethead))
                     c.update_msg = _('This pull request can be
updated with changes on %s:') % c.cs_branch_name


More information about the kallithea-general mailing list