Kallithea issues archive

Issue #27: Viewing a pull request for empty origin results in error

Reported by: Stefan Walter
State: resolved
Created on: 2014-09-03 07:52
Updated on: 2015-02-24 16:54

Description

Playing around with our 0.1 installation, I...

  1. ...created a new (HG) repository.
  2. ...created a fork of that (still empty) repository.
  3. ...pushed changes to the fork.
  4. ...created a pull request for the changes.
  5. ...tried to open/view the pull request.

The result was an error page being shown and the following stack trace mailed to me:

Module kallithea.controllers.pullrequests:2 in show
Module kallithea.lib.auth:776 in __wrapper
>>  return func(*fargs, **fkwargs)
Module kallithea.controllers.pullrequests:2 in show
Module kallithea.lib.auth:835 in __wrapper
>>  return func(*fargs, **fkwargs)
Module kallithea.controllers.pullrequests:583 in show
>>  other_branch_name = other_scm_instance.get_changeset(c.a_ref_name).branch # use ref_type ?
Module kallithea.lib.vcs.backends.hg.repository:511 in get_changeset
>>  revision = self._get_revision(revision)
Module kallithea.lib.vcs.backends.hg.repository:434 in _get_revision
>>  raise EmptyRepositoryError("There are no changesets yet")
EmptyRepositoryError: There are no changesets yet

Pull requests for empty repositories certainly don't happen too often. Nevertheless, a more graceful reaction would be nice.

Attachments

Comments

Comment by Mads Kiilerich, on 2014-09-03 16:10

I will fix that if you contribute a test for it ;-)

Comment by domruf, on 2014-09-04 10:37

FWIW I added a test for this to my pullrequest https://bitbucket.org/conservancy/kallithea/pull-request/33 Notice that my PR is based on 8e26c46e9abe where the behavior is a bit different.

And I think since this barely happens you can change the priority for this.

Comment by Stefan Walter, on 2014-09-04 11:51

Thank you for creating the test, Dominik. It would have taken me a while to create one myself.

Comment by Mads Kiilerich, on 2014-09-08 16:09

fixed in ac752047284f

Comment by Christophe Combelles, on 2015-02-24 16:51

I just got the same error but a few lines below.

line 589 on

targethead = other_scm_instance.get_changeset(c.a_branch_name).raw_id

It occurs when : - I create an empty repository - I fork the repository and create a changeset - I create a PR on the empty original repository - I update the fork with at least one more changeset - I visit the PR →

(...)
Module kallithea.controllers.pullrequests:589 in show
>>  targethead = other_scm_instance.get_changeset(c.a_branch_name).raw_id
Module kallithea.lib.vcs.backends.hg.repository:499 in get_changeset
>>  revision = self._get_revision(revision)
Module kallithea.lib.vcs.backends.hg.repository:416 in _get_revision
>>  raise EmptyRepositoryError("There are no changesets yet")
EmptyRepositoryError: There are no changesets yet

Comment by Christophe Combelles, on 2015-02-24 16:54

How do I reopen this issue?

The fix is exactly the same as suggested above :

Replace the line with:

                    try:
                        targethead = other_scm_instance.get_changeset(c.a_branch_name).raw_id
                    except EmptyRepositoryError:
                        targethead = 'null'