diff options
author | Joey Hess <joey@kitenet.net> | 2011-01-11 23:02:21 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-01-11 23:02:59 -0400 |
commit | 611018e4bd1a79becdbb58846f8faa7464a57a01 (patch) | |
tree | 9bd5b1eb5ee09cbd5b8a9e8ff5682a871b208327 /test.hs | |
parent | e18a4d566b4f205c8a60ddf79ce02ba023d34984 (diff) |
I thought that reversion a migration might fail. It didn't. :)
Diffstat (limited to 'test.hs')
-rw-r--r-- | test.hs | 33 |
1 files changed, 25 insertions, 8 deletions
@@ -33,6 +33,7 @@ import qualified UUID import qualified Remotes import qualified Core import qualified Backend.SHA1 +import qualified Backend.WORM main :: IO () main = do @@ -327,18 +328,34 @@ test_migrate = "git-annex migrate" ~: TestList [t False, t True] annexed_present sha1annexedfile if usegitattributes then do - writeFile ".gitattributes" "* annex.backend=SHA1" - git_annex "migrate" ["-q", sha1annexedfile] @? "migrate to same backend failed" - git_annex "migrate" ["-q", annexedfile] @? "migrate to different backend failed" + writeFile ".gitattributes" $ "* annex.backend=SHA1" + git_annex "migrate" ["-q", sha1annexedfile] + @? "migrate sha1annexedfile failed" + git_annex "migrate" ["-q", annexedfile] + @? "migrate annexedfile failed" else do - git_annex "migrate" [sha1annexedfile, "--backend=SHA1"] @? "migrate to same backend failed" - git_annex "migrate" [annexedfile, "--backend=SHA1"] @? "migrate to different backend failed" + git_annex "migrate" ["-q", sha1annexedfile, "--backend", "SHA1"] + @? "migrate sha1annexedfile failed" + git_annex "migrate" ["-q", annexedfile, "--backend", "SHA1"] + @? "migrate annexedfile failed" annexed_present annexedfile annexed_present sha1annexedfile - backend annexedfile Backend.SHA1.backend - backend sha1annexedfile Backend.SHA1.backend + checkbackend annexedfile Backend.SHA1.backend + checkbackend sha1annexedfile Backend.SHA1.backend + + -- check that reversing a migration works + writeFile ".gitattributes" $ "* annex.backend=WORM" + git_annex "migrate" ["-q", sha1annexedfile] + @? "migrate sha1annexedfile failed" + git_annex "migrate" ["-q", annexedfile] + @? "migrate annexedfile failed" + annexed_present annexedfile + annexed_present sha1annexedfile + checkbackend annexedfile Backend.WORM.backend + checkbackend sha1annexedfile Backend.WORM.backend + where - backend file expected = do + checkbackend file expected = do r <- annexeval $ Backend.lookupFile file let b = snd $ fromJust r assertEqual ("backend for " ++ file) expected b |