mercurial/HGCommand.st
changeset 465 adb48cfb1df7
parent 463 3ba85719b2a3
child 470 9a901e620f0b
--- a/mercurial/HGCommand.st	Fri Oct 31 15:01:45 2014 +0000
+++ b/mercurial/HGCommand.st	Tue Nov 04 16:07:41 2014 +0000
@@ -274,7 +274,8 @@
 
 hgCommand: command
     HGCommandString := command notNil ifTrue:[ command asString ] ifFalse:[ nil ].
-    HGExecutable := HGExecutableArguments := nil.
+    HGExecutable := HGExecutableArguments := HGVersion := nil.
+
 
     "
     HGCommand hgCommand: '/usr/src/mercurial-2.4/hg'
@@ -284,7 +285,7 @@
     "
 
     "Created: / 19-11-2012 / 21:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 17-07-2014 / 11:18:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-11-2014 / 14:52:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 hgCommandValidate: command
@@ -372,6 +373,34 @@
     "Modified: / 17-07-2014 / 15:09:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+hgVersion: versionA isGreaterOrEqualThan: versionB
+    1 to: (versionA size min: versionB size) do:[:i | 
+        (versionA at: i) < (versionB at: i) ifTrue:[ 
+            ^ false.
+        ].
+        (versionA at: i) > (versionB at: i) ifTrue:[ 
+            ^ true.
+        ].
+    ].
+    ^ versionA size >= versionB size
+
+    "
+     HGCommand hgVersion: #(3 0) isGreaterOrEqualThan: #(2 5).
+     HGCommand hgVersion: #(3 0) isGreaterOrEqualThan: #(2 5 1).
+     HGCommand hgVersion: #(3 0) isGreaterOrEqualThan: #(3 0).
+     HGCommand hgVersion: #(3 0 1) isGreaterOrEqualThan: #(3 0). 
+     HGCommand hgVersion: #(3 0)  isGreaterOrEqualThan: #(3 0 1).
+    "
+
+    "Created: / 04-11-2014 / 14:12:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hgVersionIsGreaterOrEqualThan: versionB
+    ^ self hgVersion: self hgVersion isGreaterOrEqualThan: versionB
+
+    "Created: / 04-11-2014 / 14:16:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 hgVersionIsSupported
     ^ self hgVersionIsSupported:self hgVersion
 
@@ -1152,13 +1181,13 @@
     revision notNil ifTrue:[
         stream
             nextPut: '-r';
-            nextPut: revision asString.
+            nextPut: (revision hasRevnoOnly ifTrue:[revision revno printString] ifFalse:[revision printStringWithoutNumber]).
     ].
     stream
         nextPut: name.
 
     "Created: / 20-03-2014 / 17:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 20-03-2014 / 18:43:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 04-11-2014 / 16:03:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parseError:stream