- HGWorkingCopyFile
authorvranyj1@bd9d3459-6c23-4dd9-91de-98eeebb81177
Fri, 09 Nov 2012 12:09:13 +0000
changeset 38 c3d02ed6a645
parent 37 ce1d3916f7ad
child 39 10e693b3e034
- HGWorkingCopyFile changed: #status - HGCommandParser changed: #nextLine #nextSpace - HGTests changed: #test_01a - HGStatus added: #theOnlyInstance - HGCommand class definition added: #initialize changed: #execute
mercurial/HGCommand.st
mercurial/HGCommandParser.st
mercurial/HGStatus.st
mercurial/HGTests.st
mercurial/HGWorkingCopyFile.st
mercurial/Make.proto
mercurial/bc.mak
mercurial/mercurial.rc
--- a/mercurial/HGCommand.st	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/HGCommand.st	Fri Nov 09 12:09:13 2012 +0000
@@ -2,33 +2,33 @@
 
 Object subclass:#HGCommand
 	instanceVariableNames:'workingDirectory'
-	classVariableNames:'HGExecutable'
+	classVariableNames:'HGExecutable Debugging'
 	poolDictionaries:''
 	category:'SCM-Mercurial-Internal'
 !
 
-Smalltalk::HGCommand subclass:#clone
+HGCommand subclass:#clone
 	instanceVariableNames:'url path'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGCommand
 !
 
-Smalltalk::HGCommand subclass:#commit
+HGCommand subclass:#commit
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGCommand
 !
 
-Smalltalk::HGCommand subclass:#push
+HGCommand subclass:#push
 	instanceVariableNames:'remote refspec'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGCommand
 !
 
-Smalltalk::HGCommand subclass:#status
+HGCommand subclass:#status
 	instanceVariableNames:'path'
 	classVariableNames:''
 	poolDictionaries:''
@@ -58,6 +58,19 @@
 "
 ! !
 
+!HGCommand class methodsFor:'initialization'!
+
+initialize
+    "Invoked at system start or when the class is dynamically loaded."
+
+    "/ please change as required (and remove this comment)
+
+    "/ HGExecutable := nil.
+    Debugging := false.
+
+    "Modified: / 09-11-2012 / 11:50:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !HGCommand class methodsFor:'accessing'!
 
 verbose
@@ -145,7 +158,7 @@
     environment := OperatingSystem getEnvironment copy.
 
     environment at:'LANG' put:'C'.
-    sema := Semaphore new name: 'waiting for hg command to finish'.
+    sema := Semaphore new name: 'Waiting for hg command to finish'.
     Processor monitor:[
         pid := OperatingSystem exec:(self executable) withArguments:(self arguments)
             environment:environment
@@ -165,6 +178,9 @@
         output close.
         ^ self.
     ].
