b0VIM 7.3zjN‡íxjoeygnu~joey/src/git-annex.new/Branch.hs 3210#"! Utpÿˆÿÿÿÿn‰þÿÿÿp÷gad+_ˆÚר¥rnm]TKE<3+ Ø´…lTB1 Ü Û Â ­ v g Z J 9 8 # " Ú Ë ¸ · z Y X 9 $   ¿ ¬ V O = ö õ É « ‡ † ? ; ÷ ° ƒ  a   Û»žuUA0 îß¿„WVN@65åäÆš™u*)þãÐŒ‹oZG  ܸ±¢}U54ü龪š”R9¾¡s_^ g <- Annex.gitRepocommit message = whenM stageJournalFiles $ docommit :: String -> Annex (){- Stages the journal, and commits staged changes to the branch. -} liftIO $ Git.commit g "branch created" fullname [] else withIndex' True $ then liftIO $ Git.run g "branch" [Param name, Param originname] if e e <- hasOrigin g <- Annex.gitRepocreate = unlessM (refExists fullname) $ docreate :: Annex (){- Creates the branch, if it does not already exist. -} | otherwise = return Nothing return $ Just $ cachedContent state | cachedFile state == Just file = handle state wheregetCache file = getState >>= handlegetCache :: FilePath -> Annex (Maybe String) setState state { cachedFile = Nothing, cachedContent = "" } state <- getStateinvalidateCache = doinvalidateCache :: Annex () setState state { cachedFile = Just file, cachedContent = content } state <- getStatesetCache file content = dosetCache :: FilePath -> String -> Annex ()setState state = Annex.changeState $ \s -> s { Annex.branchstate = state }setState :: BranchState -> Annex ()getState = Annex.getState Annex.branchstategetState :: Annex BranchStatewithIndexUpdate a = update >> withIndex awithIndexUpdate :: Annex a -> Annex a return r liftIO reset r <- a liftIO $ unless bootstrapping $ genIndex g liftIO $ createDirectoryIfMissing True $ takeDirectory f unless bootstrapping $ create unless e $ do e <- liftIO $ doesFileExist f reset <- liftIO $ Git.useIndex f let f = index g g <- Annex.gitRepowithIndex' bootstrapping a = dowithIndex' :: Bool -> Annex a -> Annex awithIndex = withIndex' FalsewithIndex :: Annex a -> Annex a{- Runs an action using the branch's index file. -}genIndex g = Git.UnionMerge.ls_tree g fullname >>= Git.UnionMerge.update_index ggenIndex :: Git.Repo -> IO () -} - and merge in changes from other branches. - the index is used to build up changes to be commited to the branch, - Usually, this is only done when the index doesn't yet exist, and - {- Populates the branch's index file with the current branch contents.index g = gitAnnexDir g "index"index :: Git.Repo -> FilePath{- A separate index file for the branch. -} | otherwise = s | prefix `isPrefixOf` s = drop (length prefix) s remove prefix s whereshortref = remove "refs/heads/" . remove "refs/remotes/"shortref :: GitRef -> String - consumptiom. -}{- Converts a fully qualified git ref into a short version for humanoriginname = "origin/" ++ nameoriginname :: GitRef{- Branch's name in origin. -}fullname = "refs/heads/" ++ namefullname :: GitRef{- Fully qualified name of the branch. -}name = "git-annex"name :: GitRef{- Name of the branch that is used to store git-annex's information. -}type GitRef = Stringimport Locationsimport Messagesimport Typesimport Utilityimport qualified Anneximport qualified Git.UnionMergeimport qualified Gitimport Types.BranchStateimport qualified Data.ByteString.Char8 as Bimport System.IO.Binaryimport System.IOimport Data.Listimport Data.Maybeimport System.Cmd.Utilsimport Data.String.Utilsimport System.Directoryimport System.FilePathimport Control.Monad.State (liftIO)import Control.Monad (when, unless, liftM)) where name hasOrigin, refExists, files, commit, change, get, update, create,module Branch ( -} - Licensed under the GNU GPL version 3 or higher. - - Copyright 2011 Joey Hess -{- management of the git-annex branchad·ÏÏÎfileJournal = replace "//" "_" . replace "_" "/"