Visual diff: ProgrammingError: symbol was not a string, did you mean repo[symbol]?
Created originally on Bitbucket by muxator
After 2c8f85f3a8e7 (visdiff: use scmutil.revsymbol() to resolve --change
) I am no longer able to perform a visual diff by double clicking on the name of a changed file, as in the following picture:
The generated stack trace is the following:
#!python
** Mercurial version (4.7.2+2-3e61146d7b24+20181002). TortoiseHg version (4.7.1+8-2c8f85f3a8e7)
** Command: --nofork
** CWD: [...]
** 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 [...] 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64
** Qt-5.9.5 PyQt-5.10.1 QScintilla-2.10.2
Traceback (most recent call last):
File "[...]/tortoisehg/hgqt/revdetails.py", line 375, in onDoubleClick
self._fileactions.visualDiffFile()
File "[...]/tortoisehg/hgqt/filectxactions.py", line 111, in wrapped
func(self, fds)
File "[...]/tortoisehg/hgqt/filectxactions.py", line 284, in visualDiffFile
self._visualDiffToBase(fds, _lcanonpaths(fds))
File "[...]/tortoisehg/hgqt/filectxactions.py", line 294, in _visualDiffToBase
self._visualDiff(fds, filenames, change=fds[0].rev()) # can 3-way
File "[...]/tortoisehg/hgqt/filectxactions.py", line 303, in _visualDiff
dlg = visdiff.visualdiff(repo.ui, repo, filenames, opts)
File "[...]/tortoisehg/hgqt/visdiff.py", line 216, in visualdiff
ctx2 = scmutil.revsymbol(repo, change)
File "/usr/lib/python2.7/dist-packages/mercurial/scmutil.py", line 502, in revsymbol
raise error.ProgrammingError(msg)
ProgrammingError: symbol (18635 of type <type 'int'>) was not a string, did you mean repo[symbol]?
A fix that worked for me was converting change
(which in that case is an int) to a string:
@@ -213,7 +213,7 @@ def visualdiff(ui, repo, pats, opts):
try:
ctx1b = None
if change:
- ctx2 = scmutil.revsymbol(repo, change)
+ ctx2 = scmutil.revsymbol(repo, str(change))
p = ctx2.parents()
if len(p) > 1:
ctx1a, ctx1b = p
But I am really not sure this is a good solution.