+    Debugging ifTrue:[
+        output := output contents asString readStream
+    ].
     retval := self parse: output.
     sema wait.
     status success ifFalse:[
@@ -179,7 +195,7 @@
     "Created: / 11-05-2011 / 07:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 17-12-2011 / 19:22:00 / dundee"
     "Modified (format): / 27-12-2011 / 15:53:54 / dundee"
-    "Modified: / 23-10-2012 / 11:29:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2012 / 11:53:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGCommand methodsFor:'private'!
@@ -389,3 +405,5 @@
 version_SVN
     ^ '$Id::                                                                                                                        $'
 ! !
+
+HGCommand initialize!
--- a/mercurial/HGCommandParser.st	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/HGCommandParser.st	Fri Nov 09 12:09:13 2012 +0000
@@ -64,18 +64,20 @@
 !
 
 nextLine
-    stream nextLine
+    ^stream nextLine
 
     "Created: / 23-10-2012 / 11:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2012 / 12:02:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 nextSpace
     | c |
-    ((c := stream next) ~= Character space) ifFalse:[
+    ((c := stream next) ~= Character space) ifTrue:[
         self error:'Space expected. ''', c , ''' found!!'
     ]
 
     "Created: / 23-10-2012 / 10:58:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2012 / 11:59:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGCommandParser class methodsFor:'documentation'!
--- a/mercurial/HGStatus.st	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/HGStatus.st	Fri Nov 09 12:09:13 2012 +0000
@@ -7,49 +7,49 @@
 	category:'SCM-Mercurial-Core'
 !
 
-Smalltalk::HGStatus subclass:#Added
+HGStatus subclass:#Added
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGStatus
 !
 
-Smalltalk::HGStatus subclass:#Clean
+HGStatus subclass:#Clean
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGStatus
 !
 
-Smalltalk::HGStatus subclass:#Ignored
+HGStatus subclass:#Ignored
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGStatus
 !
 
-Smalltalk::HGStatus subclass:#Missing
+HGStatus subclass:#Missing
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGStatus
 !
 
-Smalltalk::HGStatus subclass:#Modified
+HGStatus subclass:#Modified
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGStatus
 !
 
-Smalltalk::HGStatus subclass:#NotTracked
+HGStatus subclass:#NotTracked
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:HGStatus
 !
 
-Smalltalk::HGStatus subclass:#Removed
+HGStatus subclass:#Removed
 	instanceVariableNames:''
 	classVariableNames:''
 	poolDictionaries:''
@@ -66,6 +66,19 @@
     self error:'Invalid status code: ', aCharacter
 
     "Created: / 23-10-2012 / 10:56:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+theOnlyInstance
+    theOnlyInstance isNil ifTrue:[
+        Lock critical:[
+            theOnlyInstance isNil ifTrue:[
+                theOnlyInstance := self new
+            ].
+        ]
+    ].
+    ^ theOnlyInstance.
+
+    "Created: / 09-11-2012 / 12:04:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGStatus class methodsFor:'accessing'!
--- a/mercurial/HGTests.st	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/HGTests.st	Fri Nov 09 12:09:13 2012 +0000
@@ -70,7 +70,7 @@
 
     "Test modification of working copy and commit back"
 
-    | repo wc file1_txt |
+    | repo wc f1_txt |
 
     repo := self repositoryNamed: 'test_repo_01'.
     "
@@ -79,18 +79,18 @@
     wc := repo workingCopy.
 
     "Modify some file"
-    file1_txt := wc / 'file1.txt'.
-    self assert: file1_txt isModified not.
+    f1_txt := wc / 'f1.txt'.
+    self assert: f1_txt isModified not.
 
-    (file1_txt) writingFileDo:[:s|
+    f1_txt writingFileDo:[:s|
         s nextPutAll: 'modified from test_01a'.
     ].
-    self assert: file1_txt isModified.
+    self assert: f1_txt isModified.
 
     wc commit: 'test_01a commit 1'.
 
     "Created: / 19-09-2012 / 23:06:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 23-10-2012 / 11:24:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2012 / 11:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGTests class methodsFor:'documentation'!
--- a/mercurial/HGWorkingCopyFile.st	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/HGWorkingCopyFile.st	Fri Nov 09 12:09:13 2012 +0000
@@ -27,14 +27,18 @@
 !
 
 status
-    | cmd |
+    | cmd statuses  |
 
     cmd := HGCommand status.
+    cmd workingDirectory: filename directory.
     cmd path: filename pathName.
-    ^cmd execute first
+    statuses := cmd execute.
+    self assert: statuses size == 1.
+    self assert: statuses first second = filename baseName.
+    ^statuses first first.
 
     "Created: / 24-09-2012 / 22:27:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 23-10-2012 / 11:11:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-11-2012 / 12:09:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGWorkingCopyFile methodsFor:'delegating'!
--- a/mercurial/Make.proto	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/Make.proto	Fri Nov 09 12:09:13 2012 +0000
@@ -142,7 +142,7 @@
 
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
-$(OUTDIR)HGCommand.$(O) HGCommand.$(H): HGCommand.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/NameSpace.$(H) $(STCHDR)
+$(OUTDIR)HGCommand.$(O) HGCommand.$(H): HGCommand.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGCommandParser.$(O) HGCommandParser.$(H): HGCommandParser.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGCommit.$(O) HGCommit.$(H): HGCommit.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGError.$(O) HGError.$(H): HGError.st $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
@@ -150,7 +150,7 @@
 $(OUTDIR)HGRepository.$(O) HGRepository.$(H): HGRepository.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGRepositoryError.$(O) HGRepositoryError.$(H): HGRepositoryError.st $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGRepositoryObject.$(O) HGRepositoryObject.$(H): HGRepositoryObject.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)HGStatus.$(O) HGStatus.$(H): HGStatus.st $(INCLUDE_TOP)/stx/libbasic2/Singleton.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/NameSpace.$(H) $(STCHDR)
+$(OUTDIR)HGStatus.$(O) HGStatus.$(H): HGStatus.st $(INCLUDE_TOP)/stx/libbasic2/Singleton.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGWorkingCopyFile.$(O) HGWorkingCopyFile.$(H): HGWorkingCopyFile.st $(INCLUDE_TOP)/stx/libscm/git/GitStatusCodes.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)stx_libscm_mercurial.$(O) stx_libscm_mercurial.$(H): stx_libscm_mercurial.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGBranch.$(O) HGBranch.$(H): HGBranch.st $(INCLUDE_TOP)/stx/libscm/mercurial/HGRepositoryObject.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/mercurial/bc.mak	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/bc.mak	Fri Nov 09 12:09:13 2012 +0000
@@ -15,7 +15,7 @@
 #    bmake clobber - clean all
 #
 # Historic Note:
-#  this used to contain only rules to make with borland 
+#  this used to contain only rules to make with borland
 #    (called via bmake, by "make.exe -f bc.mak")
 #  this has changed; it is now also possible to build using microsoft visual c
 #    (called via vcmake, by "make.exe -f bc.mak -DUSEVC")
@@ -78,7 +78,7 @@
 
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
-$(OUTDIR)HGCommand.$(O) HGCommand.$(H): HGCommand.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\NameSpace.$(H) $(STCHDR)
+$(OUTDIR)HGCommand.$(O) HGCommand.$(H): HGCommand.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGCommandParser.$(O) HGCommandParser.$(H): HGCommandParser.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGCommit.$(O) HGCommit.$(H): HGCommit.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGError.$(O) HGError.$(H): HGError.st $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
@@ -86,7 +86,7 @@
 $(OUTDIR)HGRepository.$(O) HGRepository.$(H): HGRepository.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGRepositoryError.$(O) HGRepositoryError.$(H): HGRepositoryError.st $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGRepositoryObject.$(O) HGRepositoryObject.$(H): HGRepositoryObject.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)HGStatus.$(O) HGStatus.$(H): HGStatus.st $(INCLUDE_TOP)\stx\libbasic2\Singleton.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\NameSpace.$(H) $(STCHDR)
+$(OUTDIR)HGStatus.$(O) HGStatus.$(H): HGStatus.st $(INCLUDE_TOP)\stx\libbasic2\Singleton.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGWorkingCopyFile.$(O) HGWorkingCopyFile.$(H): HGWorkingCopyFile.st $(INCLUDE_TOP)\stx\libscm\git\GitStatusCodes.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)stx_libscm_mercurial.$(O) stx_libscm_mercurial.$(H): stx_libscm_mercurial.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGBranch.$(O) HGBranch.$(H): HGBranch.st $(INCLUDE_TOP)\stx\libscm\mercurial\HGRepositoryObject.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/mercurial/mercurial.rc	Tue Oct 23 11:04:26 2012 +0000
+++ b/mercurial/mercurial.rc	Fri Nov 09 12:09:13 2012 +0000
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_libscm_mercurial.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,36,36
+  FILEVERSION     6,2,38,38
   PRODUCTVERSION  6,2,3,1
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "eXept Software AG\0"
       VALUE "FileDescription", "Smalltalk/X Class library (LIB)\0"
-      VALUE "FileVersion", "6.2.36.36\0"
+      VALUE "FileVersion", "6.2.38.38\0"
       VALUE "InternalName", "stx:libscm/mercurial\0"
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2012\nCopyright eXept Software AG 1998-2012\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.3.1\0"
-      VALUE "ProductDate", "Tue, 23 Oct 2012 10:39:02 GMT\0"
+      VALUE "ProductDate", "Fri, 09 Nov 2012 12:11:30 GMT\0"
     END
 
   END