bug: 'unknown revision' when opening a pull request
Mads Kiilerich
mads at kiilerich.com
Fri Mar 6 10:05:30 EST 2015
On 03/03/2015 10:49 PM, Thomas De Schampheleire wrote:
> 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?
I don't understand what can go wrong.
avail_revs contains the existing PR head and additional changes based on
that on the same branch in the source repo.
We hide the PR head (I don't see any reason to subtract its ancestors
too - that is a minor bug).
We also hide anything that already is an ancestor of the target branch
in the target repo.
That all seems OK to me.
Can you dig more into which part of it is causing the problem? Are you
sure the missing update candidate not already is in the target?
("candidate" seems like a good term that we perhaps should use instead
of "available" in code and UI.)
/Mads
> FYI, the code you suggested and which displays the issue is:
> https://paste.oxynux.org/468679
>
> diff --git a/kallithea/controllers/pullrequests.py
> b/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 =
> other_scm_instance.get_changeset(c.a_branch_name).raw_id
> - show = set(org_scm_instance._repo.revs('::%ld &
> !::%s & !::%s',
> + if org_scm_instance.path != other_scm_instance.path:
> + hgrepo =
> unionrepo.unionrepository(org_scm_instance.baseui,
> +
> other_scm_instance.path,
> +
> org_scm_instance.path)
> + 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
> else:
>
>
> Thanks,
> Thomas
More information about the kallithea-general
mailing list