fixed vpop
This commit is contained in:
parent
72c118152f
commit
2bf338f443
3 changed files with 15 additions and 5 deletions
|
@ -27,6 +27,7 @@ start = go =<< currentView
|
||||||
where
|
where
|
||||||
go Nothing = error "Not in a view."
|
go Nothing = error "Not in a view."
|
||||||
go (Just v) = do
|
go (Just v) = do
|
||||||
|
showStart "vcycle" ""
|
||||||
let v' = v { viewComponents = vcycle [] (viewComponents v) }
|
let v' = v { viewComponents = vcycle [] (viewComponents v) }
|
||||||
if v == v'
|
if v == v'
|
||||||
then do
|
then do
|
||||||
|
|
|
@ -28,10 +28,11 @@ start = go =<< currentView
|
||||||
where
|
where
|
||||||
go Nothing = error "Not in a view."
|
go Nothing = error "Not in a view."
|
||||||
go (Just v) = do
|
go (Just v) = do
|
||||||
vs <- dropWhile (/= v) . filter (sameparentbranch v)
|
showStart "vpop" ""
|
||||||
<$> recentViews
|
removeView v
|
||||||
|
vs <- filter (sameparentbranch v) <$> recentViews
|
||||||
case vs of
|
case vs of
|
||||||
(_v:oldv:_) -> next $ next $
|
(oldv:_) -> next $ next $ do
|
||||||
checkoutViewBranch oldv (return . branchView)
|
checkoutViewBranch oldv (return . branchView)
|
||||||
_ -> next $ next $
|
_ -> next $ next $
|
||||||
inRepo $ Git.Command.runBool
|
inRepo $ Git.Command.runBool
|
||||||
|
|
12
Logs/View.hs
12
Logs/View.hs
|
@ -12,6 +12,7 @@
|
||||||
module Logs.View (
|
module Logs.View (
|
||||||
currentView,
|
currentView,
|
||||||
setView,
|
setView,
|
||||||
|
removeView,
|
||||||
recentViews,
|
recentViews,
|
||||||
branchView,
|
branchView,
|
||||||
prop_branchView_legal,
|
prop_branchView_legal,
|
||||||
|
@ -40,9 +41,16 @@ parseLog s =
|
||||||
|
|
||||||
setView :: View -> Annex ()
|
setView :: View -> Annex ()
|
||||||
setView v = do
|
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
|
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 :: Annex [View]
|
||||||
recentViews = do
|
recentViews = do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue