Commits

Yuya Nishihara committed aad4a35

revset fixes

  • Participants
  • Parent commits f697abf

Comments (0)

Files changed (7)

File revset-fixuni.diff

+# HG changeset patch
+# Parent ba0c6b6504a51356807f82c9f381e41fbff43f32
+diff --git a/tortoisehg/hgqt/run.py b/tortoisehg/hgqt/run.py
+--- a/tortoisehg/hgqt/run.py
++++ b/tortoisehg/hgqt/run.py
+@@ -408,7 +408,7 @@ def _workbench(ui, *pats, **opts):
+                     q.append('file("%s/**")' % pat)
+                 elif os.path.isfile(f):
+                     q.append('file("%s")' % pat)
+-            w.setRevsetFilter(root, ' or '.join(q))
++            w.setRevsetFilter(root, hglib.tounicode(' or '.join(q)))
+     if w.repoTabsWidget.count() <= 0:
+         w.reporegistry.setVisible(True)
+     return w
+revset-fixuni.diff
+wbcon-nodefault.diff
+wbcon-data.diff
+wbcon-revset.diff
+wb-filerevset.diff
+wbcon-filerevset.diff
 shelve-avoidsamepatch.diff
 chunks-getfilelistemp.diff
 shelve-selectionchanged.diff

File wb-filerevset.diff

