Fixed `HGStXTests >> #test_commit_31a` to work with evolve extension
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 06 Mar 2018 11:50:32 +0000
changeset 812 10b0181c33fb
parent 810 c04f9722d89f
child 814 f082e56d6ff7
Fixed `HGStXTests >> #test_commit_31a` to work with evolve extension
mercurial/HGChangeset.st
mercurial/HGStXTests.st
mercurial/HGTests.st
--- a/mercurial/HGChangeset.st	Fri Feb 09 12:06:00 2018 +0000
+++ b/mercurial/HGChangeset.st	Tue Mar 06 11:50:32 2018 +0000
@@ -355,7 +355,7 @@
                                             revset: 'successors(', id printStringWithoutNumber, ')';
                                             hidden: true; 
                                             yourself).  
-                            ids collect:[ :id | repository changesetWithId: id ]                            
+                            ids reject: [ :each | each id = id ] thenCollect:[ :each | repository changesetWithId: each id ]
                         ].       
     ].
     ^ successors value.
@@ -368,9 +368,10 @@
                     revset: 'successors(', id printStringWithoutNumber, ')';
                     hidden: true; 
                     yourself).  
-    ^ids collect:[ :id | repository changesetWithId: id ]                            
+    ^ids reject: [ :each | each id = id ] thenCollect:[ :each | repository changesetWithId: each id ]
 
     "Created: / 08-02-2018 / 15:27:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (comment): / 22-03-2018 / 22:45:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 summary
@@ -682,6 +683,7 @@
     ]
 
     "Created: / 08-02-2018 / 09:14:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-03-2018 / 22:53:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGChangeset methodsFor:'utilities'!
--- a/mercurial/HGStXTests.st	Fri Feb 09 12:06:00 2018 +0000
+++ b/mercurial/HGStXTests.st	Tue Mar 06 11:50:32 2018 +0000
@@ -2326,6 +2326,8 @@
 
     "/ 1. load package
     repo := self repositoryNamed: 'mocks/hg/p1'.
+    self skipIf: repo hasExtensionEvolve not description: 'No evolve extension'.
+
     self assert: (Smalltalk loadPackage:'mocks:hg/p1').
     self dumpRepositoryLog: repo.
     self deny:   ((repo @ 1 / 'MockHGP1Bar.st') contents asString includesString:'zork ^ 1').
@@ -2349,7 +2351,8 @@
     ( wc / 'notes.txt' ) writingFileDo:[:s | s nextPutAll:'some notes' ].
     wc track: (Array with:( wc / 'notes.txt' )).
     wc commit: testSelector , '-3' files: #('notes.txt') author: testSelector amend: true.
-    self assert: wc changeset id = (repo @ 3) id.
+    self dumpRepositoryLog: repo.     
+    self assert: wc changeset id = (repo changesetsMatching: 'tip') first id.
 
     "/ 4. modify and commit normally again
     ((Smalltalk at:#MockHGP1Bar) compile:'zork ^ 100' classified:'test') package: (Smalltalk at:#MockHGP1Bar) package.
@@ -2367,10 +2370,45 @@
     "/ update the logical revision and try again.
     ct doUpdateLogicalRevisionTo: ct changesetSuccessors anElement id.
     ct do.
-    self assert: wc changeset id = (repo @ 4) id.
+    self assert: wc changeset id = (repo changesetsMatching: 'tip') first id.
 
     "Created: / 07-02-2018 / 22:44:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 08-02-2018 / 22:18:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-03-2018 / 22:48:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-03-2018 / 11:48:11 / jv"
+!
+
+test_commit_31b
+    "
+    Test that the HGCommitTask >> #changesetSuccessors returns
+    an empty set in case evolve extension is not enabled.
+    "
+
+    | repo pm ct |
+
+    UserPreferences current hgUseSharedRepositories: true.       
+
+    "/ 1. load package
+    repo := self repositoryNamed: 'mocks/hg/p1'.
+    self skipIf: repo hasExtensionEvolve description: 'evolve extension enabled'.
+
+    self assert: (Smalltalk loadPackage:'mocks:hg/p1').
+    self dumpRepositoryLog: repo.
+    self deny:   ((repo @ 1 / 'MockHGP1Bar.st') contents asString includesString:'zork ^ 1').
+
+    "/ 2. modify and commit normally (using HGCommitTask)
+    ((Smalltalk at:#MockHGP1Bar) compile:'zork ^ 1' classified:'test') package: (Smalltalk at:#MockHGP1Bar) package.
+    pm := HGPackageWorkingCopy named: 'mocks:hg/p1'.
+    ct := pm commitTask.
+    self assert: ct isPackageLogicalRevisonObsolete not.
+    self assert: ct changesetSuccessors isEmpty.
+    ct message: testSelector , '-2'.
+    ct do.
+    self dumpRepositoryLog: repo.
+
+    self assert: ((repo @ 2 / 'MockHGP1Bar.st') contents asString includesString:'zork ^ 1').
+    self assert: (Smalltalk at:#mocks_hg_p1) hgLogicalRevision revno = 2.
+
+    "Created: / 22-03-2018 / 22:49:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 test_commit_issue63
--- a/mercurial/HGTests.st	Fri Feb 09 12:06:00 2018 +0000
+++ b/mercurial/HGTests.st	Tue Mar 06 11:50:32 2018 +0000
@@ -825,6 +825,20 @@
     "Created: / 10-06-2016 / 10:22:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+test_changeset_12
+    "
+    Test #successors
+    "
+
+    | repo cs |
+
+    repo := self repositoryNamed:'test_repo_01'.
+    cs := repo @ 1.    
+    self assert: cs successors isEmpty.
+
+    "Created: / 22-03-2018 / 22:41:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 test_csentry_newer_01
 
     | repo cs csentry newer |