1. TortoiseHg
  2. TortoiseHg
  3. thg
  4. Issues
Issue #3290 resolved

connectToExistingWorkbench fails on linux

Mads Kiilerich
created an issue

thg behaves as if --newworkbench always has been specified.

(I don't use "workbench" but is ok with 'thg dirname' launching my repo on a different tab. Always using new new windows for each thg invocation would be ok if thg set WM_CLASS and WM_NAME so the WM knew how to group the windows and show their names.)

Comments (3)

  1. Yuya Nishihara

    thg behaves as if --newworkbench always has been specified.

    Try to delete /tmp/TortoiseHgQt-$USER if exists. TortoiseHg lacks handling of dead socket file.

    if thg set WM_CLASS and WM_NAME

    On my environment, xprop says WM_CLASS = "thg", "Thg", and WM_NAME is the same as the window title.

    Xfce 4.10.1, Qt 4.8.5, PyQt 4.10.2, Debian sid (amd64).

  2. Mads Kiilerich reporter

    On 08/05/2013 05:14 PM, Yuya Nishihara wrote:

    Try to delete /tmp/TortoiseHgQt-$USER if exists. TortoiseHg lacks handling of dead socket file.

    Thanks - that did the trick.

    Better handling of the error cases would perhaps have been helpful, such as:

    Better handling of the error cases would perhaps have been helpful, such as:

    --- a/tortoisehg/hgqt/qtapp.py
    +++ b/tortoisehg/hgqt/qtapp.py
    @@ -233,6 +233,14 @@ def connectToExistingWorkbench(root=None
             reply = socket.readAll()
             if data == reply:
                 return True
    +        print 'Unexpected response from other running thg instance'
    +    else:
    +        if socket.error() == socket.ConnectionRefusedError:
    +            print 'Connection to other running thg instance refused'
    +        elif socket.error() != socket.ServerNotFoundError:
    +            print 'Error connecting to other running thg instance:',
    +            print socket.errorString()
    +
         return False
    
    if thg set WM_CLASS and WM_NAME
    

    On my environment, xprop says WM_CLASS = "thg", "Thg", and WM_NAME is the same as the window title.

    A missing piece of information was that GNOME finds the matching .desktop file based on the WM_CLASS name ... and it was named tortoisehg.desktop. Setting WM_CLASS to 'tortoisehg' would let GNOME find the right desktop file ... but it is apparently hard to set WM_CLASS from pyqt apps. Instead I have sent a pull request for renaming of the .desktop file to thg. With that in place the thg windows shows up with helpful naming as expected.

  3. Log in to comment