+# HG changeset patch
+# Parent 1d1ebb53485370af961fe88992ed312966d12023
+diff --git a/tortoisehg/hgqt/run.py b/tortoisehg/hgqt/run.py
+--- a/tortoisehg/hgqt/run.py
++++ b/tortoisehg/hgqt/run.py
+@@ -386,6 +386,16 @@ def _filelog(ui, repoagent, *pats, **opt
+     repo = repoagent.rawRepo()
+     return filedialogs.FileLogDialog(repo, filename)
+ 
++def _formatfilerevset(pats):
++    q = []
++    for f in pats:
++        pat = hglib.canonpaths([f])[0]
++        if os.path.isdir(f):
++            q.append('file("%s/**")' % pat)
++        elif os.path.isfile(f):
++            q.append('file("%s")' % pat)
++    return ' or '.join(q)
++
+ def _workbench(ui, *pats, **opts):
+     root = opts.get('root') or paths.find_root()
+ 
+@@ -401,14 +411,7 @@ def _workbench(ui, *pats, **opts):
+             w.showRepo(root)
+ 
+         if pats:
+-            q = []
+-            for f in pats:
+-                pat = hglib.canonpaths([f])[0]
+-                if os.path.isdir(f):
+-                    q.append('file("%s/**")' % pat)
+-                elif os.path.isfile(f):
+-                    q.append('file("%s")' % pat)
+-            w.setRevsetFilter(root, hglib.tounicode(' or '.join(q)))
++            w.setRevsetFilter(root, hglib.tounicode(_formatfilerevset(pats)))
+     if w.repoTabsWidget.count() <= 0:
+         w.reporegistry.setVisible(True)
+     return w

File wbcon-data.diff

+# HG changeset patch
+# Parent 679819aaf32d38a7ac62e4567d29e971dc9ad98e
+
+diff --git a/tortoisehg/hgqt/qtapp.py b/tortoisehg/hgqt/qtapp.py
+--- a/tortoisehg/hgqt/qtapp.py
++++ b/tortoisehg/hgqt/qtapp.py
+@@ -388,9 +388,10 @@ class QtRunner(QObject):
+         socket = self._server.nextPendingConnection()
+         if socket:
+             socket.waitForReadyRead(10000)
+-            root = str(socket.readAll())
+-            if root and root != '[echo]':
+-                self.showRepoInWorkbench(hglib.tounicode(root))
++            data = str(socket.readAll())
++            if data and data != '[echo]':
++                uroot = hglib.tounicode(data)
++                self.showRepoInWorkbench(uroot)
+ 
+                 # Bring the workbench window to the front
+                 # This assumes that the client process has
+@@ -405,5 +406,5 @@ class QtRunner(QObject):
+                 # Revoke the blanket permission to set the foreground window
+                 allowSetForegroundWindow(os.getpid())
+ 
+-            socket.write(QByteArray(root))
++            socket.write(QByteArray(data))
+             socket.flush()

File wbcon-filerevset.diff

+# HG changeset patch
+# Parent 82a62ee9db333d970c401c32132b007363a8b18e
+
+diff --git a/tortoisehg/hgqt/run.py b/tortoisehg/hgqt/run.py
+--- a/tortoisehg/hgqt/run.py
++++ b/tortoisehg/hgqt/run.py
+@@ -820,7 +820,7 @@ def log(ui, *pats, **opts):
+     if singleworkbenchmode:
+         newworkbench = opts.get('newworkbench')
+         if root and not newworkbench:
+-            if qtapp.connectToExistingWorkbench(root):
++            if qtapp.connectToExistingWorkbench(root, _formatfilerevset(pats)):
+                 # The were able to connect to an existing workbench server, and
+                 # it confirmed that it has opened the selected repo for us
+                 sys.exit(0)

File wbcon-nodefault.diff

+# HG changeset patch
+# Parent 56bbf0c9afed7adb21808145009169a02e696a8c
+
+diff --git a/tortoisehg/hgqt/qtapp.py b/tortoisehg/hgqt/qtapp.py
+--- a/tortoisehg/hgqt/qtapp.py
++++ b/tortoisehg/hgqt/qtapp.py
+@@ -204,7 +204,7 @@ def allowSetForegroundWindow(processid=-
+         except ImportError:
+             pass
+ 
+-def connectToExistingWorkbench(root=None):
++def connectToExistingWorkbench(root):
+     """
+     Connect and send data to an existing workbench server
+ 
+@@ -215,10 +215,7 @@ def connectToExistingWorkbench(root=None
+     also send "echo" to check that the connection works (i.e. that there is a
+     server)
+     """
+-    if root:
+-        data = root
+-    else:
+-        data = '[echo]'
++    data = root
+     servername = QApplication.applicationName() + '-' + util.getuser()
+     socket = QLocalSocket()
+     socket.connectToServer(servername, QIODevice.ReadWrite)

File wbcon-revset.diff

+# HG changeset patch
+# Parent f47db8fa9115400ccbf0e73f1a7596802d330831
+
+diff --git a/tortoisehg/hgqt/qtapp.py b/tortoisehg/hgqt/qtapp.py
+--- a/tortoisehg/hgqt/qtapp.py
++++ b/tortoisehg/hgqt/qtapp.py
+@@ -204,7 +204,7 @@ def allowSetForegroundWindow(processid=-
+         except ImportError:
+             pass
+ 
+-def connectToExistingWorkbench(root):
++def connectToExistingWorkbench(root, revset=None):
+     """
+     Connect and send data to an existing workbench server
+ 
+@@ -215,7 +215,10 @@ def connectToExistingWorkbench(root):
+     also send "echo" to check that the connection works (i.e. that there is a
+     server)
+     """
+-    data = root
++    if revset:
++        data = '\0'.join([root, revset])
++    else:
++        data = root
+     servername = QApplication.applicationName() + '-' + util.getuser()
+     socket = QLocalSocket()
+     socket.connectToServer(servername, QIODevice.ReadWrite)
+@@ -391,14 +394,22 @@ class QtRunner(QObject):
+             socket.waitForReadyRead(10000)
+             data = str(socket.readAll())
+             if data and data != '[echo]':
+-                uroot = hglib.tounicode(data)
++                args = data.split('\0', 1)
++                if len(args) > 1:
++                    uroot, urevset = map(hglib.tounicode, args)
++                else:
++                    uroot = hglib.tounicode(args[0])
++                    urevset = None
+                 self.showRepoInWorkbench(uroot)
+ 
++                wb = self._workbench
++                if urevset:
++                    wb.setRevsetFilter(uroot, urevset)
++
+                 # Bring the workbench window to the front
+                 # This assumes that the client process has
+                 # called allowSetForegroundWindow(-1) right before
+                 # sending the request
+-                wb = self._workbench
+                 wb.setWindowState(wb.windowState() & ~Qt.WindowMinimized
+                                   | Qt.WindowActive)
+                 wb.show()