drop: Suggest using git annex move when numcopies prevents dropping a file.

This commit is contained in:
Joey Hess 2013-01-09 18:53:59 -04:00
parent 1bc49b7158
commit 2e11a6013b
5 changed files with 14 additions and 5 deletions

View file

@ -133,6 +133,7 @@ notEnoughCopies key need have skip bad = do
" necessary copies"
Remote.showTriedRemotes bad
Remote.showLocations key (have++skip)
"Rather than dropping this file, try using: git annex move"
hint
return False
where

View file

@ -48,18 +48,20 @@ getKeyFile key file dest = dispatch =<< Remote.keyPossibilities key
where
dispatch [] = do
showNote "not available"
Remote.showLocations key []
showlocs
return False
dispatch remotes = trycopy remotes remotes
trycopy full [] = do
Remote.showTriedRemotes full
Remote.showLocations key []
showlocs
return False
trycopy full (r:rs) =
ifM (probablyPresent r)
( docopy r (trycopy full rs)
, trycopy full rs
)
showlocs = Remote.showLocations key [] $
"No other repository is known to contain the file."
-- This check is to avoid an ugly message if a remote is a
-- drive that is not mounted.
probablyPresent r

View file

@ -199,8 +199,8 @@ keyPossibilities' key trusted = do
return (sort validremotes, validtrusteduuids)
{- Displays known locations of a key. -}
showLocations :: Key -> [UUID] -> Annex ()
showLocations key exclude = do
showLocations :: Key -> [UUID] -> String -> Annex ()
showLocations key exclude nolocmsg = do
u <- getUUID
uuids <- keyLocations key
untrusteduuids <- trustGet UnTrusted
@ -211,7 +211,7 @@ showLocations key exclude = do
showLongNote $ message ppuuidswanted ppuuidsskipped
where
filteruuids l x = filter (`notElem` x) l
message [] [] = "No other repository is known to contain the file."
message [] [] = nolocmsg
message rs [] = "Try making some of these repositories available:\n" ++ rs
message [] us = "Also these untrusted repositories may contain the file:\n" ++ us
message rs us = message rs [] ++ message [] us

1
debian/changelog vendored
View file

@ -3,6 +3,7 @@ git-annex (3.20130108) UNRELEASED; urgency=low
* fsck: Better checking of file content in direct mode.
* Special remotes now all rollback storage of keys that get modified
during the transfer, which can happen in direct mode.
* drop: Suggest using git annex move when numcopies prevents dropping a file.
-- Joey Hess <joeyh@debian.org> Tue, 08 Jan 2013 12:37:38 -0400

View file

@ -62,3 +62,8 @@ Please provide any additional information below.
------------------------------------------------------------------
You can also reach me at ``jason@jasonwoof.com``
> [[done]]; the confusing message has been improved.
>
> BTW, you can use `git annex move` to ensure a file is on another repo and
> drop it locally. --[[Joey]]