summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-18 21:02:27 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-18 21:09:25 -0400
commitd8cc840cc7fd9d543486b7a86426eb4bc444b5aa (patch)
treea524b4d7ff9c24e0839beec5546e4a4a40cf7166
parent935f5ed55b1ed9a218955fdd34cb40db3b1c9425 (diff)
fixed vpop
-rw-r--r--Command/VCycle.hs1
-rw-r--r--Command/VPop.hs7
-rw-r--r--Logs/View.hs12
3 files changed, 15 insertions, 5 deletions
diff --git a/Command/VCycle.hs b/Command/VCycle.hs
index c1bee30b6..b41e099a4 100644
--- a/Command/VCycle.hs
+++ b/Command/VCycle.hs
@@ -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
diff --git a/Command/VPop.hs b/Command/VPop.hs
index 52c2b7f0c..e62c2414a 100644
--- a/Command/VPop.hs
+++ b/Command/VPop.hs
@@ -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
diff --git a/Logs/View.hs b/Logs/View.hs
index 9739992ae..cb1e33125 100644
--- a/Logs/View.hs
+++ b/Logs/View.hs
@@ -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