Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 21 May 2013 16:50:38 +0100
changeset 288 577f8935661d
parent 287 c3e542755abd
child 289 f61fc1ecf8aa
Added ProjectDefinition>>hgRemoveContainesForDeletedClasses config methd. If true, then containers for removed classes are __AUTOMATICALLY__ removed from the repositoru. If false, obsolete containes are kept. Default is true (remove obsolete containers) but if the repository is mirror of CVS and you want to merge back to CVS at some point, you may want to return false to avoid deletions of obsolete files. Usefull when branching off an old CVS repo with loads of mess.
mercurial/HGCommitTask.st
mercurial/HGStXTests.st
mercurial/Make.proto
mercurial/bc.mak
mercurial/extensions.st
mercurial/mercurial.rc
mercurial/stx_libscm_mercurial.st
--- a/mercurial/HGCommitTask.st	Thu May 16 13:20:48 2013 +0100
+++ b/mercurial/HGCommitTask.st	Tue May 21 16:50:38 2013 +0100
@@ -152,6 +152,20 @@
     "Created: / 28-11-2012 / 09:42:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!HGCommitTask methodsFor:'executing - private'!
+
+doRemoveOldContainers
+    | def |
+
+    def := self package definition.
+    def hgRemoveContainesForDeletedClasses ifFalse:[
+        ^self.
+    ].
+    super doRemoveOldContainers
+
+    "Created: / 21-05-2013 / 16:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !HGCommitTask methodsFor:'queries'!
 
 commitingNewHead
--- a/mercurial/HGStXTests.st	Thu May 16 13:20:48 2013 +0100
+++ b/mercurial/HGStXTests.st	Tue May 21 16:50:38 2013 +0100
@@ -1057,6 +1057,54 @@
     ct do.
 
     "Created: / 01-04-2013 / 13:23:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_commit_14a
