Fixed `HGChangesetId >> asString` to print only commit id
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 30 Oct 2017 20:51:43 +0000
changeset 796 ae6b5b28acd5
parent 795 aea8f9d9a237
child 799 29bd6b5337b0
Fixed `HGChangesetId >> asString` to print only commit id ...if available. The problem is that revno is not stable (i.e. the same commit may have different revnos in different clones). `#asString` is used in commands - this makes it more robust as the command would operate on commit ids if wheneve possible.
mercurial/HGChangesetId.st
mercurial/HGCommandParserTests.st
--- a/mercurial/HGChangesetId.st	Tue Oct 17 09:59:29 2017 +0000
+++ b/mercurial/HGChangesetId.st	Mon Oct 30 20:51:43 2017 +0000
@@ -348,9 +348,14 @@
 !
 
 asString
-    ^self printString
+    self hasRevnoOnly ifTrue:[ 
+        ^ revno printString
+    ] ifFalse:[ 
+        ^ self hexPrintString asLowercase
+    ].
 
     "Created: / 17-11-2012 / 01:08:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-10-2017 / 20:48:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 literalArrayEncoding
--- a/mercurial/HGCommandParserTests.st	Tue Oct 17 09:59:29 2017 +0000
+++ b/mercurial/HGCommandParserTests.st	Mon Oct 30 20:51:43 2017 +0000
@@ -173,12 +173,12 @@
 
     self assert: heads size == 3.
 
-    self assert: heads first  asString = '6:4e0568ffbf1a'.
-    self assert: heads second asString = '5:f22945219f9b'.
-    self assert: heads third  asString = '4:5bd21fb5eea8'.
+    self assert: heads first  printString = '6:4e0568ffbf1a'.
+    self assert: heads second printString = '5:f22945219f9b'.
+    self assert: heads third  printString = '4:5bd21fb5eea8'.
 
     "Created: / 27-11-2012 / 21:22:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 30-11-2012 / 23:43:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-10-2017 / 20:59:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 test_cmd_help_01
@@ -218,11 +218,12 @@
 
     self assert: children first second size == 3.
 
-    self assert: children first second first  asString = '6:4e0568ffbf1a'.
-    self assert: children first second second asString = '5:f22945219f9b'.
-    self assert: children first second third  asString = '4:5bd21fb5eea8'.
+    self assert: children first second first  printString = '6:4e0568ffbf1a'.
+    self assert: children first second second printString = '5:f22945219f9b'.
+    self assert: children first second third  printString = '4:5bd21fb5eea8'.
 
     "Created: / 05-12-2012 / 23:35:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-10-2017 / 20:59:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 test_cmd_log_file_01
@@ -238,12 +239,12 @@
 
     self assert: heads size == 3.
 
-    self assert: heads first  asString = '6:4e0568ffbf1a'.
-    self assert: heads second asString = '5:f22945219f9b'.
-    self assert: heads third  asString = '4:5bd21fb5eea8'.
+    self assert: heads first  printString = '6:4e0568ffbf1a'.
+    self assert: heads second printString = '5:f22945219f9b'.
+    self assert: heads third  printString = '4:5bd21fb5eea8'.
 
     "Created: / 05-12-2012 / 19:16:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 08-02-2014 / 22:17:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 30-10-2017 / 20:59:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 test_cmd_merge_01