"Fixed" long-standing "bug" in `#revisionLogOf:fromRevision:...`
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 24 Apr 2016 13:26:20 +0100
changeset 662 3a9f314a45ae
parent 661 0ec4c4636991
child 663 b4c3383566fa
"Fixed" long-standing "bug" in `#revisionLogOf:fromRevision:...` Do not bark about "changeset scanning not implemented" when asking for newest revision anymore. Years of usage proved that returning `nil` in that case is just OK. Smalltalk/X generic source code manager is way too much bound to CVS style of versioning and it does not make much sense. This (resumable) error just confuse users.
mercurial/HGChangesetLabel.st
mercurial/HGSourceCodeManager.st
mercurial/HGStXTests.st
mercurial/HGTests.st
--- a/mercurial/HGChangesetLabel.st	Sat Apr 23 19:55:12 2016 +0100
+++ b/mercurial/HGChangesetLabel.st	Sun Apr 24 13:26:20 2016 +0100
@@ -18,6 +18,8 @@
 "
 "{ Package: 'stx:libscm/mercurial' }"
 
+"{ NameSpace: Smalltalk }"
+
 HGRepositoryObject subclass:#HGChangesetLabel
 	instanceVariableNames:'name color'
 	classVariableNames:''
@@ -164,3 +166,10 @@
     ^ false
 ! !
 
+!HGChangesetLabel class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/mercurial/HGSourceCodeManager.st	Sat Apr 23 19:55:12 2016 +0100
+++ b/mercurial/HGSourceCodeManager.st	Sun Apr 24 13:26:20 2016 +0100
@@ -319,12 +319,11 @@
     path := pkg repositoryRoot.
     wcentry := repo workingCopy / path / classFileName.
     wcentry exists ifFalse:[
-        self breakPoint: #jv.
-        self error:'Ooops, could not found given file in working copy. Changeset scanning not yet implemented. You may proceed not' mayProceed: true.
+        self breakPoint: #jv info: 'Ooops, could not found given file in working copy. Changeset scanning not yet implemented. You may proceed wot'.
         ^ nil
     ].
     revs := (rev1OrNil == 0 and:[rev2OrNil == 0]) 
-        ifTrue:[((wcentry changeset  / path) newer: true) collect:[:f|f changeset]]
+        ifTrue:[((wcentry changeset / path / classFileName) newer: true) collect:[:f|f changeset]]
         ifFalse:[wcentry revisions collect:[:f|f changeset]].
     revs isEmpty ifTrue:[revs add: wcentry changeset].
     newest := revs first.
@@ -370,7 +369,7 @@
 
     ^info
 
-    "Modified: / 30-07-2015 / 07:04:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 24-04-2016 / 13:19:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGSourceCodeManager class methodsFor:'queries'!
--- a/mercurial/HGStXTests.st	Sat Apr 23 19:55:12 2016 +0100
+++ b/mercurial/HGStXTests.st	Sun Apr 24 13:26:20 2016 +0100
@@ -4035,6 +4035,78 @@
     "Modified: / 11-02-2014 / 13:55:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+test_newestRevisionOf_01
+    | rev |
+
+    self repositoryNamed: 'mocks/hg/p6' revision: 4.
+    self assert: (Smalltalk loadPackage:'mocks:hg/p6').
+
+    rev := HGSourceCodeManager newestRevisionOf: (Smalltalk at: #MocksHGP6Bar).
+
+    self assert: rev = '4:f71dfc6c6f9b'.
+
+    "Created: / 24-04-2016 / 11:41:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_newestRevisionOf_02
+    | rev |
+
+    self repositoryNamed: 'mocks/hg/p6' revision: 1.
+    self assert: (Smalltalk loadPackage:'mocks:hg/p6').
+
+    rev := HGSourceCodeManager newestRevisionOf: (Smalltalk at: #MocksHGP6Bar).
+
+    self assert: rev = '4:f71dfc6c6f9b'.
+
+    "Created: / 24-04-2016 / 11:46:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_newestRevisionOf_03a
+    | rev |
+
+    self repositoryNamed: 'mocks/hg/p6' revision: 2.
+    self assert: (Smalltalk loadPackage:'mocks:hg/p6').
+
+    rev := HGSourceCodeManager newestRevisionOf: (Smalltalk at: #MocksHGP6Foo).
+
+    self assert: rev = '2:581b3cabbf8f'.
+
+    "Created: / 24-04-2016 / 11:47:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_newestRevisionOf_03b
+    | repo rev |
+
+    repo := self repositoryNamed: 'mocks/hg/p6' revision: 4.
+    "
+    repo workingCopy browse
+    "
+    self assert: (Smalltalk loadPackage:'mocks:hg/p6').
+
+    (Object subclass:#MocksHGP6Foo instanceVariableNames:'' classVariableNames:'' poolDictionaries:'')
+        package: 'mocks:hg/p6'.
+    rev := HGSourceCodeManager newestRevisionOf: (Smalltalk at: #MocksHGP6Foo).
+
+    self assert: rev = '4:f71dfc6c6f9b'.
+
+    "Created: / 24-04-2016 / 11:48:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_newestRevisionOf_03c
+    | rev |
+
+    self repositoryNamed: 'mocks/hg/p6' revision: 4.
+    self assert: (Smalltalk loadPackage:'mocks:hg/p6').
+
+    (Object subclass:#MocksHGP6Blah instanceVariableNames:'' classVariableNames:'' poolDictionaries:'')
+        package: 'mocks:hg/p6'.
+    rev := HGSourceCodeManager newestRevisionOf: (Smalltalk at: #MocksHGP6Blah).
+
+    self assert: rev isNil
+
+    "Created: / 24-04-2016 / 11:56:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 test_stream_01a
 
     | stream repo contents |
--- a/mercurial/HGTests.st	Sat Apr 23 19:55:12 2016 +0100
+++ b/mercurial/HGTests.st	Sun Apr 24 13:26:20 2016 +0100
@@ -804,6 +804,24 @@
     self should: [ repo @ 100] raise: HGUnknownRevisionError
 
     "Created: / 27-08-2015 / 19:37:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_csentry_newer_01
+
+    | repo cs csentry newer |
+
+    repo := self repositoryNamed: 'mocks/hg/p6' revision: 1.   
+     "
+     UserPreferences fileBrowserClass openOn: repo pathName.
+    "
+    cs := repo @ 1.
+    csentry := cs / 'MocksHGP6Bar.st'.
+    newer := csentry newer: true.
+    self assert: newer size == 2.
+    self assert: newer first changesetId = '4:f71dfc6c6f9b' asHGChangesetId.
+    self assert: newer second changesetId = '2:581b3cabbf8f' asHGChangesetId.
+
+    "Created: / 24-04-2016 / 12:16:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGTests methodsFor:'tests - commit'!