Compare packages functionality moved from browser to SourceCoeManagerUtilities
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 04 Apr 2014 22:20:01 +0200
changeset 3537 ee6b24d5f0f8
parent 3536 cb8679184d3b
child 3538 de2b2c9079a1
Compare packages functionality moved from browser to SourceCoeManagerUtilities
SourceCodeManagerUtilitiesForContainerBasedManagers.st
--- a/SourceCodeManagerUtilitiesForContainerBasedManagers.st	Fri Apr 04 22:19:56 2014 +0200
+++ b/SourceCodeManagerUtilitiesForContainerBasedManagers.st	Fri Apr 04 22:20:01 2014 +0200
@@ -798,15 +798,55 @@
 
     "Created: / 13-10-2011 / 11:15:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 04-09-2012 / 14:05:36 / cg"
+!
+
+comparePackages:packages askForRevision:askForRevision
+    "Compares code of given packages (loaded in the image) against a specific revision
+     and opens a diff browser on differences.
+     
+     If `askForRevision` is true, then user is asked to specify to which revision to
+     update. If `askForRevision` is false, then packages are updated to a 'newest'
+     revision.
+     
+     NOTE: Definition of `newest` revision may vary. For SCMs which allows for multiple
+     heads, it is not clear which one it is. In that case, even if `askForRevision` is
+     false, this method may result in user interation, asking user to select which of the
+     newest she wants."
+
+    |dateFormat string dateOrNil symbolicName|
+
+    dateFormat := UserPreferences current dateInputFormat.
+    string := Dialog
+                request:(resources
+                        string:'Compare with version from date (%1) or tag (any other format):'
+                        with:dateFormat)
+                initialAnswer:(Date today printStringFormat:dateFormat).
+
+    string isEmptyOrNil ifTrue:[^ self].
+    dateOrNil := Date readFrom:string printFormat:dateFormat onError:nil.
+    dateOrNil isNil ifTrue:[
+        symbolicName := string
+    ].
+
+    packages value do:[:eachProject |
+        dateOrNil notNil ifTrue:[
+            self compareProject:eachProject withRepositoryVersionFrom:dateOrNil
+        ] ifFalse:[
+            self compareProject:eachProject withRepositoryVersionTaggedAs:symbolicName
+        ]
+    ].
+
+
+    "Created: / 04-04-2014 / 15:29:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SourceCodeManagerUtilitiesForContainerBasedManagers class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.19 2014-02-19 20:53:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.20 2014-04-04 20:20:01 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.19 2014-02-19 20:53:42 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic3/SourceCodeManagerUtilitiesForContainerBasedManagers.st,v 1.20 2014-04-04 20:20:01 vrany Exp $'
 ! !