Name

svk copy — Copy a file or directory in a working copy or in a depot.

Synopsis

svk copy src [DST]

Description

Copy a file or directory in a working copy or in the repository. src and DST can each be either a working copy (WC) path or a depot path. In addition src can also be a URL:

WC -> WC

Copy and schedule an item for addition (with history).

WC -> DEPOTPATH

Immediately commit a copy of WC to DEPOTPATH.

Warning

Although svk supports having mixed revision working copies, for example by backreving certain files or directories with a svk update --revision, creating a copy of such a mixed revision working copy using this form of the svk copy command will not create a mixed revision tag or branch. Instead it creates a tag or branch which is a copy of the same revision that the WC path specified is at without regard to the revisions of any subdirectories or files.

DEPOTPATH

If the current directory is inside a working copy, check out DEPOTPATH into the current directory, and schedule it for addition. Otherwise prompt for a destination depot path to copy to.

DEPOTPATH -> WC

Check out DEPOTPATH into WC, and schedule it for addition.

DEPOTPATH -> DEPOTPATH

Complete in depot copy. This is usually used to branch and tag.

URL

Interactively sets up a mirror of URL if you do not have one already. After the optional setup of the mirror, creates a local copy of the mirror in DEPOTPATH, finally checks out that local branch in a new working copy using the basename of the local copy. See svk mirror for more information on valid URL values.

URL -> PATH

Interactively sets up a mirror of URL if you do not have one already. After the optional setup of the mirror, prompts for a DEPOTPATH to create a local copy of the mirror in, finally checks out that local branch in a new working copy called PATH.

URL -> DEPOTPATH

Interactively sets up a mirror of URL if you do not have one already. After the optional setup of the mirror, creates a local copy of the mirror in DEPOTPATH.

Note

You can only copy files within a single depot. SVK does not support cross-depot copying.

Tip

It is possible to copy files from one mirrored repository to another, if both mirrors live inside the same depot. This allows you to copy with history between different mirrored repositories.

Alternate Names

cp

Changes

Depot if destination is a DEPOT or source is a URL.

Working copy if destination is a WC path.

Creates a working copy if source is a URL.

Accesses Depot

If source or destination is in the depot, or if needed to look up the source revision number.

Accesses Mirrored Repository

If destination is in the depot at a mirrored path or if the source is a URL which isn't yet being mirrored.

Switches

--revision (-r) REV[@]
--parent (-p)
--quiet (-q)
--message (-m)
--file (-F)
--template
--encoding ENC
--patch (-P) NAME
--sign (-S)
--check-only (-C)
--direct

Examples

Copy an item within your working copy (just schedules the copy—nothing goes into the depot until you commit):

$ svk copy foo.txt bar.txt
A   bar.txt
$ svk status
A   bar.txt

Copy an item in your working copy to a PATH in the depot (an immediate commit, so you must supply a commit message):

$ svk copy --message "Remote copy." near.txt //test/far-away.txt
Committed revision 8.

Copy an item from the depot to your working copy (just schedules the copy—nothing goes into the depot until you commit):

Tip

This is the recommended way to resurrect a dead file in your depot!

$ svk copy //test/far-away near-here
A   near-here

And finally, copying between two DEPOTPATHS:

$ svk copy --message "remote copy." //test/far-away //test/over-there
Committed revision 9.

Tip

This is the easiest way to “tag” a revision in your depot—just svk copy that revision (usually HEAD) into your tags directory.

$ svk copy --message "tag tree" //test/trunk //test/tags/0.6.32-prerelease
Committed revision 12.

And don't worry if you forgot to tag—you can always specify an older revision and tag anytime:

$ svk copy --revision 11 --message "Forgot to tag at rev 11" //test/trunk //test/tags/0.6.32-prerelease
Committed revision 13.