fixed vpop

This commit is contained in:
Joey Hess 2014-02-18 21:02:27 -04:00
parent 72c118152f
commit 2bf338f443
3 changed files with 15 additions and 5 deletions

View file

@ -27,6 +27,7 @@ start = go =<< currentView
where
go Nothing = error "Not in a view."
go (Just v) = do
showStart "vcycle" ""
let v' = v { viewComponents = vcycle [] (viewComponents v) }
if v == v'
then do

View file

@ -28,10 +28,11 @@ start = go =<< currentView
where
go Nothing = error "Not in a view."
go (Just v) = do
vs <- dropWhile (/= v) . filter (sameparentbranch v)
<$> recentViews
showStart "vpop" ""
removeView v
vs <- filter (sameparentbranch v) <$> recentViews
case vs of
(_v:oldv:_) -> next $ next $
(oldv:_) -> next $ next $ do
checkoutViewBranch oldv (return . branchView)
_ -> next $ next $
inRepo $ Git.Command.runBool

View file

@ -12,6 +12,7 @@
module Logs.View (
currentView,
setView,
removeView,
recentViews,
branchView,
prop_branchView_legal,
@ -40,9 +41,16 @@ parseLog s =
setView :: View -> Annex ()
setView v = do
l <- take 99 . filter (/= v) <$> recentViews
old <- take 99 . filter (/= v) <$> recentViews
writeViews (v : old)
writeViews :: [View] -> Annex ()
writeViews l = do
f <- fromRepo gitAnnexViewLog
liftIO $ viaTmp writeFile f $ unlines $ map showLog (v : l)
liftIO $ viaTmp writeFile f $ unlines $ map showLog l
removeView :: View -> Annex ()
removeView v = writeViews =<< filter (/= v) <$> recentViews
recentViews :: Annex [View]
recentViews = do