ProjectDefinition.st
branchjv
changeset 17983 2fd8c161f95e
parent 17981 27a6a9c39714
child 17984 103d5624ad1d
--- a/ProjectDefinition.st	Mon Nov 19 22:57:08 2012 +0000
+++ b/ProjectDefinition.st	Tue Nov 20 22:50:28 2012 +0000
@@ -1773,6 +1773,7 @@
     "Modified: / 29-03-2012 / 18:43:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+
 !ProjectDefinition class methodsFor:'defaults'!
 
 applicationTypes
@@ -2422,20 +2423,55 @@
     "take the default revision from the cvs-version,
      but ignore a possibly present 'm'-flag that is set when this revision has been modified"
 
+    "JV@2012-11-20: Original code was:
+
     ^ self cvsRevision last upTo:$m
 
+    But this is too CVS specific. Modern SCMs does not use X.Y style
+    revision numbers, instead it uses hashes (Git/Mercurial/Darcs/Monotone).
+    Even worse, all the SCM code passes strings around, so providing compatible,
+    polymorph object is not possible. Hence following hack."
+
+    | nr |
+
+    nr := (self cvsRevision last upTo:$m) select:[:c|c isDigit].
+    nr isEmptyOrNil ifTrue:[nr := '0'].
+    ^nr
+
     "Created: / 18-08-2006 / 12:02:58 / cg"
     "Modified: / 30-08-2006 / 18:54:48 / cg"
+    "Modified: / 20-11-2012 / 22:52:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileRevisionNr
     "Returns a revisionNumber which will appear in libName.rc"
 
     "take the default revision from the cvs-version"
+
+    "JV@2012-11-20: Original code was:
+
     ^ self cvsRevision first
 
+    But this is too CVS specific. Modern SCMs does not use X.Y style
+    revision numbers, instead it uses hashes (Git/Mercurial/Darcs/Monotone).
+    Even worse, all the SCM code passes strings around, so providing compatible,
+    polymorph object is not possible. Hence following hack."
+
+    | nr |
+
+    nr := self cvsRevision first select:[:c|c isDigit].
+    nr isEmptyOrNil ifTrue:[nr := '0'].
+    ^nr
+
+    "
+    stx_libbasic fileRevisionNr
+    stx_libbasic2 fileRevisionNr
+    stx_libscm_mercurial fileRevisionNr
+    "
+
     "Created: / 18-08-2006 / 12:02:39 / cg"
     "Modified: / 30-08-2006 / 18:54:39 / cg"
+    "Modified: / 20-11-2012 / 22:52:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileVersion
@@ -6818,7 +6854,7 @@
 !ProjectDefinition class methodsFor:'documentation'!
 
 version
-    ^ '$Id: ProjectDefinition.st 10863 2012-11-18 19:40:23Z vranyj1 $'
+    ^ '$Id: ProjectDefinition.st 10865 2012-11-20 22:50:28Z vranyj1 $'
 !
 
 version_CVS
@@ -6826,7 +6862,7 @@
 !
 
 version_SVN
-    ^ '$Id:: ProjectDefinition.st 10863 2012-11-18 19:40:23Z vranyj1                                                                $'
+    ^ '$Id:: ProjectDefinition.st 10865 2012-11-20 22:50:28Z vranyj1                                                                $'
 ! !
 
 ProjectDefinition initialize!