MCWorkingCopy.st
changeset 881 d78a5da73018
parent 850 73e20681c8a0
child 917 e92da349ec56
--- a/MCWorkingCopy.st	Mon Jun 03 12:42:16 2013 +0200
+++ b/MCWorkingCopy.st	Thu Jun 06 21:15:53 2013 +0200
@@ -234,6 +234,19 @@
 !
 
 nextVersionName
+    ^self nextVersionNameWithTemplate: '%(PACKAGE)-%(AUTHOR).%(REVISION_NUMBER)'
+
+    "Modified: / 06-06-2013 / 20:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+nextVersionNameWithTemplate: template
+    "Return next version name based on given template.
+     Following parameters are expanded:
+        REVISION_NUMBER ... sequential version number (the higher, the newer, basically)
+        PACKAGE ........... package name
+        AUTHOR ............ author of the version
+    "
+
         | branch oldName |
         ancestry ancestors isEmpty
                 ifTrue: [counter ifNil: [counter := 0]. branch := package monticelloName asString copy replaceAll: $/ with: $_; replaceAll: $: with: $_]
@@ -249,12 +262,14 @@
                                                 ifTrue: [(each name copyAfterLast: $-) extractNumber]]) max]].
 
         counter := counter + 1.
-        ^ branch, '-',  
-            ((OperatingSystem getFullUserNameFromID: OperatingSystem getUserID)
-                reject:[:c|c isSeparator])
-            , '.', counter asString
+        ^template expandPlaceholdersWith:
+            (Dictionary new
+                at: 'REVISION_NUMBER' put: counter;
+                at: 'PACKAGE' put: branch;
+                at: 'AUTHOR' put: ((OperatingSystem getFullUserNameFromID: OperatingSystem getUserID) reject:[:c|c isSeparator]);
+                yourself)
 
-    "Modified: / 29-05-2013 / 12:27:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 06-06-2013 / 20:02:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 possiblyNewerVersions
@@ -300,11 +315,11 @@
 !MCWorkingCopy class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCWorkingCopy.st,v 1.5 2013-05-29 11:48:04 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCWorkingCopy.st,v 1.6 2013-06-06 19:15:53 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCWorkingCopy.st,v 1.5 2013-05-29 11:48:04 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCWorkingCopy.st,v 1.6 2013-06-06 19:15:53 vrany Exp $'
 ! !