diff options
author | Joey Hess <joey@kitenet.net> | 2014-02-19 01:09:17 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-02-19 01:19:57 -0400 |
commit | 51c12a76ef54affaf9428232fde4f2c3e30e7488 (patch) | |
tree | 4cb2699e2b410260e383d3bf6da14d502aa0d0dc /Annex | |
parent | b5b5ead4b28fd08100bcac9cb9482263bac3a64e (diff) |
remove Read instance for Ref
Removed instance, got it all to build using fromRef. (With a few things
that really need to show something using a ref for debugging stubbed out.)
Then added back Read instance, and made Logs.View use it for serialization.
This changes the view log format.
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Branch.hs | 16 | ||||
-rw-r--r-- | Annex/Direct.hs | 6 | ||||
-rw-r--r-- | Annex/TaggedPush.hs | 6 | ||||
-rw-r--r-- | Annex/View.hs | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs index fe505a048..94c4c029c 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -58,11 +58,11 @@ name = Git.Ref "git-annex" {- Fully qualified name of the branch. -} fullname :: Git.Ref -fullname = Git.Ref $ "refs/heads/" ++ show name +fullname = Git.Ref $ "refs/heads/" ++ fromRef name {- Branch's name in origin. -} originname :: Git.Ref -originname = Git.Ref $ "origin/" ++ show name +originname = Git.Ref $ "origin/" ++ fromRef name {- Does origin/git-annex exist? -} hasOrigin :: Annex Bool @@ -87,8 +87,8 @@ getBranch = maybe (hasOrigin >>= go >>= use) return =<< branchsha where go True = do inRepo $ Git.Command.run - [Param "branch", Param $ show name, Param $ show originname] - fromMaybe (error $ "failed to create " ++ show name) + [Param "branch", Param $ fromRef name, Param $ fromRef originname] + fromMaybe (error $ "failed to create " ++ fromRef name) <$> branchsha go False = withIndex' True $ inRepo $ Git.Branch.commitAlways "branch created" fullname [] @@ -154,7 +154,7 @@ updateTo pairs = do then "update" else "merging " ++ unwords (map Git.Ref.describe branches) ++ - " into " ++ show name + " into " ++ fromRef name localtransitions <- parseTransitionsStrictly "local" <$> getLocal transitionsLog unless (null branches) $ do @@ -291,7 +291,7 @@ files = do branchFiles :: Annex [FilePath] branchFiles = withIndex $ inRepo $ Git.Command.pipeNullSplitZombie [ Params "ls-tree --name-only -r -z" - , Param $ show fullname + , Param $ fromRef fullname ] {- Populates the branch's index file with the current branch contents. @@ -368,7 +368,7 @@ needUpdateIndex branchref = do setIndexSha :: Git.Ref -> Annex () setIndexSha ref = do f <- fromRepo gitAnnexIndexStatus - liftIO $ writeFile f $ show ref ++ "\n" + liftIO $ writeFile f $ fromRef ref ++ "\n" setAnnexFilePerm f {- Stages the journal into the index and returns an action that will @@ -442,7 +442,7 @@ ignoreRefs rs = do let s = S.unions [old, S.fromList rs] f <- fromRepo gitAnnexIgnoredRefs replaceFile f $ \tmp -> liftIO $ writeFile tmp $ - unlines $ map show $ S.elems s + unlines $ map fromRef $ S.elems s getIgnoredRefs :: Annex (S.Set Git.Ref) getIgnoredRefs = S.fromList . mapMaybe Git.Sha.extractSha . lines <$> content diff --git a/Annex/Direct.hs b/Annex/Direct.hs index 495ce0d60..4a23fcc6c 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -286,18 +286,18 @@ setDirect wantdirect = do - this way things that show HEAD (eg shell prompts) will - hopefully show just "master". -} directBranch :: Ref -> Ref -directBranch orighead = case split "/" $ show orighead of +directBranch orighead = case split "/" $ fromRef orighead of ("refs":"heads":"annex":"direct":_) -> orighead ("refs":"heads":rest) -> Ref $ "refs/heads/annex/direct/" ++ intercalate "/" rest - _ -> Ref $ "refs/heads/" ++ show (Git.Ref.base orighead) + _ -> Ref $ "refs/heads/" ++ fromRef (Git.Ref.base orighead) {- Converts a directBranch back to the original branch. - - Any other ref is left unchanged. -} fromDirectBranch :: Ref -> Ref -fromDirectBranch directhead = case split "/" $ show directhead of +fromDirectBranch directhead = case split "/" $ fromRef directhead of ("refs":"heads":"annex":"direct":rest) -> Ref $ "refs/heads/" ++ intercalate "/" rest _ -> directhead diff --git a/Annex/TaggedPush.hs b/Annex/TaggedPush.hs index 039dc0e17..35fdf333c 100644 --- a/Annex/TaggedPush.hs +++ b/Annex/TaggedPush.hs @@ -35,11 +35,11 @@ toTaggedBranch u info b = Git.Ref $ intercalate "/" $ catMaybes [ Just "refs/synced" , Just $ fromUUID u , toB64 <$> info - , Just $ show $ Git.Ref.base b + , Just $ Git.fromRef $ Git.Ref.base b ] fromTaggedBranch :: Git.Branch -> Maybe (UUID, Maybe String) -fromTaggedBranch b = case split "/" $ show b of +fromTaggedBranch b = case split "/" $ Git.fromRef b of ("refs":"synced":u:info:_base) -> Just (toUUID u, fromB64Maybe info) ("refs":"synced":u:_base) -> @@ -58,4 +58,4 @@ taggedPush u info branch remote = Git.Command.runBool , Param $ refspec branch ] where - refspec b = show b ++ ":" ++ show (toTaggedBranch u info b) + refspec b = Git.fromRef b ++ ":" ++ Git.fromRef (toTaggedBranch u info b) diff --git a/Annex/View.hs b/Annex/View.hs index d407ce4c9..cc2aad5b9 100644 --- a/Annex/View.hs +++ b/Annex/View.hs @@ -310,7 +310,7 @@ genViewBranch :: View -> Annex () -> Annex Git.Branch genViewBranch view a = withIndex $ do a let branch = branchView view - void $ inRepo $ Git.Branch.commit True (show branch) branch [] + void $ inRepo $ Git.Branch.commit True (fromRef branch) branch [] return branch {- Runs an action using the view index file. |