summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/RmUrl.hs30
-rw-r--r--GitAnnex.hs2
-rw-r--r--Logs/Web.hs5
-rw-r--r--debian/changelog1
-rw-r--r--doc/git-annex.mdwn4
5 files changed, 41 insertions, 1 deletions
diff --git a/Command/RmUrl.hs b/Command/RmUrl.hs
new file mode 100644
index 000000000..d3ded38a3
--- /dev/null
+++ b/Command/RmUrl.hs
@@ -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
diff --git a/GitAnnex.hs b/GitAnnex.hs
index b78493dfc..7dbaca3b5 100644
--- a/GitAnnex.hs
+++ b/GitAnnex.hs
@@ -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
diff --git a/Logs/Web.hs b/Logs/Web.hs
index 7cfad8648..0ed537a8e 100644
--- a/Logs/Web.hs
+++ b/Logs/Web.hs
@@ -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
diff --git a/debian/changelog b/debian/changelog
index a6bd997ee..f744f09e0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 1c2247654..05ca4474a 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -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