Changeset 84590784e03d…
Parent d6f832a9a051…
by
Changes to one file · Browse files at 84590784e03d Showing diff from parent d6f832a9a051 Diff from another changeset...
@@ -6,8 +6,12 @@ from mercurial import hg, cmdutil, util
from mercurial import repo as _repo
from thgutil import paths, shlib
+
import sys
import time
+import Queue
+import threading
+
import win32serviceutil
import win32service
import win32event
@@ -19,6 +23,7 @@PIPENAME = "\\\\.\\pipe\\TortoiseHgRpcServer-bc0c27107423"
PIPEBUFSIZE = 4096
+
# FIXME: quick workaround traceback caused by missing "closed"
# attribute in win32trace.
from mercurial import ui
@@ -27,6 +32,7 @@ sys.stderr.write(str(a))
ui.ui.write_err = write_err
+
def update_thgstatus(path):
print "update_thgstatus(%s)" % path
root = paths.find_root(path)
@@ -48,6 +54,19 @@ print "updated repo %s" % r
print "update_thgstatus(%s) finished." % path
+
+requests = Queue.Queue(0)
+
+class Updater(threading.Thread):
+ def run(self ):
+ while True:
+ r = requests.get()
+ if r is not None:
+ update_thgstatus(r)
+
+Updater().start()
+
+
class PipeServer:
def __init__(self):
# Create an event which we will use to wait on.
@@ -116,9 +135,10 @@ # or before reading the response.
# Thats OK - just get the next connection
continue
-
+
try:
- update_thgstatus(data)
+ print "queueing request %s" % data
+ requests.put(data)
except SystemExit:
raise SystemExit # interrupted by thread2.terminate()
except:
|
Loading...