svn 常用命令
-
-
-
-
-
-
-
help (?, h): Describe the usage of this program or its subcommands.
usage: help [SUBCOMMAND...]
checkout (co): Check out a working copy from a repository.
usage: checkout URL[@REV]... [PATH]
If specified, REV determines in which revision the URL is first
looked up.
If PATH is omitted, the basename of the URL will be used as
the destination. If multiple URLs are given each will be checked
out into a sub-directory of PATH, with the name of the sub-directory
being the basename of the URL.
If --force is used, unversioned obstructing paths in the working
copy destination do not automatically cause the check out to fail.
If the obstructing path is the same type (file or directory) as the
corresponding path in the repository it becomes versioned but its
contents are left 'as-is' in the working copy. This means that an
obstructing directory's unversioned children may also obstruct and
become versioned. For files, any content differences between the
obstruction and the repository are treated like a local modification
to the working copy. All properties from the repository are applied
to the obstructing path.
See also 'svn help update' for a list of possible characters
reporting the action taken.
info: Display information about a local or remote item.
usage: info [TARGET[@REV]...]
Print information about each TARGET (default: '.').
TARGET may be either a working-copy path or URL. If specified, REV
determines in which revision the target is first looked up.
diff(di): Display the differences between two revisions or paths.
usage: 1. diff [-c M | -r N[:M]] [TARGET[@REV]...]
2. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \
[PATH...]
3. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]
1. Display the changes made to TARGETs as they are seen in REV between
two revisions. TARGETs may be all working copy paths or all URLs.
If TARGETs are working copy paths, N defaults to BASE and M to the
working copy; if URLs, N must be specified and M defaults to HEAD.
The '-c M' option is equivalent to '-r N:M' where N = M-1.
Using '-c -M' does the reverse: '-r M:N' where N = M-1.
2. Display the differences between OLD-TGT as it was seen in OLDREV and
NEW-TGT as it was seen in NEWREV. PATHs, if given, are relative to
OLD-TGT and NEW-TGT and restrict the output to differences for those
paths. OLD-TGT and NEW-TGT may be working copy paths or URL[@REV].
NEW-TGT defaults to OLD-TGT if not specified. -r N makes OLDREV default
to N, -r N:M makes OLDREV default to N and NEWREV default to M.
3. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]'
Use just 'svn diff' to display local modifications in a working copy.
update (up): Bring changes from the repository into the working copy.
usage: update [PATH...]
If no revision is given, bring working copy up-to-date with HEAD rev.
Else synchronize working copy to revision given by -r.
For each updated item a line will start with a character reporting the
action taken. These characters have the following meaning:
A Added
D Deleted
U Updated
C Conflict
G Merged
E Existed
A character in the first column signifies an update to the actual file,
while updates to the file's properties are shown in the second column.
A 'B' in the third column signifies that the lock for the file has
been broken or stolen.
If --force is used, unversioned obstructing paths in the working
copy do not automatically cause a failure if the update attempts to
add the same path. If the obstructing path is the same type (file
or directory) as the corresponding path in the repository it becomes
versioned but its contents are left 'as-is' in the working copy.
This means that an obstructing directory's unversioned children may
also obstruct and become versioned. For files, any content differences
between the obstruction and the repository are treated like a local
modification to the working copy. All properties from the repository
are applied to the obstructing path. Obstructing paths are reported
in the first column with code 'E'.
Use the --set-depth option to set a new working copy depth on the
targets of this operation.
status (stat, st): Print the status of working copy files and directories.
usage: status [PATH...]
With no args, print only locally modified items (no network access).
With -q, print only summary information about locally modified items.
With -u, add working revision and server out-of-date information.
With -v, print full revision information on every item.
The first seven columns in the output are each one character wide:
First column: Says if item was added, deleted, or otherwise changed
' ' no modifications
'A' Added
'C' Conflicted
'D' Deleted
'I' Ignored
'M' Modified
'R' Replaced
'X' an unversioned directory created by an externals definition
'?' item is not under version control
'!' item is missing (removed by non-svn command) or incomplete
'~' versioned item obstructed by some item of a different kind
Second column: Modifications of a file's or directory's properties
' ' no modifications
'C' Conflicted
'M' Modified
Third column: Whether the working copy directory is locked
' ' not locked
'L' locked
Fourth column: Scheduled commit will contain addition-with-history
' ' no history scheduled with commit
'+' history scheduled with commit
Fifth column: Whether the item is switched or a file external
' ' normal
'S' the item has a Switched URL relative to the parent
'X' a versioned file created by an eXternals definition
Sixth column: Repository lock token
(without -u)
' ' no lock token
'K' lock token present
(with -u)
' ' not locked in repository, no lock token
'K' locked in repository, lock toKen present
'O' locked in repository, lock token in some Other working copy
'T' locked in repository, lock token present but sTolen
'B' not locked in repository, lock token present but Broken
Seventh column: Whether the item is the victim of a tree conflict
' ' normal
'C' tree-Conflicted
If the item is a tree conflict victim, an additional line is printed
after the item's status line, explaining the nature of the conflict.
The out-of-date information appears in the ninth column (with -u):
'*' a newer revision exists on the server
' ' the working copy is up to date
Remaining fields are variable width and delimited by spaces:
The working revision (with -u or -v)
The last committed revision and last committed author (with -v)
The working copy path is always the final field, so it can
include spaces.
Example output:
svn status wc
M wc/bar.c
A + wc/qax.c
svn status -u wc
M 965 wc/bar.c
* 965 wc/foo.c
A + 965 wc/qax.c
Status against revision: 981
svn status --show-updates --verbose wc
M 965 938 kfogel wc/bar.c
* 965 922 sussman wc/foo.c
A + 965 687 joe wc/qax.c
965 687 joe wc/zig.c
Status against revision: 981
svn status
M wc/bar.c
! C wc/qaz.c
> local missing, incoming edit upon update
D wc/qax.c
revert: Restore pristine working copy file (undo most local edits).
usage: revert PATH...
Note: this subcommand does not require network access, and resolves
any conflicted states. However, it does not restore removed directories.
commit (ci): Send changes from your working copy to the repository.
usage: commit [PATH...]
A log message must be provided, but it can be empty. If it is not
given by a --message or --file option, an editor will be started.
If any targets are (or contain) locked items, those will be
unlocked after a successful commit.