+    "
+    Test if container is removed if class is removed.
+    "
+
+    | repo pm ct |
+
+    repo := self repositoryNamed: 'mocks/hg/p1'.
+    self assert: (Smalltalk loadPackage: 'mocks:hg/p1').
+
+    Smalltalk removeClass: (Smalltalk at: #MockHGP1Bar).
+
+    pm := HGPackageModel named: #'mocks:hg/p1'.
+    ct := pm commitTask.
+    ct message:'test_commit_14a'.
+    ct do.
+
+    self shouldnt: [ repo @ 1 / 'MockHGP1Bar.st' ] raise: HGError.
+    self should:   [ repo @ 2 / 'MockHGP1Bar.st' ] raise: HGError.
+
+    "Created: / 21-05-2013 / 16:24:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_commit_14b
+    "
+    Test if container is removed if class is removed but not if package
+    specifies #hgRemoveContainesForDeletedClasses
+
+    "
+
+    | repo pm ct |
+
+    repo := self repositoryNamed: 'mocks/hg/p1'.
+    self assert: (Smalltalk loadPackage: 'mocks:hg/p1').
+    (Smalltalk at: #mocks_hg_p1) class compile: 'hgRemoveContainesForDeletedClasses ^false' classified: 'accessing - hg'.
+
+    Smalltalk removeClass: (Smalltalk at: #MockHGP1Bar).
+    pm := HGPackageModel named: #'mocks:hg/p1'.
+    ct := pm commitTask.
+    ct message:'test_commit_14b'.
+    ct do.
+
+    self shouldnt: [ repo @ 1 / 'MockHGP1Bar.st' ] raise: HGError.
+    self shouldnt: [ repo @ 2 / 'MockHGP1Bar.st' ] raise: HGError.
+
+    "Created: / 21-05-2013 / 16:47:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGStXTests methodsFor:'tests - manager API'!
--- a/mercurial/Make.proto	Thu May 16 13:20:48 2013 +0100
+++ b/mercurial/Make.proto	Tue May 21 16:50:38 2013 +0100
@@ -133,16 +133,15 @@
 # build all mandatory prerequisite packages (containing superclasses) for this package
 prereq:
 	cd ../../libbasic && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../goodies/refactoryBrowser/parser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libbasic2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../../libcomp && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libbasic3 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libcomp && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
+	cd ../../libui && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../../libboss && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../../libui && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libwidg && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd ../../libhtml && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libwidg2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../../libtool && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd ../common && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
--- a/mercurial/bc.mak	Thu May 16 13:20:48 2013 +0100
+++ b/mercurial/bc.mak	Tue May 21 16:50:38 2013 +0100
@@ -51,16 +51,15 @@
 # build all mandatory prerequisite packages (containing superclasses) for this package
 prereq:
 	pushd ..\..\libbasic & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\goodies\refactoryBrowser\parser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libbasic2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libbasic3 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libcomp & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
+	pushd ..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\libboss & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\libui & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\libhtml & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libwidg2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\libtool & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\common & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
--- a/mercurial/extensions.st	Thu May 16 13:20:48 2013 +0100
+++ b/mercurial/extensions.st	Tue May 21 16:50:38 2013 +0100
@@ -815,6 +815,21 @@
     "Modified: / 27-11-2012 / 22:14:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!ProjectDefinition class methodsFor:'accessing - hg'!
+
+hgRemoveContainesForDeletedClasses
+    "If true, then containers for removed classes are __AUTOMATICALLY__ removed from the
+     repositoru. If false, obsolete containes are kept.
+
+     Default is true (remove obsolete containers) but if the repository is mirror of CVS and
+     you want to merge back to CVS at some point, you may want to return false to avoid deletions
+     of obsolete files. Usefull when branching off an old CVS repo with loads of mess."
+
+    ^true "default"
+
+    "Created: / 21-05-2013 / 16:44:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !String methodsFor:'converting'!
 
 asHGChangesetId
--- a/mercurial/mercurial.rc	Thu May 16 13:20:48 2013 +0100
+++ b/mercurial/mercurial.rc	Tue May 21 16:50:38 2013 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Jan Vrany 2012\0"
       VALUE "ProductName", "Smalltalk/X Mercurial Integration\0"
       VALUE "ProductVersion", "6.2.3.0\0"
-      VALUE "ProductDate", "Thu, 04 Apr 2013 18:50:24 GMT\0"
+      VALUE "ProductDate", "Tue, 21 May 2013 15:49:46 GMT\0"
     END
 
   END
--- a/mercurial/stx_libscm_mercurial.st	Thu May 16 13:20:48 2013 +0100
+++ b/mercurial/stx_libscm_mercurial.st	Tue May 21 16:50:38 2013 +0100
@@ -56,12 +56,12 @@
 
     ^ #(
         #'stx:goodies/sunit'    "TestAsserter - superclass of HGCommandParserTests "
-        #'stx:libbasic'    "SharedPool - superclass of HGDebugFlags "
-        #'stx:libbasic2'    "Singleton - superclass of HGStatus::Missing "
+        #'stx:libbasic'    "ActivityNotification - superclass of HGNotification "
+        #'stx:libbasic2'    "Singleton - superclass of HGStatus "
         #'stx:libbasic3'    "AbstractSourceCodeManager - superclass of HGSourceCodeManager "
-        #'stx:libscm/common'    "SCMAbstractPackageModelRegistry - superclass of HGPackageModelRegistry "
-        #'stx:libtool'    "SystemBrowser - extended "
-        #'stx:libview2'    "ApplicationModel - superclass of HGCommitDialog "
+        #'stx:libscm/common'    "SCMAbstractCommitDialog - superclass of HGCommitDialog "
+        #'stx:libtool'    "AbstractFileBrowser - extended "
+        #'stx:libview2'    "ApplicationModel - extended "
     )
 !
 
@@ -265,6 +265,7 @@
         AbstractFileBrowser hgPullFromURLRepository:
         AbstractFileBrowser hgPushTo:repository:
         AbstractFileBrowser hgPushToURLRepository:
+        'ProjectDefinition class' hgRemoveContainesForDeletedClasses
     )
 ! !