svn copy — 拷贝工作拷贝的一个文件或目录到版本库。
Copy one or more files in a working copy or in the
repository. When copying multiple sources, they will be
added as children of DST, which must be a directory.
SRC
and
DST
can each be either a
working copy (WC) path or URL:
拷贝并且预定一个添加的项目(包含历史)。
将WC或URL的拷贝立即提交。
Check out URL into WC and schedule it for addition.
完全的服务器端拷贝,通常用在分支和标签。
When copying multiple sources, they will be added as
children of DST
, which must be
a directory.
If no peg revision (i.e.,
@REV
) is supplied, by default,
the BASE
revision will be used for
files copied from the working copy, while the
HEAD
revision will be used for files
copied from a URL.
你只可以在单个版本库中拷贝文件,Subversion还不支持跨版本库的拷贝。
Yes, if source or destination is in the repository, or if needed to look up the source revision number.
--message (-m) TEXT --file (-F) FILE --revision (-r) REV --quiet (-q) --parents --with-revprop ARG --username USER --password PASS --no-auth-cache --non-interactive --force-log --editor-cmd EDITOR --encoding ENC --config-dir DIR
拷贝工作拷贝的一个项目(只是预定要拷贝—在提交之前不会影响版本库):
$ svn copy foo.txt bar.txt A bar.txt $ svn status A + bar.txt
Copy several files in a working copy into a subdirectory:
$ svn cp bat.c baz.c qux.c src A src/bat.c A src/baz.c A src/qux.c
Copy revision 8 of bat.c
into your
working copy under a different name:
$ svn cp bat.c ya-old-bat.c A ya-old-bat.c
拷贝你的工作拷贝的一个项目到版本库的URL(直接的提交,所以需要提供一个提交信息):
$ svn copy near.txt file:///var/svn/repos/test/far-away.txt -m "Remote copy." Committed revision 8.
拷贝版本库的一个项目到你的工作拷贝(只是预定要拷贝—在提交之前不会影响版本库):
$ svn copy file:///var/svn/repos/test/far-away near-here A near-here
这是恢复死掉文件的推荐方式!
And finally, copy between two URLs:
$ svn copy file:///var/svn/repos/test/far-away file:///var/svn/repos/test/over-there -m "remote copy." Committed revision 9.
$ svn copy file:///var/svn/repos/test/trunk \ file:///var/svn/repos/test/tags/0.6.32-prerelease -m "tag tree" Committed revision 12.
这是在版本库里作“标签”最简单的方法—svn copy那个修订版本(通常是HEAD
)到你的tags目录。
不要担心忘记作标签—你可以在以后任何时候给一个旧版本作标签:
$ svn copy -r 11 file:///var/svn/repos/test/trunk \ file:///var/svn/repos/test/tags/0.6.32-prerelease -m "Forgot to tag at rev 11" Committed revision 13.