migrate: Use current filename when generating new key, for backends where the filename affects the key name.
This commit is contained in:
parent
267eeb995b
commit
5256a6b011
2 changed files with 12 additions and 2 deletions
|
@ -8,9 +8,10 @@
|
||||||
module Command.Migrate where
|
module Command.Migrate where
|
||||||
|
|
||||||
import Control.Monad.State (liftIO)
|
import Control.Monad.State (liftIO)
|
||||||
import Control.Monad (unless)
|
import Control.Monad (unless, when)
|
||||||
import System.Posix.Files
|
import System.Posix.Files
|
||||||
import System.Directory
|
import System.Directory
|
||||||
|
import System.FilePath
|
||||||
|
|
||||||
import Command
|
import Command
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
@ -52,7 +53,10 @@ perform file oldkey newbackend = do
|
||||||
-- The old backend's key is not dropped from it, because there may
|
-- The old backend's key is not dropped from it, because there may
|
||||||
-- be other files still pointing at that key.
|
-- be other files still pointing at that key.
|
||||||
let src = gitAnnexLocation g oldkey
|
let src = gitAnnexLocation g oldkey
|
||||||
stored <- Backend.storeFileKey src $ Just newbackend
|
let tmpfile = gitAnnexTmpDir g </> takeFileName file
|
||||||
|
liftIO $ createLink src tmpfile
|
||||||
|
stored <- Backend.storeFileKey tmpfile $ Just newbackend
|
||||||
|
liftIO $ cleantmp tmpfile
|
||||||
case stored of
|
case stored of
|
||||||
Nothing -> stop
|
Nothing -> stop
|
||||||
Just (newkey, _) -> do
|
Just (newkey, _) -> do
|
||||||
|
@ -69,3 +73,7 @@ perform file oldkey newbackend = do
|
||||||
liftIO $ removeFile file
|
liftIO $ removeFile file
|
||||||
next $ Command.Add.cleanup file newkey
|
next $ Command.Add.cleanup file newkey
|
||||||
else stop
|
else stop
|
||||||
|
where
|
||||||
|
cleantmp t = do
|
||||||
|
exists <- doesFileExist t
|
||||||
|
when exists $ removeFile t
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -7,6 +7,8 @@ git-annex (0.20110504) UNRELEASED; urgency=low
|
||||||
buckets, and allow x-archive-* headers to be specified in initremote to
|
buckets, and allow x-archive-* headers to be specified in initremote to
|
||||||
set item metadata.
|
set item metadata.
|
||||||
* Added filename extension preserving variant backends SHA1E, SHA256E, etc.
|
* Added filename extension preserving variant backends SHA1E, SHA256E, etc.
|
||||||
|
* migrate: Use current filename when generating new key, for backends
|
||||||
|
where the filename affects the key name.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Fri, 06 May 2011 15:20:38 -0400
|
-- Joey Hess <joeyh@debian.org> Fri, 06 May 2011 15:20:38 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue