improve display when lockcontent fails
/dev/null stderr; ssh is still able to display a password prompt despite this Show some messages so the user knows it's locking a remote, and knows if that locking failed.
This commit is contained in:
parent
3b89d5a20c
commit
6145f905e0
3 changed files with 40 additions and 22 deletions
|
@ -364,7 +364,7 @@ dropKey r key
|
||||||
lockKey :: Remote -> Key -> (VerifiedCopy -> Annex r) -> Annex r
|
lockKey :: Remote -> Key -> (VerifiedCopy -> Annex r) -> Annex r
|
||||||
lockKey r key callback
|
lockKey r key callback
|
||||||
| not $ Git.repoIsUrl (repo r) =
|
| not $ Git.repoIsUrl (repo r) =
|
||||||
guardUsable (repo r) cantlock $ do
|
guardUsable (repo r) failedlock $ do
|
||||||
inorigrepo <- Annex.makeRunner
|
inorigrepo <- Annex.makeRunner
|
||||||
-- Lock content from perspective of remote,
|
-- Lock content from perspective of remote,
|
||||||
-- and then run the callback in the original
|
-- and then run the callback in the original
|
||||||
|
@ -372,13 +372,17 @@ lockKey r key callback
|
||||||
onLocal r $ Annex.Content.lockContentShared key $
|
onLocal r $ Annex.Content.lockContentShared key $
|
||||||
liftIO . inorigrepo . callback
|
liftIO . inorigrepo . callback
|
||||||
| Git.repoIsSsh (repo r) = do
|
| Git.repoIsSsh (repo r) = do
|
||||||
|
showLocking r
|
||||||
Just (cmd, params) <- Ssh.git_annex_shell (repo r) "lockcontent"
|
Just (cmd, params) <- Ssh.git_annex_shell (repo r) "lockcontent"
|
||||||
[Param $ key2file key] []
|
[Param $ key2file key] []
|
||||||
(Just hin, Just hout, Nothing, p) <- liftIO $ createProcess $
|
(Just hin, Just hout, Nothing, p) <- liftIO $
|
||||||
(proc cmd (toCommand params))
|
withFile devNull WriteMode $ \nullh ->
|
||||||
{ std_in = CreatePipe
|
createProcess $
|
||||||
, std_out = CreatePipe
|
(proc cmd (toCommand params))
|
||||||
}
|
{ std_in = CreatePipe
|
||||||
|
, std_out = CreatePipe
|
||||||
|
, std_err = UseHandle nullh
|
||||||
|
}
|
||||||
-- Wait for either the process to exit, or for it to
|
-- Wait for either the process to exit, or for it to
|
||||||
-- indicate the content is locked.
|
-- indicate the content is locked.
|
||||||
v <- liftIO $ race
|
v <- liftIO $ race
|
||||||
|
@ -393,21 +397,23 @@ lockKey r key callback
|
||||||
let checkexited = not . isJust <$> getProcessExitCode p
|
let checkexited = not . isJust <$> getProcessExitCode p
|
||||||
case v of
|
case v of
|
||||||
Left _exited -> do
|
Left _exited -> do
|
||||||
|
showNote "lockcontent failed"
|
||||||
liftIO $ do
|
liftIO $ do
|
||||||
hClose hin
|
hClose hin
|
||||||
hClose hout
|
hClose hout
|
||||||
cantlock
|
failedlock
|
||||||
Right l
|
Right l
|
||||||
| l == Ssh.contentLockedMarker -> bracket_
|
| l == Ssh.contentLockedMarker -> bracket_
|
||||||
noop
|
noop
|
||||||
signaldone
|
signaldone
|
||||||
(withVerifiedCopy LockedCopy r checkexited callback)
|
(withVerifiedCopy LockedCopy r checkexited callback)
|
||||||
| otherwise -> do
|
| otherwise -> do
|
||||||
|
showNote "lockcontent failed"
|
||||||
signaldone
|
signaldone
|
||||||
cantlock
|
failedlock
|
||||||
| otherwise = cantlock
|
| otherwise = failedlock
|
||||||
where
|
where
|
||||||
cantlock = error "can't lock content"
|
failedlock = error "can't lock content"
|
||||||
|
|
||||||
{- Tries to copy a key's content from a remote's annex to a file. -}
|
{- Tries to copy a key's content from a remote's annex to a file. -}
|
||||||
copyFromRemote :: Remote -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex (Bool, Verification)
|
copyFromRemote :: Remote -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex (Bool, Verification)
|
||||||
|
|
|
@ -13,20 +13,23 @@ import Common.Annex
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import qualified Types.Remote as Remote
|
import qualified Types.Remote as Remote
|
||||||
|
|
||||||
class Checkable a where
|
class Describable a where
|
||||||
descCheckable :: a -> String
|
describe :: a -> String
|
||||||
|
|
||||||
instance Checkable Git.Repo where
|
instance Describable Git.Repo where
|
||||||
descCheckable = Git.repoDescribe
|
describe = Git.repoDescribe
|
||||||
|
|
||||||
instance Checkable (Remote.RemoteA a) where
|
instance Describable (Remote.RemoteA a) where
|
||||||
descCheckable = Remote.name
|
describe = Remote.name
|
||||||
|
|
||||||
instance Checkable String where
|
instance Describable String where
|
||||||
descCheckable = id
|
describe = id
|
||||||
|
|
||||||
showChecking :: Checkable a => a -> Annex ()
|
showChecking :: Describable a => a -> Annex ()
|
||||||
showChecking v = showAction $ "checking " ++ descCheckable v
|
showChecking v = showAction $ "checking " ++ describe v
|
||||||
|
|
||||||
cantCheck :: Checkable a => a -> e
|
cantCheck :: Describable a => a -> e
|
||||||
cantCheck v = error $ "unable to check " ++ descCheckable v
|
cantCheck v = error $ "unable to check " ++ describe v
|
||||||
|
|
||||||
|
showLocking :: Describable a => a -> Annex ()
|
||||||
|
showLocking v = showAction $ "locking " ++ describe v
|
||||||
|
|
9
debian/changelog
vendored
9
debian/changelog
vendored
|
@ -5,6 +5,15 @@ git-annex (5.20150931) UNRELEASED; urgency=medium
|
||||||
all copies of its content being lost.
|
all copies of its content being lost.
|
||||||
* git-annex-shell: Added lockcontent command, to prevent dropping of
|
* git-annex-shell: Added lockcontent command, to prevent dropping of
|
||||||
a key's content. This is necessary due to the above bugfix.
|
a key's content. This is necessary due to the above bugfix.
|
||||||
|
* In some cases, the above bugfix changes what git-annex allows to be dropped:
|
||||||
|
- When a file is present in several special remotes,
|
||||||
|
but not in any accessible git repositories, dropping it from one of
|
||||||
|
the special remotes will now fail. Instead, the file has to be
|
||||||
|
moved from one of the special remotes to the git repository, and can
|
||||||
|
then safely be dropped from the git repository.
|
||||||
|
- If a git remote has too old a version of git-annex-shell installed,
|
||||||
|
git-annex won't trust it to hold onto a copy of a file when dropping
|
||||||
|
that file from some other remote.
|
||||||
* Do verification of checksums of annex objects downloaded from remotes.
|
* Do verification of checksums of annex objects downloaded from remotes.
|
||||||
* When annex objects are received into git repositories from other git
|
* When annex objects are received into git repositories from other git
|
||||||
repos, their checksums are verified then too.
|
repos, their checksums are verified then too.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue