unlock: Better error handling; continue past files that are not available or cannot be unlocked due to disk space, and try all specified files.
This commit is contained in:
parent
f69a9274f9
commit
2fd9518f72
2 changed files with 12 additions and 6 deletions
|
@ -26,15 +26,17 @@ seek = withFilesInGit $ whenAnnexed start
|
||||||
{- The unlock subcommand replaces the symlink with a copy of the file's
|
{- The unlock subcommand replaces the symlink with a copy of the file's
|
||||||
- content. -}
|
- content. -}
|
||||||
start :: FilePath -> Key -> CommandStart
|
start :: FilePath -> Key -> CommandStart
|
||||||
start file key = do
|
start file key = stopUnless (inAnnex key) $ do
|
||||||
showStart "unlock" file
|
showStart "unlock" file
|
||||||
next $ perform file key
|
ifM (checkDiskSpace Nothing key 0)
|
||||||
|
( next $ perform file key
|
||||||
|
, do
|
||||||
|
warning "not enough disk space to copy file"
|
||||||
|
next $ next $ return False
|
||||||
|
)
|
||||||
|
|
||||||
perform :: FilePath -> Key -> CommandPerform
|
perform :: FilePath -> Key -> CommandPerform
|
||||||
perform dest key = do
|
perform dest key = do
|
||||||
unlessM (inAnnex key) $ error "content not present"
|
|
||||||
unlessM (checkDiskSpace Nothing key 0) $ error "cannot unlock"
|
|
||||||
|
|
||||||
src <- calcRepo $ gitAnnexLocation key
|
src <- calcRepo $ gitAnnexLocation key
|
||||||
tmpdest <- fromRepo $ gitAnnexTmpObjectLocation key
|
tmpdest <- fromRepo $ gitAnnexTmpObjectLocation key
|
||||||
liftIO $ createDirectoryIfMissing True (parentDir tmpdest)
|
liftIO $ createDirectoryIfMissing True (parentDir tmpdest)
|
||||||
|
@ -46,5 +48,7 @@ perform dest key = do
|
||||||
moveFile tmpdest dest
|
moveFile tmpdest dest
|
||||||
thawContent dest
|
thawContent dest
|
||||||
next $ return True
|
next $ return True
|
||||||
, error "copy failed!"
|
, do
|
||||||
|
warning "copy failed!"
|
||||||
|
next $ return False
|
||||||
)
|
)
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -25,6 +25,8 @@ git-annex (5.20140718) UNRELEASED; urgency=medium
|
||||||
* Dropping an object from a bup special remote now deletes the git branch
|
* Dropping an object from a bup special remote now deletes the git branch
|
||||||
for the object, although of course the object's content cannot be deleted
|
for the object, although of course the object's content cannot be deleted
|
||||||
due to the nature of bup.
|
due to the nature of bup.
|
||||||
|
* unlock: Better error handling; continue past files that are not available
|
||||||
|
or cannot be unlocked due to disk space, and try all specified files.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2014 14:41:26 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2014 14:41:26 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue