Delete repo-group

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Sep 21 08:43:34 UTC 2021


Hi André,

The linked PR actually contain 4 commits. Three are related to tests
only, the functional change is in
https://kallithea-scm.org/repos/kallithea-incoming/changeset/deceea91b545410f973fbbd1e4571760ec633ad1
. Did you include this change?
The commit is supposed to be complete, it worked on my end. See its
commit msg for detail, the problem was that the parent group was
obtained via 'gr', which was already deleted. The fix is to obtain a
reference to the parent group, before deleting the child group. The
access that was failing
(https://kallithea-scm.org/repos/kallithea-incoming/changeset/deceea91b545410f973fbbd1e4571760ec633ad1#kallitheacontrollersadminrepo_groupspy_o271)
is now replaced to use the new variable.

Could you double-check that the code after patching is correct?
Are you sure that the code you are running is effectively the one you
patched? (E.g. add a print statement or similar in a place that will
definitely be executed).
In order for code changes to take effect, you must have 'installed'
kallithea via 'pip install -e .' (-e for 'editable'). See also
https://kallithea.readthedocs.io/en/default/contributing.html .

Best regards,
Thomas

El mar, 21 sept 2021 a las 10:00, A. Klitzing (<aklitzing at gmail.com>) escribió:
>
> Hi Thomas,
>
> thanks for your patch.
> I tried it here on my 0.5.2 installation first. I still have the
> problem. I don't see that "gr" will be replaced in that function. Is
> this patch complete?
>
> Best regards
>    André
>
> Am Mi., 1. Sept. 2021 um 23:11 Uhr schrieb Thomas De Schampheleire
> <patrickdepinguin at gmail.com>:
> >
> > Hi André,
> >
> > Sorry for the long delay.
> >
> > I reproduced the repository group deletion issue you reported.
> > Following PR fixes it:
> > https://kallithea-scm.org/repos/kallithea/pull-request/322/_/Fix_deletion_of_sub_repository_groups
> >
> > I have yet to look at the KALLITHEA_EXTRAS issue.
> >
> > Best regards,
> > Thomas
> >
> > El jue, 5 ago 2021 a las 15:08, A. Klitzing (<aklitzing at gmail.com>) escribió:
> > >
> > > Hi Thomas
> > >
> > > I'm using uwsgi but tried gearbox now. I have the same problem.
> > > I noticed that a root repo group is not the problem but a sub group
> > > has that error.
> > >
> > > # Create a root repo group
> > > # Go to that root repo group and create another sub group
> > > # Delete that sub group
> > > # Crash
> > >
> > > Yes, I used the upgrade path. By the way it looks like my old 0.5.3
> > > version has sometimes the same problem with repo sub groups.
> > >
> > >
> > > KALLITHEA_EXTRAS:
> > > Yes, it is a Mercurial repository. If I try it with gearbox I don't
> > > see that error. I just click "add repository" and add a http-URL as
> > > remote repository.
> > >
> > > Best regards
> > >    André
> > >
> > >
> > > Am Mi., 28. Juli 2021 um 21:36 Uhr schrieb Thomas De Schampheleire
> > > <patrickdepinguin at gmail.com>:
> > > >
> > > > Hi André,
> > > >
> > > > I tried the procedure you outlined and don't see any error:
> > > >
> > > > - From the main Kallithea page, click button 'Add Repository Group',
> > > > name group 'empty'
> > > > - From the resulting page of the repository group, click 'Edit
> > > > Repository Group Settings'
> > > > - From that page, click 'Remove this group'
> > > >
> > > > The group is removed correctly.
> > > > I have tested this with Kallithea 0.7.0 and gearbox.
> > > > Are you using gearbox too? If not, can you test it in that way to
> > > > verify whether the issue may be in the web server?
> > > >
> > > > Have you following the complete upgrade procedure outlined at
> > > > https://kallithea.readthedocs.io/en/default/upgrade.html ?
> > > >
> > > >
> > > > Regarding the KALLITHEA_EXTRAS error:
> > > > - is this a Mercurial repository?
> > > > - exactly how do you create/push this repository? Are you cloning a
> > > > repo from local to remote via SSH? If I try it via HTTP it seems not
> > > > supported by Mercurial. And if I create an empty hg repo in Kallithea
> > > > then do a normal push, I don't see this error.
> > > > - in case you are using git, it is important to reinstall the git
> > > > hooks during the upgrade process.
> > > >
> > > > Best regards,
> > > > Thomas
> > > >
> > > >
> > > > El vie, 23 jul 2021 a las 0:13, A. Klitzing (<aklitzing at gmail.com>) escribió:
> > > > >
> > > > > Hi there,
> > > > >
> > > > > I tested to upgrade from 0.5.2 to 0.7.0 here. If I want to delete a
> > > > > review group I get an error 500.
> > > > >
> > > > > 1. Create an empty repository group
> > > > > 2. Go to settings, delete repository group
> > > > > 3. Error 500
> > > > >
> > > > >
> > > > > sqlalchemy.orm.exc.DetachedInstanceError
> > > > >
> > > > > sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <RepoGroup
> > > > > at 0x7f2c00b6d610> is not bound to a Session; lazy load operation of
> > > > > attribute 'parent_group' cannot proceed (Background on this error at:
> > > > > http://sqlalche.me/e/13/bhk3)
> > > > >
> > > > > Traceback (most recent call last)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/wsgiapp.py",
> > > > > line 82, in __call__
> > > > >
> > > > > response = self.wrapped_dispatch(controller, environ, context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/appwrappers/errorpage.py",
> > > > > line 64, in __call__
> > > > >
> > > > > resp = self.next_handler(controller, environ, context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/appwrappers/caching.py",
> > > > > line 54, in __call__
> > > > >
> > > > > return self.next_handler(controller, environ, context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/appwrappers/session.py",
> > > > > line 71, in __call__
> > > > >
> > > > > response = self.next_handler(controller, environ, context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/appwrappers/i18n.py",
> > > > > line 71, in __call__
> > > > >
> > > > > return self.next_handler(controller, environ, context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/wsgiapp.py",
> > > > > line 243, in _dispatch
> > > > >
> > > > > return controller(environ, context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/kallithea/controllers/base.py",
> > > > > line 523, in __call__
> > > > >
> > > > > return super(BaseController, self).__call__(environ, context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/controllers/dispatcher.py",
> > > > > line 118, in __call__
> > > > >
> > > > > response = self._perform_call(context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/controllers/dispatcher.py",
> > > > > line 107, in _perform_call
> > > > >
> > > > > r = self._call(action, params, remainder=remainder, context=context)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/controllers/decoratedcontroller.py",
> > > > > line 129, in _call
> > > > >
> > > > > output = controller_caller(context_config, bound_controller_callable,
> > > > > remainder, params)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/controllers/decoration.py",
> > > > > line 21, in _decorated_controller_caller
> > > > >
> > > > > return application_controller_caller(tg_config, controller, remainder, params)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/tg/configurator/components/dispatch.py",
> > > > > line 114, in _call_controller
> > > > >
> > > > > return controller(*remainder, **params)
> > > > >
> > > > > File "<decorator-gen-5>", line 2, in delete
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/kallithea/lib/auth.py",
> > > > > line 572, in __wrapper
> > > > >
> > > > > return func(*fargs, **fkwargs)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/kallithea/controllers/admin/repo_groups.py",
> > > > > line 271, in delete
> > > > >
> > > > > if gr.parent_group:
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py",
> > > > > line 294, in __get__
> > > > >
> > > > > return self.impl.get(instance_state(instance), dict_)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/sqlalchemy/orm/attributes.py",
> > > > > line 730, in get
> > > > >
> > > > > value = self.callable_(state, passive)
> > > > >
> > > > > File "/home/andre/tmp/kallithea/lib/python3.9/site-packages/sqlalchemy/orm/strategies.py",
> > > > > line 717, in _load_for_state
> > > > >
> > > > > raise orm_exc.DetachedInstanceError(
> > > > >
> > > > > sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <RepoGroup
> > > > > at 0x7f2c00b6d610> is not bound to a Session; lazy load operation of
> > > > > attribute 'parent_group' cannot proceed (Background on this error at:
> > > > > http://sqlalche.me/e/13/bhk3)
> > > > >
> > > > > The debugger caught an exception in your WSGI application. You can now
> > > > > look at the traceback which led to the error.
> > > > >
> > > > > To switch between the interactive traceback and the plaintext one, you
> > > > > can click on the "Traceback" headline. From the text traceback you can
> > > > > also create a paste of it. For code execution mouse-over the frame you
> > > > > want to debug and click on the console icon on the right side.
> > > > >
> > > > > You can execute arbitrary Python code in the stack frames and there
> > > > > are some extra helpers available for introspection:
> > > > >
> > > > > dump() shows all variables in the frame
> > > > > dump(obj) dumps all that's known about the object
> > > > > ctx the context of the failed request
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > By the way... I receive this in my log if I create a new repository
> > > > > with a clone:
> > > > >   Fehler: Hook changegroup.kallithea_push_action löste eine Ausnahme
> > > > > aus: Environment variable KALLITHEA_EXTRAS not found
> > > > > But the repository works after that.
> > > > >
> > > > >
> > > > > Best regards
> > > > >    André Klitzing
> > > > > _______________________________________________
> > > > > kallithea-general mailing list
> > > > > kallithea-general at sfconservancy.org
> > > > > https://lists.sfconservancy.org/mailman/listinfo/kallithea-general


More information about the kallithea-general mailing list