faster local-local dropping

Dropping a key from a local remote ran git-annex-shell unnecessarily.

Now git-annex-shell is never used when acting on a local remote.
This commit is contained in:
Joey Hess 2012-01-28 15:54:42 -04:00
parent b81d662cbf
commit 775958b4dc

View file

@ -20,6 +20,7 @@ import qualified Git.Command
import qualified Git.Config
import qualified Git.Construct
import qualified Annex
import Logs.Presence
import Annex.UUID
import qualified Annex.Content
import qualified Annex.BranchState
@ -192,6 +193,14 @@ keyUrls r key = map tourl (annexLocations key)
dropKey :: Git.Repo -> Key -> Annex Bool
dropKey r key
| not $ Git.repoIsUrl r = liftIO $ onLocal r $ do
ensureInitialized
whenM (Annex.Content.inAnnex key) $ do
Annex.Content.lockContent key $
Annex.Content.removeAnnex key
Annex.Content.logStatus key InfoMissing
Annex.Content.saveState True
return True
| Git.repoIsHttp r = error "dropping from http repo not supported"
| otherwise = onRemote r (boolSystem, False) "dropkey"
[ Params "--quiet --force"