mercurial/HGCommand.st
changeset 227 3df8f12dcece
parent 216 0a3821d4bdb6
child 228 e00b7d71e234
equal deleted inserted replaced
226:e2f6e7330c37 227:3df8f12dcece
   167 "
   167 "
   168 !
   168 !
   169 
   169 
   170 documentation
   170 documentation
   171 "
   171 "
   172     A wrapper for hg command line tool. Individual commands are wrapped in 
   172     A wrapper for hg command line tool. Individual commands are wrapped in
   173     my private classes. 
   173     my private classes.
   174 
   174 
   175     HGCommand is part of internal implementation and subject to change. 
   175     HGCommand is part of internal implementation and subject to change.
   176     Therefore it should not be used by user code. Use classed and APIs in 
   176     Therefore it should not be used by user code. Use classed and APIs in
   177     SCM-Mercurial-Core instead.
   177     SCM-Mercurial-Core instead.
   178 
   178 
   179     [author:]
   179     [author:]
   180         Jan Vrany <jan.vrany@fit.cvut.cz>
   180         Jan Vrany <jan.vrany@fit.cvut.cz>
   181 
   181 
   210         ^ HGExecutable
   210         ^ HGExecutable
   211     ].
   211     ].
   212     HGExecutable := UserPreferences current hgCommand.
   212     HGExecutable := UserPreferences current hgCommand.
   213     HGExecutable isNil ifTrue:[
   213     HGExecutable isNil ifTrue:[
   214         OperatingSystem isMSWINDOWSlike ifTrue:[
   214         OperatingSystem isMSWINDOWSlike ifTrue:[
   215             "/        h := Win32OperatingSystem registryEntry 
   215             "/        h := Win32OperatingSystem registryEntry
   216             "/                key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\svn.exe'.
   216             "/                key:'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\svn.exe'.
   217             "/        h notNil ifTrue:[HGExecutable := h valueNamed:''].
   217             "/        h notNil ifTrue:[HGExecutable := h valueNamed:''].
   218             "/        HGExecutable notEmptyOrNil ifTrue:[^HGExecutable]
   218             "/        HGExecutable notEmptyOrNil ifTrue:[^HGExecutable]
   219             HGExecutable := OperatingSystem pathOfCommand:'hg'.
   219             HGExecutable := OperatingSystem pathOfCommand:'hg'.
   220         ] ifFalse:[
   220         ] ifFalse:[
   242     "Created: / 19-11-2012 / 21:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   242     "Created: / 19-11-2012 / 21:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   243 !
   243 !
   244 
   244 
   245 hgVersion
   245 hgVersion
   246     "Return mercurial version installed on this compiter"
   246     "Return mercurial version installed on this compiter"
   247     
   247 
   248     HGVersion isNil ifTrue:[
   248     HGVersion isNil ifTrue:[
   249         HGVersion := self hgVersionOf: self hgCommand
   249         HGVersion := self hgVersionOf: self hgCommand
   250     ].
   250     ].
   251     ^ HGVersion
   251     ^ HGVersion
   252 
   252 
   264     "
   264     "
   265      HGCommand mercurialVersionIsSupported"
   265      HGCommand mercurialVersionIsSupported"
   266     "Created: / 19-11-2012 / 20:34:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   266     "Created: / 19-11-2012 / 20:34:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   267 !
   267 !
   268 
   268 
   269 hgVersionIsSupported:version 
   269 hgVersionIsSupported:version
   270     ^ self hgVersionsSupported 
   270     ^ self hgVersionsSupported
   271         anySatisfy:[:vsn | 
   271         anySatisfy:[:vsn |
   272             ((vsn at:1) == #'*' or:[ (vsn at:1) == (version at:1) ]) 
   272             ((vsn at:1) == #'*' or:[ (vsn at:1) == (version at:1) ])
   273                 and:[
   273                 and:[
   274                     ((vsn at:2) == #'*' or:[ (vsn at:2) == (version at:2) ]) 
   274                     ((vsn at:2) == #'*' or:[ (vsn at:2) == (version at:2) ])
   275                         and:[ ((vsn at:3) == #'*' or:[ (vsn at:1) == (version at:3) ]) ]
   275                         and:[ ((vsn at:3) == #'*' or:[ (vsn at:1) == (version at:3) ]) ]
   276                 ]
   276                 ]
   277         ].
   277         ].
   278 
   278 
   279     "
   279     "
   286 !
   286 !
   287 
   287 
   288 hgVersionOf: hgcommand
   288 hgVersionOf: hgcommand
   289     "Return mercurial version installed on this compiter"
   289     "Return mercurial version installed on this compiter"
   290 
   290 
   291     ^version new 
   291     ^version new
   292         executable: hgcommand;
   292         executable: hgcommand;
   293         execute
   293         execute
   294 
   294 
   295     "
   295     "
   296      HGCommand hgVersion
   296      HGCommand hgVersion
   300 !
   300 !
   301 
   301 
   302 hgVersionsSupported
   302 hgVersionsSupported
   303     "Return a list of mercurial version supported bu this
   303     "Return a list of mercurial version supported bu this
   304      implementation"
   304      implementation"
   305     
   305 
   306     ^ #( #(1 9 #'*')
   306     ^ #( #(1 9 #'*')
   307      #(2 #'*' #'*') )
   307      #(2 #'*' #'*') )
   308 
   308 
   309     "Created: / 19-11-2012 / 20:26:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   309     "Created: / 19-11-2012 / 20:26:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   310 !
   310 !
   466 
   466 
   467 workingDirectory:aStringOrFilename
   467 workingDirectory:aStringOrFilename
   468     aStringOrFilename asFilename isDirectory ifFalse:[
   468     aStringOrFilename asFilename isDirectory ifFalse:[
   469         self error:'Working directory does not exist'.
   469         self error:'Working directory does not exist'.
   470         ^self.
   470         ^self.
   471     ].    
   471     ].
   472     workingDirectory := aStringOrFilename asString.
   472     workingDirectory := aStringOrFilename asString.
   473 
   473 
   474     "Modified: / 01-10-2012 / 14:38:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   474     "Modified: / 01-10-2012 / 14:38:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   475 ! !
   475 ! !
   476 
   476 
   517     stdout := stdoutPipe first.
   517     stdout := stdoutPipe first.
   518 
   518 
   519     stderrPipe := NonPositionableExternalStream makePipe.
   519     stderrPipe := NonPositionableExternalStream makePipe.
   520     stderr := stderrPipe first.
   520     stderr := stderrPipe first.
   521 
   521 
   522     environment := OperatingSystem isUNIXlike 
   522     environment := OperatingSystem isUNIXlike
   523                     ifTrue:[OperatingSystem getEnvironment copy]
   523                     ifTrue:[OperatingSystem getEnvironment copy]
   524                     ifFalse:[environment := Dictionary new].
   524                     ifFalse:[environment := Dictionary new].
   525     environment at: 'HGEDITOR' put: 'true'.
   525     environment at: 'HGEDITOR' put: 'true'.
   526 
   526 
   527     environment at:'LANG' put:'C'.
   527     environment at:'LANG' put:'C'.
   528 
   528 
   529     args := self arguments.
   529     args := self arguments.
   530     OperatingSystem isMSWINDOWSlike ifTrue:[
   530     OperatingSystem isMSWINDOWSlike ifTrue:[
   531         args := String streamContents:[:s|
   531         args := String streamContents:[:s|
   532             args 
   532             args
   533                 do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"]
   533                 do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"]
   534                 separatedBy: [ s space ]
   534                 separatedBy: [ s space ]
   535         ]
   535         ]
   536     ].
   536     ].
   537 
   537 
   538     blocker := (Semaphore new:-2) name: 'Waiting for hg command to finish'.
   538     blocker := (Semaphore new:-2) name: 'Waiting for hg command to finish'.
   539     Processor monitor:[
   539     Processor monitor:[
   540         Tracing ifTrue:[
   540         Tracing ifTrue:[
   541             Logger log: 'cmd: executing: ' , (args asStringWith:' ') severity: #trace facility: 'HG'.
   541             Logger log: 'cmd: executing: ' , (args isString ifTrue:[args] ifFalse:[args asStringWith:' ']) severity: #trace facility: 'HG'.
   542         ].
   542         ].
   543         pid := OperatingSystem exec:(self executable) withArguments:args
   543         pid := OperatingSystem exec:(self executable) withArguments:args
   544             environment:environment
   544             environment:environment
   545             fileDescriptors:{0 . stdoutPipe second fileDescriptor . stderrPipe second fileDescriptor}
   545             fileDescriptors:{0 . stdoutPipe second fileDescriptor . stderrPipe second fileDescriptor}
   546             fork:true 
   546             fork:true
   547             newPgrp:false 
   547             newPgrp:false
   548             inDirectory:self workingDirectory
   548             inDirectory:self workingDirectory
   549     ] action:[:stat |
   549     ] action:[:stat |
   550         Tracing ifTrue:[
   550         Tracing ifTrue:[
   551             Logger log: 'cmd: command finished' severity: #trace facility: 'HG'.
   551             Logger log: 'cmd: command finished' severity: #trace facility: 'HG'.
   552         ].
   552         ].
   553         status := stat.
   553         status := stat.
   554         blocker signal.
   554         blocker signal.
   555     ].
   555     ].
   556     
   556 
   557 
   557 
   558     stdoutPipe second close.
   558     stdoutPipe second close.
   559     stderrPipe second close.
   559     stderrPipe second close.
   560     pid isNil ifTrue:[
   560     pid isNil ifTrue:[
   561         HGCommandError raiseErrorString: 'cannot execute hg command'.
   561         HGCommandError raiseErrorString: 'cannot execute hg command'.
   578         stdout close.
   578         stdout close.
   579     ].
   579     ].
   580     self signal.
   580     self signal.
   581     Tracing ifTrue:[
   581     Tracing ifTrue:[
   582         Logger log: 'returning' severity: #trace facility: 'HG'.
   582         Logger log: 'returning' severity: #trace facility: 'HG'.
   583     ]. 
   583     ].
   584     ^self status: status result: result
   584     ^self status: status result: result
   585 
   585 
   586     "
   586     "
   587         SVNv2::Command info: 'https://swing.fit.cvut.cz/svn/stx/libsvn'
   587         SVNv2::Command info: 'https://swing.fit.cvut.cz/svn/stx/libsvn'
   588     "
   588     "
   649     ^ self class hgCommand
   649     ^ self class hgCommand
   650 
   650 
   651     "Modified: / 19-11-2012 / 21:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   651     "Modified: / 19-11-2012 / 21:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   652 !
   652 !
   653 
   653 
   654 parseError:stream 
   654 parseError:stream
   655     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
   655     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
   656      etc."
   656      etc."
   657     
   657 
   658     ^ (self parserOn: stream) parseError.
   658     ^ (self parserOn: stream) parseError.
   659 
   659 
   660     "Created: / 04-02-2013 / 11:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   660     "Created: / 04-02-2013 / 11:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   661 !
   661 !
   662 
   662 
   663 parseOutput:stream 
   663 parseOutput:stream
   664     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
   664     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
   665      etc."
   665      etc."
   666     
   666 
   667     ^ self subclassResponsibility
   667     ^ self subclassResponsibility
   668 
   668 
   669     "Created: / 11-05-2011 / 07:58:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   669     "Created: / 11-05-2011 / 07:58:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   670     "Created: / 17-12-2011 / 17:02:41 / dundee"
   670     "Created: / 17-12-2011 / 17:02:41 / dundee"
   671     "Modified (comment): / 17-10-2012 / 13:14:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   671     "Modified (comment): / 17-10-2012 / 13:14:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   689     workers add: worker.
   689     workers add: worker.
   690     worker addExitAction:[
   690     worker addExitAction:[
   691         Tracing ifTrue:[
   691         Tracing ifTrue:[
   692             Logger log: 'command parser finished' severity: #trace facility: 'HG'.
   692             Logger log: 'command parser finished' severity: #trace facility: 'HG'.
   693         ].
   693         ].
   694         blocker signal. 
   694         blocker signal.
   695         workers remove: worker
   695         workers remove: worker
   696     ].
   696     ].
   697     worker resume.
   697     worker resume.
   698 
   698 
   699     "Created: / 04-02-2013 / 11:55:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   699     "Created: / 04-02-2013 / 11:55:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   733     stream nextPutAll: paths
   733     stream nextPutAll: paths
   734 
   734 
   735     "Created: / 15-11-2012 / 00:05:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   735     "Created: / 15-11-2012 / 00:05:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   736 !
   736 !
   737 
   737 
   738 parseOutput:stream 
   738 parseOutput:stream
   739     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
   739     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
   740      etc."
   740      etc."
   741     
   741 
   742     ^ nil
   742     ^ nil
   743 
   743 
   744     "Modified: / 15-11-2012 / 00:38:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   744     "Modified: / 15-11-2012 / 00:38:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   745 ! !
   745 ! !
   746 
   746 
   782     stream nextPut:'--debug' "/to get full node ids
   782     stream nextPut:'--debug' "/to get full node ids
   783 
   783 
   784     "Created: / 27-11-2012 / 19:54:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   784     "Created: / 27-11-2012 / 19:54:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   785 !
   785 !
   786 
   786 
   787 parseOutput:stream 
   787 parseOutput:stream
   788     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
   788     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
   789      etc."
   789      etc."
   790     
   790 
   791     ^ (self parserOn:stream) parseCommandBranches
   791     ^ (self parserOn:stream) parseCommandBranches
   792 
   792 
   793     "Created: / 27-11-2012 / 19:55:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   793     "Created: / 27-11-2012 / 19:55:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   794 ! !
   794 ! !
   795 
   795 
   823 
   823 
   824 execute
   824 execute
   825     "
   825     "
   826     A hacked version of #execute that returns a open read
   826     A hacked version of #execute that returns a open read
   827     stream to read directly from 'hg cat' stdout...
   827     stream to read directly from 'hg cat' stdout...
   828     
   828 
   829     "
   829     "
   830 
   830 
   831     | pipe output pid environment sema args sout exec |
   831     | pipe output pid environment sema args sout exec |
   832 
   832 
   833     pipe := NonPositionableExternalStream makePipe.
   833     pipe := NonPositionableExternalStream makePipe.
   841     environment at:'LANG' put:'C'.
   841     environment at:'LANG' put:'C'.
   842 
   842 
   843     args := self arguments.
   843     args := self arguments.
   844     OperatingSystem isMSWINDOWSlike ifTrue:[
   844     OperatingSystem isMSWINDOWSlike ifTrue:[
   845         args := String streamContents:[:s|
   845         args := String streamContents:[:s|
   846             args 
   846             args
   847                 do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"]
   847                 do:[:each | s nextPut:$"; nextPutAll: each; nextPut: $"]
   848                 separatedBy: [ s space ]
   848                 separatedBy: [ s space ]
   849         ]
   849         ]
   850     ].
   850     ].
   851 
   851 
   852     sout := destination notNil 
   852     sout := destination notNil
   853                 ifTrue:[destination asFilename writeStream]
   853                 ifTrue:[destination asFilename writeStream]
   854                 ifFalse:[pipe second].
   854                 ifFalse:[pipe second].
   855     sema := Semaphore new name: 'Waiting for hg command to finish'.
   855     sema := Semaphore new name: 'Waiting for hg command to finish'.
   856     exec := [
   856     exec := [
   857         pid := OperatingSystem exec:(self executable) withArguments:args
   857         pid := OperatingSystem exec:(self executable) withArguments:args
   858                 environment:environment
   858                 environment:environment
   859                 fileDescriptors:{0 . sout fileDescriptor . pipe second fileDescriptor}
   859                 fileDescriptors:{0 . sout fileDescriptor . pipe second fileDescriptor}
   860                 fork:true 
   860                 fork:true
   861                 newPgrp:false 
   861                 newPgrp:false
   862                 inDirectory:self workingDirectory.
   862                 inDirectory:self workingDirectory.
   863     ].
   863     ].
   864 
   864 
   865     destination notNil ifTrue:[
   865     destination notNil ifTrue:[
   866         Processor 
   866         Processor
   867             monitor:exec
   867             monitor:exec
   868             action:[:stat |
   868             action:[:stat |
   869                 sema signal.
   869                 sema signal.
   870             ].
   870             ].
   871     ] ifFalse:[
   871     ] ifFalse:[
   878     pid isNil ifTrue:[
   878     pid isNil ifTrue:[
   879         HGCommandError raiseErrorString: 'cannot execute hg command'.
   879         HGCommandError raiseErrorString: 'cannot execute hg command'.
   880         output close.
   880         output close.
   881         ^ self.
   881         ^ self.
   882     ].
   882     ].
   883     ^destination notNil 
   883     ^destination notNil
   884         ifTrue:[sema wait. nil]
   884         ifTrue:[sema wait. nil]
   885         ifFalse:[output].
   885         ifFalse:[output].
   886 
   886 
   887     "Created: / 17-11-2012 / 00:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   887     "Created: / 17-11-2012 / 00:13:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   888     "Modified: / 04-12-2012 / 10:10:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   888     "Modified: / 04-12-2012 / 10:10:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   903     stream nextPut:path
   903     stream nextPut:path
   904 
   904 
   905     "Modified: / 17-11-2012 / 00:09:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   905     "Modified: / 17-11-2012 / 00:09:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   906 !
   906 !
   907 
   907 
   908 parseOutput:stream 
   908 parseOutput:stream
   909     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
   909     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
   910      etc."
   910      etc."
   911     
   911 
   912     ^ self shouldImplement
   912     ^ self shouldImplement
   913 ! !
   913 ! !
   914 
   914 
   915 !HGCommand::clone methodsFor:'accessing'!
   915 !HGCommand::clone methodsFor:'accessing'!
   916 
   916 
   941 
   941 
   942     "Created: / 01-10-2012 / 00:04:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   942     "Created: / 01-10-2012 / 00:04:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   943     "Modified: / 21-11-2012 / 00:17:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   943     "Modified: / 21-11-2012 / 00:17:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   944 !
   944 !
   945 
   945 
   946 parseOutput:stream 
   946 parseOutput:stream
   947     "superclass Command says that I am responsible to implement this method"
   947     "superclass Command says that I am responsible to implement this method"
   948     
   948 
   949     ^ nil
   949     ^ nil
   950 
   950 
   951     "Modified: / 14-11-2012 / 22:42:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   951     "Modified: / 14-11-2012 / 22:42:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   952 ! !
   952 ! !
   953 
   953 
  1010     "Created: / 12-11-2012 / 22:38:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1010     "Created: / 12-11-2012 / 22:38:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1011     "Modified: / 07-12-2012 / 15:32:51 / jv"
  1011     "Modified: / 07-12-2012 / 15:32:51 / jv"
  1012     "Modified: / 01-02-2013 / 14:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1012     "Modified: / 01-02-2013 / 14:49:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1013 !
  1013 !
  1014 
  1014 
  1015 parseError:stream 
  1015 parseError:stream
  1016     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1016     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1017      etc."
  1017      etc."
  1018     
  1018 
  1019     ^ (self parserOn: stream) parseErrorCommit.
  1019     ^ (self parserOn: stream) parseErrorCommit.
  1020 
  1020 
  1021     "Created: / 04-02-2013 / 12:28:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1021     "Created: / 04-02-2013 / 12:28:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1022 !
  1022 !
  1023 
  1023 
  1024 parseOutput:stream 
  1024 parseOutput:stream
  1025     "superclass HGCommand says that I am responsible to implement this method"
  1025     "superclass HGCommand says that I am responsible to implement this method"
  1026     "Nothing to do"
  1026     "Nothing to do"
  1027     "Modified: / 12-11-2012 / 22:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1027     "Modified: / 12-11-2012 / 22:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1028 !
  1028 !
  1029 
  1029 
  1041 !HGCommand::heads methodsFor:'private'!
  1041 !HGCommand::heads methodsFor:'private'!
  1042 
  1042 
  1043 argumentsCommandOn:stream
  1043 argumentsCommandOn:stream
  1044     "Called to get command specific options"
  1044     "Called to get command specific options"
  1045 
  1045 
  1046     stream 
  1046     stream
  1047         nextPut:'--template';
  1047         nextPut:'--template';
  1048         nextPut:HGCommandParser templateHeads.
  1048         nextPut:HGCommandParser templateHeads.
  1049 
  1049 
  1050     "Created: / 27-11-2012 / 21:30:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1050     "Created: / 27-11-2012 / 21:30:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1051 !
  1051 !
  1052 
  1052 
  1053 parseOutput:stream 
  1053 parseOutput:stream
  1054     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1054     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1055      etc."
  1055      etc."
  1056     
  1056 
  1057     ^ (self parserOn:stream) parseCommandHeads
  1057     ^ (self parserOn:stream) parseCommandHeads
  1058 
  1058 
  1059     "Created: / 27-11-2012 / 21:30:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1059     "Created: / 27-11-2012 / 21:30:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1060 ! !
  1060 ! !
  1061 
  1061 
  1080     ].
  1080     ].
  1081 
  1081 
  1082     "Modified: / 16-12-2012 / 00:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1082     "Modified: / 16-12-2012 / 00:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1083 !
  1083 !
  1084 
  1084 
  1085 parseOutput:stream 
  1085 parseOutput:stream
  1086     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1086     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1087      etc."
  1087      etc."
  1088     
  1088 
  1089     ^ (self parserOn:stream) parseCommandLocate
  1089     ^ (self parserOn:stream) parseCommandLocate
  1090 
  1090 
  1091     "Modified: / 16-11-2012 / 22:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1091     "Modified: / 16-11-2012 / 22:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1092 ! !
  1092 ! !
  1093 
  1093 
  1149 
  1149 
  1150     childrenOnly == true ifTrue:[
  1150     childrenOnly == true ifTrue:[
  1151         template := HGCommandParser templateLogChildren.
  1151         template := HGCommandParser templateLogChildren.
  1152     ].
  1152     ].
  1153 
  1153 
  1154     stream 
  1154     stream
  1155         nextPut:'--debug';
  1155         nextPut:'--debug';
  1156         nextPut:'--template';
  1156         nextPut:'--template';
  1157         nextPut:template.
  1157         nextPut:template.
  1158 
  1158 
  1159     path notNil ifTrue:[
  1159     path notNil ifTrue:[
  1162 
  1162 
  1163     "Created: / 13-11-2012 / 09:05:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1163     "Created: / 13-11-2012 / 09:05:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1164     "Modified: / 22-01-2013 / 16:16:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1164     "Modified: / 22-01-2013 / 16:16:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1165 !
  1165 !
  1166 
  1166 
  1167 parseOutput:stream 
  1167 parseOutput:stream
  1168     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1168     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1169      etc."
  1169      etc."
  1170     
  1170 
  1171     childrenOnly == true ifTrue:[
  1171     childrenOnly == true ifTrue:[
  1172         ^ (self parserOn:stream) parseCommandLogChildren.
  1172         ^ (self parserOn:stream) parseCommandLogChildren.
  1173     ].
  1173     ].
  1174     ^ path isNil 
  1174     ^ path isNil
  1175         ifTrue:[ (self parserOn:stream) parseCommandLog ]
  1175         ifTrue:[ (self parserOn:stream) parseCommandLog ]
  1176         ifFalse:[ (self parserOn:stream) parseCommandLogFile ]
  1176         ifFalse:[ (self parserOn:stream) parseCommandLogFile ]
  1177 
  1177 
  1178     "Created: / 13-11-2012 / 09:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1178     "Created: / 13-11-2012 / 09:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1179     "Modified: / 05-12-2012 / 23:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1179     "Modified: / 05-12-2012 / 23:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1211     ].
  1211     ].
  1212 
  1212 
  1213     "Modified: / 14-01-2013 / 15:40:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1213     "Modified: / 14-01-2013 / 15:40:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1214 !
  1214 !
  1215 
  1215 
  1216 parseOutput:stream 
  1216 parseOutput:stream
  1217     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1217     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1218      etc."
  1218      etc."
  1219     
  1219 
  1220     ^ (self parserOn:stream) parseCommandMerge
  1220     ^ (self parserOn:stream) parseCommandMerge
  1221 
  1221 
  1222     "Modified: / 14-01-2013 / 16:00:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1222     "Modified: / 14-01-2013 / 16:00:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1223 !
  1223 !
  1224 
  1224 
  1268     stream nextPut: source asString; nextPut: destination.
  1268     stream nextPut: source asString; nextPut: destination.
  1269 
  1269 
  1270     "Created: / 15-11-2012 / 00:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1270     "Created: / 15-11-2012 / 00:21:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1271 !
  1271 !
  1272 
  1272 
  1273 parseOutput:stream 
  1273 parseOutput:stream
  1274     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1274     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1275      etc."
  1275      etc."
  1276     
  1276 
  1277     ^ nil
  1277     ^ nil
  1278 
  1278 
  1279     "Modified: / 15-11-2012 / 00:38:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1279     "Modified: / 15-11-2012 / 00:38:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1280 ! !
  1280 ! !
  1281 
  1281 
  1300 
  1300 
  1301     "Created: / 30-09-2012 / 23:44:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1301     "Created: / 30-09-2012 / 23:44:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1302     "Modified: / 15-11-2012 / 09:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1302     "Modified: / 15-11-2012 / 09:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1303 !
  1303 !
  1304 
  1304 
  1305 parseOutput:stream 
  1305 parseOutput:stream
  1306     "superclass HGCommand says that I am responsible to implement this method"
  1306     "superclass HGCommand says that I am responsible to implement this method"
  1307     
  1307 
  1308     ^ (self parserOn:stream) parseCommandPull
  1308     ^ (self parserOn:stream) parseCommandPull
  1309 
  1309 
  1310     "Modified: / 04-02-2013 / 15:35:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1310     "Modified: / 04-02-2013 / 15:35:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1311 ! !
  1311 ! !
  1312 
  1312 
  1342 
  1342 
  1343     "Created: / 30-09-2012 / 23:44:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1343     "Created: / 30-09-2012 / 23:44:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1344     "Modified: / 29-01-2013 / 15:42:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1344     "Modified: / 29-01-2013 / 15:42:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1345 !
  1345 !
  1346 
  1346 
  1347 parseError:stream 
  1347 parseError:stream
  1348     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1348     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1349      etc."
  1349      etc."
  1350     
  1350 
  1351     ^ (self parserOn: stream) parseErrorPush.
  1351     ^ (self parserOn: stream) parseErrorPush.
  1352 
  1352 
  1353     "Created: / 04-02-2013 / 12:53:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1353     "Created: / 04-02-2013 / 12:53:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1354 !
  1354 !
  1355 
  1355 
  1356 parseOutput:stream 
  1356 parseOutput:stream
  1357     "superclass HGCommand says that I am responsible to implement this method"
  1357     "superclass HGCommand says that I am responsible to implement this method"
  1358     
  1358 
  1359     ^ (self parserOn:stream) parseCommandPush
  1359     ^ (self parserOn:stream) parseCommandPush
  1360 
  1360 
  1361     "Modified: / 10-12-2012 / 02:15:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1361     "Modified: / 10-12-2012 / 02:15:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1362 !
  1362 !
  1363 
  1363 
  1393     stream nextPutAll: paths
  1393     stream nextPutAll: paths
  1394 
  1394 
  1395     "Created: / 15-11-2012 / 00:05:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1395     "Created: / 15-11-2012 / 00:05:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1396 !
  1396 !
  1397 
  1397 
  1398 parseOutput:stream 
  1398 parseOutput:stream
  1399     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1399     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1400      etc."
  1400      etc."
  1401     
  1401 
  1402     ^ nil
  1402     ^ nil
  1403 
  1403 
  1404     "Modified: / 15-11-2012 / 00:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1404     "Modified: / 15-11-2012 / 00:38:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1405 ! !
  1405 ! !
  1406 
  1406 
  1470     files do:[:f|stream nextPut: f].
  1470     files do:[:f|stream nextPut: f].
  1471 
  1471 
  1472     "Modified: / 14-01-2013 / 19:29:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1472     "Modified: / 14-01-2013 / 19:29:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1473 !
  1473 !
  1474 
  1474 
  1475 parseOutput:stream 
  1475 parseOutput:stream
  1476     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1476     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1477      etc."
  1477      etc."
  1478     
  1478 
  1479     ^ nil
  1479     ^ nil
  1480 
  1480 
  1481     "Modified: / 14-01-2013 / 19:27:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1481     "Modified: / 14-01-2013 / 19:27:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1482 !
  1482 !
  1483 
  1483 
  1507     ^'resolve'
  1507     ^'resolve'
  1508 
  1508 
  1509     "Created: / 14-01-2013 / 16:50:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1509     "Created: / 14-01-2013 / 16:50:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1510 !
  1510 !
  1511 
  1511 
  1512 parseOutput:stream 
  1512 parseOutput:stream
  1513     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1513     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1514      etc."
  1514      etc."
  1515     
  1515 
  1516     ^ (self parserOn:stream) parseCommandResolveList
  1516     ^ (self parserOn:stream) parseCommandResolveList
  1517 
  1517 
  1518     "Modified: / 14-01-2013 / 16:43:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1518     "Modified: / 14-01-2013 / 16:43:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1519 ! !
  1519 ! !
  1520 
  1520 
  1528     ].
  1528     ].
  1529 
  1529 
  1530     "Created: / 06-12-2012 / 15:53:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1530     "Created: / 06-12-2012 / 15:53:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1531 !
  1531 !
  1532 
  1532 
  1533 parseOutput:stream 
  1533 parseOutput:stream
  1534     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1534     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1535      etc."
  1535      etc."
  1536     
  1536 
  1537     ^ (self parserOn:stream) parseCommandShowConfig
  1537     ^ (self parserOn:stream) parseCommandShowConfig
  1538 
  1538 
  1539     "Created: / 06-12-2012 / 21:45:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1539     "Created: / 06-12-2012 / 21:45:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1540 ! !
  1540 ! !
  1541 
  1541 
  1558     path notNil ifTrue:[stream nextPut: path]
  1558     path notNil ifTrue:[stream nextPut: path]
  1559 
  1559 
  1560     "Created: / 23-10-2012 / 11:09:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1560     "Created: / 23-10-2012 / 11:09:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1561 !
  1561 !
  1562 
  1562 
  1563 parseOutput:stream 
  1563 parseOutput:stream
  1564     ^ (self parserOn:stream) parseCommandStatus
  1564     ^ (self parserOn:stream) parseCommandStatus
  1565 
  1565 
  1566     "Modified: / 23-10-2012 / 11:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1566     "Modified: / 23-10-2012 / 11:07:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1567 ! !
  1567 ! !
  1568 
  1568 
  1586     ].
  1586     ].
  1587 
  1587 
  1588     "Modified: / 23-11-2012 / 23:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1588     "Modified: / 23-11-2012 / 23:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1589 !
  1589 !
  1590 
  1590 
  1591 parseOutput:stream 
  1591 parseOutput:stream
  1592     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1592     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1593      etc."
  1593      etc."
  1594     
  1594 
  1595     ^ (self parserOn:stream) parseCommandUpdate
  1595     ^ (self parserOn:stream) parseCommandUpdate
  1596 
  1596 
  1597     "Modified: / 14-01-2013 / 16:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1597     "Modified: / 14-01-2013 / 16:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1598 ! !
  1598 ! !
  1599 
  1599 
  1600 !HGCommand::version methodsFor:'accessing'!
  1600 !HGCommand::version methodsFor:'accessing'!
  1601 
  1601 
  1602 executable
  1602 executable
  1603     ^ executable notNil 
  1603     ^ executable notNil
  1604         ifTrue:[executable]
  1604         ifTrue:[executable]
  1605         ifFalse:[self class hgCommand]
  1605         ifFalse:[self class hgCommand]
  1606 
  1606 
  1607     "Modified (format): / 21-01-2013 / 05:06:54 / jv"
  1607     "Modified (format): / 21-01-2013 / 05:06:54 / jv"
  1608 !
  1608 !
  1618     ^ Array with: HGExecutable with: '--version'
  1618     ^ Array with: HGExecutable with: '--version'
  1619 
  1619 
  1620     "Created: / 19-11-2012 / 20:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1620     "Created: / 19-11-2012 / 20:01:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1621 !
  1621 !
  1622 
  1622 
  1623 parseOutput:stream 
  1623 parseOutput:stream
  1624     "Parses output of 'hg' command, i.e. commit, log, update, checkout, 
  1624     "Parses output of 'hg' command, i.e. commit, log, update, checkout,
  1625      etc."
  1625      etc."
  1626     
  1626 
  1627     ^ (self parserOn:stream) parseCommandVersion
  1627     ^ (self parserOn:stream) parseCommandVersion
  1628 
  1628 
  1629     "Created: / 19-11-2012 / 20:02:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1629     "Created: / 19-11-2012 / 20:02:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1630 ! !
  1630 ! !
  1631 
  1631