MCRepositoryBrowser.st
branchjv
changeset 1004 e48adfaf3541
parent 994 73e11bcc0ff1
child 1005 fe6be0a71dbe
--- a/MCRepositoryBrowser.st	Mon Sep 07 16:13:08 2015 +0100
+++ b/MCRepositoryBrowser.st	Tue Sep 08 01:03:02 2015 +0100
@@ -598,9 +598,16 @@
             itemValue: versionCompareWithImage
           )
          (MenuItem
-            enabled: false
-            label: 'Merge'
-            itemValue: versionMerge
+            label: '-'
+          )
+         (MenuItem
+            label: 'Update Code...'
+            itemValue: versionUpdateCode
+          )
+         (MenuItem
+            enabled: canUpdateSplicemap
+            label: 'Update Splicemap...'
+            itemValue: versionUpdateSplicemap
           )
          (MenuItem
             label: '-'
@@ -737,6 +744,12 @@
 
 !MCRepositoryBrowser methodsFor:'aspect-queries'!
 
+canUpdateSplicemap
+    ^ ConfigurableFeatures hasMercurialSupport
+
+    "Created: / 08-09-2015 / 00:56:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 hasRepositorySelectedHolder
     ^ BlockValue
         with:[:h | h value notNil]
@@ -1219,7 +1232,7 @@
 
 versionCompareWithImage
 
-    | version package snapshot snapshotCS packageCS diffset diffCS |
+    | version package snapshot snapshotCS |
 
     self withWaitCursorDo:[
         version := self selectedVersionAsMCVersion.
@@ -1235,6 +1248,17 @@
         ].
         package := Dialog requestProject:(resources string: 'Package to compare with') initialAnswer:package suggestions: nil.
         package isNil ifTrue:[ ^ self ].
+        self versionCompareWithImagePackage: package.  
+    ].
+
+    "Modified: / 07-09-2015 / 18:41:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionCompareWithImagePackage: package
+
+    | version snapshotCS packageCS diffset diffCS |
+
+    self withWaitCursorDo:[
         packageCS := ChangeSet forPackage: package.
         "/ Remove St/X specific method and classes (used for package management)
         packageCS := packageCS reject:[:chg |  
@@ -1266,7 +1290,7 @@
             open       
     ].
 
-    "Modified: / 30-04-2015 / 21:53:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 07-09-2015 / 18:41:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 versionInspect
@@ -1359,6 +1383,68 @@
 
     "Modified: / 09-11-2010 / 13:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 07-09-2011 / 12:47:51 / cg"
+!
+
+versionUpdateCode
+
+    | version package snapshot snapshotCS |
+
+    self withWaitCursorDo:[
+        version := self selectedVersionAsMCVersion.
+        version isNil ifTrue:[ ^ self ].
+        snapshot := version snapshot.
+        snapshotCS := snapshot asChangeSet.
+        snapshotCS name: version info name.
+        ProjectDefinition allSubclassesDo:[ :def |
+            ((def class compiledMethodAt: #monticelloName) notNil and:[
+                def monticelloName = version package name]) ifTrue:[ 
+                package := def package.
+            ].
+        ].
+        package isNil ifTrue:[ 
+            Dialog warn: (resources string: 'No package found for Monticello package ''%1''' with: version package name).
+            ^ self
+        ].
+        self versionCompareWithImagePackage: package.  
+    ].
+
+    "Created: / 07-09-2015 / 18:36:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+versionUpdateSplicemap
+
+    | version package dialog revset packageDef splicemap |
+
+    self withWaitCursorDo:[
+        version := self selectedVersionAsMCVersion.
+        version isNil ifTrue:[ ^ self ].
+        ProjectDefinition allSubclassesDo:[ :def |
+            ((def class compiledMethodAt: #monticelloName) notNil and:[
+                def monticelloName = version package name]) ifTrue:[ 
+                package := def package.
+                packageDef := def.
+            ].
+        ].
+        package isNil ifTrue:[ 
+            Dialog warn: (resources string: 'No package found for Monticello package ''%1''' with: version package name).
+            ^ self
+        ].
+        revset := 'grep(''%1'')' bindWith: version info name.
+
+        dialog := HGChangesetDialog new.
+        dialog repository: (HGPackageWorkingCopy named:package) repository .
+        dialog revset: revset asHGRevset.
+        dialog open ifFalse:[ ^ self ].
+        splicemap := { dialog changeset id literalArrayEncoding . version info literalArrayEncodingWithoutAncestors } 
+                        , packageDef monticelloSplicemap.
+        packageDef theMetaclass 
+                compile: (packageDef monticelloSplicemap_codeFor:splicemap)
+                classified:(packageDef class lookupMethodFor: #monticelloSplicemap) category
+
+    ].
+
+    "Created: / 07-09-2015 / 18:37:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-09-2015 / 00:07:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !MCRepositoryBrowser methodsFor:'updating'!