Class revision ID refactoring.
HGChangesetId now prints itself using short form.
Revision taken from version_HG method now consults
binary revision (for there're nothing real in the
string)
--- a/mercurial/HGChangeset.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGChangeset.st Fri Nov 30 23:56:15 2012 +0000
@@ -123,7 +123,7 @@
filenames := HGCommand locate
workingDirectory: repository pathName;
- revision: id;
+ revision: id revno;
execute.
root := HGChangesetFile new setChangeset: self name: ''.
filenames do:[:each|root create: each].
@@ -131,7 +131,7 @@
^root.
"Created: / 16-11-2012 / 22:26:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 16-11-2012 / 23:38:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 23:35:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
timestamp
--- a/mercurial/HGChangesetFile.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGChangesetFile.st Fri Nov 30 23:56:15 2012 +0000
@@ -96,11 +96,12 @@
rs := HGCommand cat
workingDirectory: self repository pathName;
path: self pathName;
- revision: changeset id;
+ revision: changeset id revno;
execute.
^rs.
"Created: / 17-11-2012 / 00:00:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 23:36:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
repository
--- a/mercurial/HGChangesetId.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGChangesetId.st Fri Nov 30 23:56:15 2012 +0000
@@ -186,19 +186,20 @@
^NullId
"
- HGNodeId null
+ HGChangesetId null
"
"Created: / 19-10-2012 / 15:51:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (comment): / 13-11-2012 / 09:54:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 30-11-2012 / 22:00:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGChangesetId methodsFor:'accessing'!
revno
- ^ revno ? -2
+ ^ revno
"Created: / 13-11-2012 / 09:52:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 22:05:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
revno:anInteger
@@ -251,9 +252,11 @@
!HGChangesetId methodsFor:'printing & storing'!
displayOn:aStream
+
^self printOn: aStream
"Created: / 13-11-2012 / 09:55:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 22:01:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
printOn:aStream
@@ -262,15 +265,15 @@
| rn |
rn := self revno.
- rn ~~ -2 ifTrue:[
+ rn notNil ifTrue:[
rn printOn: aStream.
- self size == 0 ifTrue:[ ^ self ].
+ self isEmpty ifTrue:[ ^ self ].
aStream nextPut: $:.
].
- aStream nextPutAll: (self hexPrintString asLowercase)
+ aStream nextPutAll: (self copyTo: 6) hexPrintString asLowercase
- "Modified: / 16-11-2012 / 22:08:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 23:42:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGChangesetId methodsFor:'queries'!
--- a/mercurial/HGCommandParserTests.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGCommandParserTests.st Fri Nov 30 23:56:15 2012 +0000
@@ -47,11 +47,12 @@
self assert: heads size == 3.
- self assert: heads first asString = '6:4e0568ffbf1a53f2d8980ba9844d2af6f0bac455'.
- self assert: heads second asString = '5:f22945219f9be25a1fe436d81afece07b89330be'.
- self assert: heads third asString = '4:5bd21fb5eea8a7cb4adf45bccfea76cda11df84a'.
+ self assert: heads first asString = '6:4e0568ffbf1a'.
+ self assert: heads second asString = '5:f22945219f9b'.
+ self assert: heads third asString = '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>"
!
test_cmd_status_01
--- a/mercurial/HGPackageModel.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGPackageModel.st Fri Nov 30 23:56:15 2012 +0000
@@ -115,12 +115,15 @@
"Make sure temporary working exists and is at
given revision"
+ self assert: rev revno notNil.
+
self ensureWorkingCopy.
rev notNil ifTrue:[
- wc update: rev.
+ wc update: rev revno printString.
].
"Created: / 28-11-2012 / 09:38:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 23:22:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGPackageModel class methodsFor:'documentation'!
--- a/mercurial/HGRevisionInfo.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGRevisionInfo.st Fri Nov 30 23:56:15 2012 +0000
@@ -103,6 +103,14 @@
changesetId:anHGNodeId
changesetId := anHGNodeId.
+!
+
+className
+ ^ className
+!
+
+className:something
+ className := something.
! !
!HGRevisionInfo methodsFor:'accessing-properties'!
@@ -136,12 +144,12 @@
className isNil ifTrue:[ ^ nil ].
cls := Smalltalk at: className.
^cls notNil ifTrue:[
- className , '.' , (cls programingLanguage sourceFileSuffix)
+ className , '.' , (cls programmingLanguage sourceFileSuffix)
] ifFalse:[
className , '.st'
].
- "Modified: / 20-11-2012 / 10:17:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 22:20:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
repositoryPathName
@@ -187,6 +195,21 @@
"Created: / 22-10-2008 / 20:48:08 / cg"
! !
+!HGRevisionInfo methodsFor:'printing & storing'!
+
+printOn:aStream
+ "append a printed representation if the receiver to the argument, aStream"
+
+ super printOn:aStream.
+ aStream nextPutAll:'['.
+ className printOn:aStream.
+ aStream space.
+ changesetId printOn:aStream.
+ aStream nextPutAll:']'.
+
+ "Modified: / 30-11-2012 / 22:13:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!HGRevisionInfo methodsFor:'private'!
properties
--- a/mercurial/HGSourceCodeManager.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGSourceCodeManager.st Fri Nov 30 23:56:15 2012 +0000
@@ -250,6 +250,16 @@
^ HGRevisionInfo fromString: aString
"Modified: / 20-11-2012 / 23:26:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+revisionInfoFromString: vsnString inClass: class
+ | revInfo |
+
+ revInfo := self revisionInfoFromString: (class binaryRevisionString ? vsnString).
+ revInfo className: class name.
+ ^revInfo
+
+ "Created: / 30-11-2012 / 21:48:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGSourceCodeManager class methodsFor:'subclass responsibility'!
--- a/mercurial/HGStXTests.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGStXTests.st Fri Nov 30 23:56:15 2012 +0000
@@ -405,9 +405,10 @@
Smalltalk loadPackage:'mocks:hg/p1'.
self dumpRepositoryLog: repo.
- self assert: (Smalltalk at:#'mocks_hg_p1') hgLogicalRevision asString = '1:e0bec585af86b3ee98047baa69530b2b2484c9c0'.
+ self assert: (Smalltalk at:#'mocks_hg_p1') hgLogicalRevision asString = '1:e0bec585af86'.
"Created: / 23-11-2012 / 11:00:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 23:44:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!HGStXTests methodsFor:'utilities'!
--- a/mercurial/HGTests.st Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/HGTests.st Fri Nov 30 23:56:15 2012 +0000
@@ -131,16 +131,16 @@
repo := self repositoryNamed:'test_repo_01'.
cs := repo @ 4.
- self assert: cs id printString = '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7'.
+ self assert: cs id printString = '4:6f88e1f44d9e'.
cs := repo @ '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7'.
- self assert: cs id printString = '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7'.
+ self assert: cs id printString = '4:6f88e1f44d9e'.
cs := repo @ '4:6f88e1f44d9e'.
- self assert: cs id printString = '4:6f88e1f44d9eb86e0b56ca15e30e5d786acd83c7'.
+ self assert: cs id printString = '4:6f88e1f44d9e'.
"Created: / 16-11-2012 / 21:03:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified (comment): / 16-11-2012 / 22:10:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 23:34:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_changeset_02
@@ -377,11 +377,11 @@
id := #[ 111 136 225 244 77 158 184 110 11 86 202 21 227 14 93 120 106 205 131 199 ]
asHGChangesetId.
- self assert: id revno = -2.
+ self assert: id revno isNil.
self assert: id asByteArray = #[111 136 225 244 77 158 184 110 11 86 202 21 227 14 93 120 106 205 131 199].
"Created: / 16-11-2012 / 21:32:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-11-2012 / 17:50:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-11-2012 / 23:36:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
test_nodeid_03
--- a/mercurial/mercurial.rc Fri Nov 30 21:42:46 2012 +0000
+++ b/mercurial/mercurial.rc Fri Nov 30 23:56:15 2012 +0000
@@ -25,7 +25,7 @@
VALUE "LegalCopyright", "Copyright Jan Vrany 2012\0"
VALUE "ProductName", "Smalltalk/X Mercurial Integration\0"
VALUE "ProductVersion", "6.2.3.0\0"
- VALUE "ProductDate", "Fri, 30 Nov 2012 21:34:34 GMT\0"
+ VALUE "ProductDate", "Fri, 30 Nov 2012 23:52:58 GMT\0"
END
END