Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • thg thg
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 835
    • Issues 835
    • List
    • Boards
    • Service Desk
    • Milestones
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

  • mercurial
  • TortoiseHg
  • thgthg
  • Issues
  • #5252

Closed
Open
Created Oct 08, 2018 by Bitbucket Importer@bitbucket_importerOwner

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:

thg-vdiff-bug.png

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.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking