@@ -66,6 +66,12 @@ tests mtimeChange =
66
66
, testProperty " syncSourceRepos" prop_syncRepos_pijul
67
67
]
68
68
69
+ , testGroup " mercurial" $ const []
70
+ [ testProperty " check VCS test framework" prop_framework_hg
71
+ , testProperty " cloneSourceRepo" prop_cloneRepo_hg
72
+ , testProperty " syncSourceRepos" prop_syncRepos_hg
73
+ ]
74
+
69
75
]
70
76
71
77
prop_framework_git :: BranchingRepoRecipe -> Property
@@ -86,6 +92,12 @@ prop_framework_pijul =
86
92
. prop_framework vcsPijul vcsTestDriverPijul
87
93
. WithBranchingSupport
88
94
95
+ prop_framework_hg :: BranchingRepoRecipe -> Property
96
+ prop_framework_hg =
97
+ ioProperty
98
+ . prop_framework vcsHg vcsTestDriverHg
99
+ . WithBranchingSupport
100
+
89
101
prop_cloneRepo_git :: BranchingRepoRecipe -> Property
90
102
prop_cloneRepo_git =
91
103
ioProperty
@@ -105,6 +117,12 @@ prop_cloneRepo_pijul =
105
117
. prop_cloneRepo vcsPijul vcsTestDriverPijul
106
118
. WithBranchingSupport
107
119
120
+ prop_cloneRepo_hg :: BranchingRepoRecipe -> Property
121
+ prop_cloneRepo_hg =
122
+ ioProperty
123
+ . prop_cloneRepo vcsHg vcsTestDriverHg
124
+ . WithBranchingSupport
125
+
108
126
prop_syncRepos_git :: RepoDirSet -> SyncTargetIterations -> PrngSeed
109
127
-> BranchingRepoRecipe -> Property
110
128
prop_syncRepos_git destRepoDirs syncTargetSetIterations seed =
@@ -130,6 +148,14 @@ prop_syncRepos_pijul destRepoDirs syncTargetSetIterations seed =
130
148
destRepoDirs syncTargetSetIterations seed
131
149
. WithBranchingSupport
132
150
151
+ prop_syncRepos_hg :: RepoDirSet -> SyncTargetIterations -> PrngSeed
152
+ -> BranchingRepoRecipe -> Property
153
+ prop_syncRepos_hg destRepoDirs syncTargetSetIterations seed =
154
+ ioProperty
155
+ . prop_syncRepos vcsHg vcsTestDriverHg
156
+ destRepoDirs syncTargetSetIterations seed
157
+ . WithBranchingSupport
158
+
133
159
-- ------------------------------------------------------------
134
160
-- * General test setup
135
161
-- ------------------------------------------------------------
@@ -755,3 +781,46 @@ vcsTestDriverPijul verbosity vcs repoRoot =
755
781
}
756
782
pijul = runProgramInvocation verbosity . gitInvocation
757
783
pijul' = getProgramInvocationOutput verbosity . gitInvocation
784
+
785
+ vcsTestDriverHg :: Verbosity -> VCS ConfiguredProgram
786
+ -> FilePath -> VCSTestDriver
787
+ vcsTestDriverHg verbosity vcs repoRoot =
788
+ VCSTestDriver {
789
+ vcsVCS = vcs
790
+
791
+ , vcsRepoRoot = repoRoot
792
+
793
+ , vcsIgnoreFiles = Set. empty
794
+
795
+ , vcsInit =
796
+ hg $ [" init" ] ++ verboseArg
797
+
798
+ , vcsAddFile = \ _ filename ->
799
+ hg [" add" , filename]
800
+
801
+ , vcsCommitChanges = \ _state -> do
802
+ hg
$ [
" --user='A <[email protected] >'"
803
+ , " commit" , " --message=a patch"
804
+ ] ++ verboseArg
805
+ commit <- hg' [" log" , " --template='{node}\\ n' -l1" ]
806
+ let commit' = takeWhile (not . isSpace) commit
807
+ return (Just commit')
808
+
809
+ , vcsTagState = \ _ tagname ->
810
+ hg [" tag" , " --force" , tagname]
811
+
812
+ , vcsSwitchBranch = \ RepoState {allBranches} branchname -> do
813
+ unless (branchname `Map.member` allBranches) $
814
+ hg [" branch" , branchname]
815
+ hg $ [" checkout" , branchname] ++ verboseArg
816
+
817
+ , vcsCheckoutTag = Left $ \ tagname ->
818
+ hg $ [" checkout" , " --rev" , tagname] ++ verboseArg
819
+ }
820
+ where
821
+ hgInvocation args = (programInvocation (vcsProgram vcs) args) {
822
+ progInvokeCwd = Just repoRoot
823
+ }
824
+ hg = runProgramInvocation verbosity . hgInvocation
825
+ hg' = getProgramInvocationOutput verbosity . hgInvocation
826
+ verboseArg = [ " --quiet" | verbosity < Verbosity. normal ]
0 commit comments