map: --fast disables use of dot to display map

Generally useful, and allows the test suite to test it.
This commit is contained in:
Joey Hess 2011-12-20 16:31:59 -04:00
parent 9308a60bb2
commit 1c28237e0c
4 changed files with 25 additions and 6 deletions

View file

@ -16,6 +16,7 @@ import qualified Git
import qualified Git.Url import qualified Git.Url
import qualified Git.Config import qualified Git.Config
import qualified Git.Construct import qualified Git.Construct
import qualified Annex
import Annex.UUID import Annex.UUID
import Logs.UUID import Logs.UUID
import Logs.Trust import Logs.Trust
@ -40,10 +41,14 @@ start = do
trusted <- trustGet Trusted trusted <- trustGet Trusted
liftIO $ writeFile file (drawMap rs umap trusted) liftIO $ writeFile file (drawMap rs umap trusted)
showLongNote $ "running: dot -Tx11 " ++ file next $ next $ do
showOutput fast <- Annex.getState Annex.fast
r <- liftIO $ boolSystem "dot" [Param "-Tx11", File file] if fast
next $ next $ return r then return True
else do
showLongNote $ "running: dot -Tx11 " ++ file
showOutput
liftIO $ boolSystem "dot" [Param "-Tx11", File file]
where where
file = "map.dot" file = "map.dot"

1
debian/changelog vendored
View file

@ -4,6 +4,7 @@ git-annex (3.20111212) UNRELEASED; urgency=low
* reinject: Add a sanity check for using an annexed file as the source file. * reinject: Add a sanity check for using an annexed file as the source file.
* Properly handle multiline git config values. * Properly handle multiline git config values.
* Fix the hook special remote, which bitrotted a while ago. * Fix the hook special remote, which bitrotted a while ago.
* map: --fast disables use of dot to display map
-- Joey Hess <joeyh@debian.org> Mon, 12 Dec 2011 01:57:49 -0400 -- Joey Hess <joeyh@debian.org> Mon, 12 Dec 2011 01:57:49 -0400

View file

@ -268,9 +268,10 @@ subdirectories).
Helps you keep track of your repositories, and the connections between them, Helps you keep track of your repositories, and the connections between them,
by going out and looking at all the ones it can get to, and generating a by going out and looking at all the ones it can get to, and generating a
Graphviz file displaying it all. If the `dot` command is available, it is Graphviz file displaying it all. If the `dot` command is available, it is
used to display the file to your screen (using x11 backend). used to display the file to your screen (using x11 backend). (To disable
this display, specify --fast)
Note that this only connects to hosts that the host it's run on can This command only connects to hosts that the host it's run on can
directly connect to. It does not try to tunnel through intermediate hosts. directly connect to. It does not try to tunnel through intermediate hosts.
So it might not show all connections between the repositories in the network. So it might not show all connections between the repositories in the network.

12
test.hs
View file

@ -108,6 +108,7 @@ blackbox = TestLabel "blackbox" $ TestList
, test_merge , test_merge
, test_status , test_status
, test_sync , test_sync
, test_map
, test_hook_remote , test_hook_remote
, test_directory_remote , test_directory_remote
, test_rsync_remote , test_rsync_remote
@ -526,6 +527,17 @@ test_sync :: Test
test_sync = "git-annex sync" ~: intmpclonerepo $ do test_sync = "git-annex sync" ~: intmpclonerepo $ do
git_annex "sync" [] @? "sync failed" git_annex "sync" [] @? "sync failed"
test_map :: Test
test_map = "git-annex map" ~: intmpclonerepo $ do
-- set descriptions, that will be looked for in the map
git_annex "describe" [".", "this repo"] @? "describe 1 failed"
git_annex "describe" ["origin", "origin repo"] @? "describe 2 failed"
-- --fast avoids it running graphviz, not a build dependency
git_annex "map" ["--fast"] @? "map failed"
doesFileExist "map.dot" @? "map.dot not generated"
c <- readFile "map.dot"
not ("this repo" `isInfixOf` c && "origin repo" `isInfixOf` c) @? "map.dot bad content"
test_hook_remote :: Test test_hook_remote :: Test
test_hook_remote = "git-annex hook remote" ~: intmpclonerepo $ do test_hook_remote = "git-annex hook remote" ~: intmpclonerepo $ do
git_annex "initremote" (words "foo type=hook encryption=none hooktype=foo") @? "initremote failed" git_annex "initremote" (words "foo type=hook encryption=none hooktype=foo") @? "initremote failed"