import: --deduplicate and --cleanduplicates now output the keys corresponding to duplicated files they process.
This commit is contained in:
parent
6b55974723
commit
42bbed7ce5
3 changed files with 13 additions and 6 deletions
|
@ -15,6 +15,7 @@ import Utility.CopyFile
|
||||||
import Backend
|
import Backend
|
||||||
import Remote
|
import Remote
|
||||||
import Types.KeySource
|
import Types.KeySource
|
||||||
|
import Types.Key
|
||||||
|
|
||||||
cmd :: [Command]
|
cmd :: [Command]
|
||||||
cmd = [withOptions opts $ notBareRepo $ command "import" paramPaths seek
|
cmd = [withOptions opts $ notBareRepo $ command "import" paramPaths seek
|
||||||
|
@ -72,8 +73,8 @@ start mode (srcfile, destfile) =
|
||||||
, stop
|
, stop
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
deletedup = do
|
deletedup k = do
|
||||||
showNote "duplicate"
|
showNote $ "duplicate of " ++ key2file k
|
||||||
liftIO $ removeFile srcfile
|
liftIO $ removeFile srcfile
|
||||||
next $ return True
|
next $ return True
|
||||||
importfile = do
|
importfile = do
|
||||||
|
@ -95,10 +96,12 @@ start mode (srcfile, destfile) =
|
||||||
backend <- chooseBackend destfile
|
backend <- chooseBackend destfile
|
||||||
let ks = KeySource srcfile srcfile Nothing
|
let ks = KeySource srcfile srcfile Nothing
|
||||||
v <- genKey ks backend
|
v <- genKey ks backend
|
||||||
isdup <- case v of
|
case v of
|
||||||
Just (k, _) -> not . null <$> keyLocations k
|
Just (k, _) -> ifM (not . null <$> keyLocations k)
|
||||||
_ -> return False
|
( return (maybe Nothing (\a -> Just (a k)) dupa)
|
||||||
return $ if isdup then dupa else notdupa
|
, return notdupa
|
||||||
|
)
|
||||||
|
_ -> return notdupa
|
||||||
pickaction = case mode of
|
pickaction = case mode of
|
||||||
DeDuplicate -> checkdup (Just deletedup) (Just importfile)
|
DeDuplicate -> checkdup (Just deletedup) (Just importfile)
|
||||||
CleanDuplicates -> checkdup (Just deletedup) Nothing
|
CleanDuplicates -> checkdup (Just deletedup) Nothing
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -18,6 +18,8 @@ git-annex (5.20150328) UNRELEASED; urgency=medium
|
||||||
filename with filenames that the special remote suggests. Also,
|
filename with filenames that the special remote suggests. Also,
|
||||||
don't allow adding the url if the special remote says it contains
|
don't allow adding the url if the special remote says it contains
|
||||||
multiple files.
|
multiple files.
|
||||||
|
* import: --deduplicate and --cleanduplicates now output the keys
|
||||||
|
corresponding to duplicated files they process.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 27 Mar 2015 16:04:43 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 27 Mar 2015 16:04:43 -0400
|
||||||
|
|
||||||
|
|
|
@ -18,3 +18,5 @@ Then you could use
|
||||||
to find out where it is already.
|
to find out where it is already.
|
||||||
|
|
||||||
Not sure if that is the nicest layout.. (or what it might break).
|
Not sure if that is the nicest layout.. (or what it might break).
|
||||||
|
|
||||||
|
> [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue