rmurl: New command, removes one of the recorded urls for a file.

This commit is contained in:
Joey Hess 2013-04-22 17:18:53 -04:00
parent 7e23ce6cef
commit 6be815a30c
5 changed files with 41 additions and 1 deletions

30
Command/RmUrl.hs Normal file
View file

@ -0,0 +1,30 @@
{- git-annex command
-
- Copyright 2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.RmUrl where
import Common.Annex
import Command
import Logs.Web
def :: [Command]
def = [notBareRepo $
command "rmurl" (paramPair paramFile paramUrl) seek
SectionCommon "record file is not available at url"]
seek :: [CommandSeek]
seek = [withPairs start]
start :: (FilePath, String) -> CommandStart
start (file, url) = flip whenAnnexed file $ \_ (key, _) -> do
showStart "rmurl" file
next $ next $ cleanup url key
cleanup :: String -> Key -> CommandCleanup
cleanup url key = do
setUrlMissing key url
return True

View file

@ -53,6 +53,7 @@ import qualified Command.Ungroup
import qualified Command.Vicfg
import qualified Command.Sync
import qualified Command.AddUrl
import qualified Command.RmUrl
import qualified Command.Import
import qualified Command.Map
import qualified Command.Direct
@ -85,6 +86,7 @@ cmds = concat
, Command.Lock.def
, Command.Sync.def
, Command.AddUrl.def
, Command.RmUrl.def
, Command.Import.def
, Command.Init.def
, Command.Describe.def

View file

@ -54,4 +54,7 @@ setUrlPresent key url = do
logChange key webUUID InfoPresent
setUrlMissing :: Key -> URLString -> Annex ()
setUrlMissing key url = addLog (urlLog key) =<< logNow InfoMissing url
setUrlMissing key url = do
addLog (urlLog key) =<< logNow InfoMissing url
whenM (null <$> getUrls key) $
logChange key webUUID InfoMissing

1
debian/changelog vendored
View file

@ -20,6 +20,7 @@ git-annex (4.20130418) UNRELEASED; urgency=low
or git-annex watch daemon is running.
* assistant: When built with git before 1.8.0, use `git remote rm`
to delete a remote. Newer git uses `git remote remove`.
* rmurl: New command, removes one of the recorded urls for a file.
-- Joey Hess <joeyh@debian.org> Thu, 18 Apr 2013 16:22:48 -0400

View file

@ -168,6 +168,10 @@ subdirectories).
alternate locations from which the file can be downloaded. In this mode,
addurl can be used both to add new files, or to add urls to existing files.
* rmurl file url
Record that the file is no longer available at the url.
* import [path ...]
Moves files from somewhere outside the git working copy, and adds them to