Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Collins-Sussman B.Version control with Subversion 1.1.pdf
Скачиваний:
9
Добавлен:
23.08.2013
Размер:
1.53 Mб
Скачать

Subversion Complete Reference

Name

svn copy -- Copy a file or directory in a working copy or in the repository.

svn copy

Synopsis

svn copy SRC DST

Description

Copy a file in a working copy or in the repository. SRC and DST can each be either a working copy (WC) path or URL:

WC -> WC

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

WC -> URL

Immediately commit a copy of WC to URL.

URL -> WC

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

URL -> URL

Complete server-side copy. This is usually used to branch and tag.

Note

You can only copy files within a single repository. Subversion does not support cross-repository copying.

Alternate Names

cp

Changes

Repository if destination is a URL.

Working copy if destination is a WC path.

Accesses Repository

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

Switches

--message (-m) TEXT --file (-F) FILE --revision (-r) REV --quiet (-q) --username USER --password PASS --no-auth-cache

175

Subversion Complete Reference

--non-interactive --force-log --editor-cmd EDITOR --encoding ENC --config-dir DIR

Examples

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

$ svn copy foo.txt bar.txt A bar.txt

$ svn status A + bar.txt

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

$ svn copy near.txt file:///tmp/repos/test/far-away.txt -m "Remote copy."

Committed revision 8.

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

Tip

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

$ svn copy file:///tmp/repos/test/far-away near-here A near-here

And finally, copying between two URLs:

$ svn copy file:///tmp/repos/test/far-away file:///tmp/repos/test/over-there -m "remote co

Committed revision 9.

Tip

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

$ svn copy file:///tmp/repos/test/trunk file:///tmp/repos/test/tags/0.6.32-prerelease -m "

Committed revision 12.

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

176

Subversion Complete Reference

$ svn copy -r 11 file:///tmp/repos/test/trunk file:///tmp/repos/test/tags/0.6.32-prereleas

Committed revision 13.

177

Subversion Complete Reference

Name

svn delete -- Delete an item from a working copy or the repository.

svn delete

Synopsis

svn delete PATH...

svn delete URL...

Description

Items specified by PATH are scheduled for deletion upon the next commit. Files (and directories that have not been committed) are immediately removed from the working copy. The command will not remove any unversioned or modified items; use the --force switch to override this behavior.

Items specified by URL are deleted from the repository via an immediate commit. Multiple URLs are committed atomically.

Alternate Names

del, remove, rm

Changes

Working copy if operating on files, Repository if operating on URLs

Accesses Repository

Only if operating on URLs

Switches

--force --force-log --message (-m) TEXT --file (-F) FILE --quiet (-q) --targets FILENAME --username USER --password PASS --no-auth-cache --non-interactive --editor-cmd EDITOR --encoding ENC --config-dir DIR

Examples

Using svn to delete a file from your working copy merely schedules it to be deleted. When you commit, the file is deleted in the repository.

178

Subversion Complete Reference

$ svn delete myfile D myfile

$ svn commit -m "Deleted file 'myfile'." Deleting myfile

Transmitting file data . Committed revision 14.

Deleting a URL, however, is immediate, so you have to supply a log message:

$ svn delete -m "Deleting file 'yourfile'" file:///tmp/repos/test/yourfile

Committed revision 15.

Here's an example of how to force deletion of a file that has local mods:

$ svn delete over-there

svn: Attempting restricted operation for modified resource svn: Use --force to override this restriction

svn: 'over-there' has local modifications

$ svn delete --force over-there D over-there

179

Соседние файлы в предмете Электротехника