--- a/mercurial/HGCommandServer.st Sun Mar 03 20:45:13 2013 +0000
+++ b/mercurial/HGCommandServer.st Sun Mar 03 23:58:51 2013 +0000
@@ -99,19 +99,23 @@
anHGCommand initialize.
blocker := command blocker.
+ anHGCommand repository: repository.
self runcommand: command.
anHGCommand spawn: [
status := OperatingSystem osProcessStatusClass pid:nil status: #exit code: channel_r nextLongNet core:false.
- Tracing ifTrue:[
- Logger log: 'cmdserver: result code reader finished' severity: #trace facility: 'HG'.
- ].
+
channel_e close.
channel_o close.
+ command outputReader isNil ifTrue:[
+ blocker signal
+ ].
+ command errorReader isNil ifTrue:[
+ blocker signal
+ ].
Tracing ifTrue:[
- Logger log: 'cmdserver: result code reader finished' severity: #trace facility: 'HG'.
+ Logger log: 'cmdsrv: command finished' severity: #trace facility: 'HG'.
].
- blocker signal.
] name: 'command server result reader'.
spin := SemaphoreSet with: blocker with: anHGCommand errors readSemaphore.
@@ -127,7 +131,7 @@
^anHGCommand status: status result: anHGCommand result
"Created: / 24-02-2013 / 15:10:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 03-03-2013 / 19:50:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2013 / 23:51:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGCommandServer methodsFor:'initialization'!
@@ -161,14 +165,14 @@
^{
HGCommand hgCommand .
"/ '--debug' . '--verbose'.
- '--repository' . repository pathName .
+ '--cwd' . repository pathName .
'--config' . 'ui.interactive=True' .
'serve' .
'--cmdserver' . 'pipe' .
}
"Created: / 24-02-2013 / 12:02:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 03-03-2013 / 12:21:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2013 / 23:12:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
channelWithId: channelId
@@ -205,7 +209,7 @@
state := #connecting.
Tracing ifTrue:[
- Logger log: 'cmdserver: connecting...' severity: #trace facility: 'HG'.
+ Logger log: 'cmdsrv: connecting...' severity: #trace facility: 'HG'.
].
label := channel_o next: 13.
label = 'capabilities:' ifFalse:[
@@ -219,11 +223,11 @@
encoder := CharacterEncoder encoderFor: (channel_o nextAvailable: 1000).
state := #connected.
Tracing ifTrue:[
- Logger log: 'cmdserver: connected...' severity: #trace facility: 'HG'.
+ Logger log: 'cmdsrv: connected...' severity: #trace facility: 'HG'.
].
"Created: / 24-02-2013 / 12:19:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 03-03-2013 / 12:10:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2013 / 23:25:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
runcommand: anHGCommand
@@ -232,6 +236,9 @@
| args argslen |
args := OrderedCollection streamContents:[:s|
+ anHGCommand workingDirectory notNil ifTrue:[
+ s nextPut: '--cwd'; nextPut: anHGCommand workingDirectory.
+ ].
anHGCommand argumentsGlobalOn:s.
s nextPut:anHGCommand command.
anHGCommand argumentsCommandOn:s.
@@ -241,11 +248,16 @@
output
nextPutLine:'runcommand';
nextPutLongNet: argslen.
+
+ Tracing ifTrue:[
+ Logger log: 'cmdsrv: runcommand: ' , (args asStringWith:Character space) severity: #trace facility: 'HG'.
+ ].
args
do:[:e|output nextPutAll: (encoder encodeString: e)]
separatedBy:[output nextPut: (Character codePoint: 0)].
"Created: / 03-03-2013 / 16:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2013 / 23:46:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
startReaderWriter
@@ -348,12 +360,12 @@
newPgrp:false
inDirectory: Filename currentDirectory pathName.
Tracing ifTrue:[
- Logger log: 'cmdserver: server started' severity: #trace facility: 'HG'.
+ Logger log: 'cmdsrv: server started' severity: #trace facility: 'HG'.
].
pid.
] action:[:stat |
Tracing ifTrue:[
- Logger log: 'cmdserver: server terminated' severity: #trace facility: 'HG'.
+ Logger log: 'cmdsrv: server terminated' severity: #trace facility: 'HG'.
].
].
@@ -372,7 +384,7 @@
self connect.
"Created: / 24-02-2013 / 11:40:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 03-03-2013 / 14:15:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2013 / 23:25:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
stop
@@ -505,11 +517,11 @@
trace: message
HGCommandServer trace ifTrue:[
- Logger log: ('cmserver-ichannel[', id, '] {', Processor activeProcess id printString, '}: ', message) severity: #trace facility: 'HG'.
+ Logger log: ('cmdsrv-ichannel[', id, '] {', Processor activeProcess id printString, '}: ', message) severity: #trace facility: 'HG'.
]
"Created: / 03-03-2013 / 18:06:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 03-03-2013 / 19:34:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 03-03-2013 / 23:19:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGCommandServer::InputChannel methodsFor:'reading'!