add forget command
Works, more or less. --dead is not implemented, and so far a new branch is made, but keys no longer present anywhere are not scrubbed. git annex sync fails to push the synced/git-annex branch after a forget, because it's not a fast-forward of the existing synced branch. Could be fixed by making git-annex sync use assistant-style sync branches.
This commit is contained in:
parent
fcd5c167ef
commit
4a915cd3cd
5 changed files with 51 additions and 5 deletions
41
Command/Forget.hs
Normal file
41
Command/Forget.hs
Normal file
|
@ -0,0 +1,41 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2013 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Command.Forget where
|
||||
|
||||
import Common.Annex
|
||||
import Command
|
||||
import qualified Annex.Branch as Branch
|
||||
import Logs.Transitions
|
||||
import qualified Annex
|
||||
|
||||
import Data.Time.Clock.POSIX
|
||||
|
||||
def :: [Command]
|
||||
def = [command "forget" paramNothing seek
|
||||
SectionMaintenance "prune git-annex branch history"]
|
||||
|
||||
seek :: [CommandSeek]
|
||||
seek = [withNothing start]
|
||||
|
||||
start :: CommandStart
|
||||
start = do
|
||||
showStart "forget" "git-annex"
|
||||
next $ perform =<< Annex.getState Annex.force
|
||||
|
||||
perform :: Bool -> CommandPerform
|
||||
perform True = do
|
||||
now <- liftIO getPOSIXTime
|
||||
let ts = addTransition now ForgetGitHistory noTransitions
|
||||
recordTransitions Branch.change ts
|
||||
-- get branch committed before contining with the transition
|
||||
Branch.update
|
||||
void $ Branch.performTransitions ts True
|
||||
next $ return True
|
||||
perform False = do
|
||||
showLongNote "To forget git-annex branch history, you must specify --force. This deletes metadata!"
|
||||
stop
|
Loading…
Add table
Add a link
Reference in a new issue