Clicking on first unapplied MQ patch yields: 'patchctx' object has no attribute 'repo'
Created originally on Bitbucket by muxator
- Import some commits to MQ
- Unapply them
- Left clicking on each of them (except for the first one) works as expected
- Left clicking on the first one (the one immediately on top of the working directory) causes the described exception
Looking at the code, patchctx
has in fact only a _repo
private member, while a repo()
method does not exist.
8cda8ea29135 removed the direct access to that member, replacing with a call to the (sometimes) non existent ctx.repo()
.
Honestly I am not understanding why this works in the other cases.
I'll submit a small PR that fixes this (trivally exposing patchcxt._repo
), but I am not completely convinced by it and would like a review.
** Mercurial version (4.7+15-bd63ada7e1f8+20180823). TortoiseHg version (4.7+11-5a3f7d594f04)
** Command:
** CWD: <basepath>
** Encoding: UTF-8
** Extensions loaded: convert, extdiff, hggit, strip, mq, patchbomb, rebase, shelve, uncommit, show, tortoisehg.util.configitems
** Python version: 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
** System: Linux cuben.lan 4.15.0-33-generic #36-Ubuntu SMP Wed Aug 15 16:00:05 UTC 2018 x86_64
** Qt-5.9.5 PyQt-5.10.1 QScintilla-2.10.2
Traceback (most recent call last):
File "<basepath>/tortoisehg/hgqt/repowidget.py", line 892, in onRevisionSelected
self.revDetailsWidget.onRevisionSelected(rev)
File "<basepath>/tortoisehg/hgqt/revdetails.py", line 300, in onRevisionSelected
self.revpanel.update(repo = self.repo)
File "<basepath>/tortoisehg/hgqt/csinfo.py", line 464, in update
markups = self.get_markup(item)
File "<basepath>/tortoisehg/hgqt/csinfo.py", line 381, in get_markup
return self.info.get_markup(item, self, self.ctx, self.custom, **kargs)
File "<basepath>/tortoisehg/hgqt/csinfo.py", line 330, in get_markup
value = self.get_data(item, *args)
File "<basepath>/tortoisehg/hgqt/csinfo.py", line 264, in get_data
return custom['data'](widget, item, ctx)
File "<basepath>/tortoisehg/hgqt/revpanel.py", line 87, in data_func
tctx = scmutil.revsymbol(ctx.repo(), ts)
AttributeError: 'patchctx' object has no attribute 'repo'