copy --auto
Only does copy when numcopies is not yet satisfied.
This commit is contained in:
parent
7b90cb72fc
commit
a0d3a343b5
3 changed files with 16 additions and 4 deletions
|
@ -9,11 +9,20 @@ module Command.Copy where
|
|||
|
||||
import Command
|
||||
import qualified Command.Move
|
||||
import Utility
|
||||
|
||||
command :: [Command]
|
||||
command = [repoCommand "copy" paramPaths seek
|
||||
"copy content of files to/from another repository"]
|
||||
|
||||
-- A copy is just a move that does not delete the source file.
|
||||
seek :: [CommandSeek]
|
||||
seek = [withFilesInGit $ Command.Move.start False]
|
||||
seek = [withNumCopies start]
|
||||
|
||||
-- A copy is just a move that does not delete the source file.
|
||||
-- However, --auto mode avoids unnecessary copies.
|
||||
start :: CommandStartAttrFile
|
||||
start (file, attr) = isAnnexed file $ \(key, _) ->
|
||||
autoCopies key (<) numcopies $
|
||||
Command.Move.start False file
|
||||
where
|
||||
numcopies = readMaybe attr
|
||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -5,8 +5,8 @@ git-annex (3.20110907) UNRELEASED; urgency=low
|
|||
* Fix build without S3.
|
||||
* addurl: Always use whole url as destination filename, rather than
|
||||
only its file component.
|
||||
* get, drop: Added --auto option, which decides whether to get/drop
|
||||
content as needed to work toward the configured numcopies.
|
||||
* get, drop, copy: Added --auto option, which decides whether
|
||||
to get/drop content as needed to work toward the configured numcopies.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Tue, 06 Sep 2011 16:59:15 -0400
|
||||
|
||||
|
|
|
@ -36,3 +36,6 @@ work toward having two copies of your files.
|
|||
whereis other_file (2 copies)
|
||||
0c443de8-e644-11df-acbf-f7cd7ca6210d -- laptop
|
||||
7570b02e-15e9-11e0-adf0-9f3f94cb2eaa -- backup drive
|
||||
|
||||
The --auto option can also be used with the copy command,
|
||||
again this lets git-annex decide whether to actually copy content.
|
||||
|
|
Loading…
Reference in a new issue