Section 14.4. The Subversion Command Line Client: svn


14.4. The Subversion Command Line Client: svn

The syntax for the Subversion command line client, svn, is:

The options and subcommand may be provided in any order.

14.4.1. svn Options

While Subversion has different options for its subcommands, all options are globalthat is, each option is guaranteed to mean the same thing regardless of the subcommand you use it with. For example, --verbose (-v) always means verbose output, regardless of the subcommand you use it with.


--auto-props

Enable auto-props, overriding the enable-auto-props directive in the config file.


--config-dir dir

Read configuration information from the specified directory instead of the default location (.subversion in the user's home directory).


--diff-cmd cmd

Use cmd as the external program to show differences between files. By default, svn diff uses Subversion's internal diff engine, which provides unified diffs by default. To use an external diff program, use --diff-cmd. You can pass options to the diff program with the --extensions option (discussed later in this list).


--diff3-cmd cmd

Use cmd as the external program to merge files.


--dry-run

Pretend to run a command, but make no actual changeseither on disk or in the repository.


--editor-cmd cmd

Use cmd as the program for editing a log message or a property value. If not set, Subversion checks the environment variables SVN_EDITOR, VISUAL, and EDITOR, in that order, for the name of the editor to use.


--encoding enc

Use enc as the encoding for the commit message. The default encoding is your operating system's native locale, and you should specify the encoding if your commit message is in any other encoding.


--extensions args, -x args

Pass args to an external diff command when providing differences between files. To pass multiple arguments, enclose all of them in quotes (for example, svn diff --diff-cmd /usr/bin/diff -x "-b -E"). This option can be used only if you also pass the --diff-cmd option.


--file filename, -F filename

Use the contents of filename for the specified subcommand.


--force

Force a particular command or operation to run. There are some operations that Subversion prevents you from doing in normal usage, but you can pass this option to tell Subversion that you know what you're doing, as well as the possible repercussions of doing it, so do it anyway. Use with caution.


--force-log

Force a suspicious parameter passed to the --message (-m) or --file (-F) options to be accepted as valid. By default, Subversion produces an error if parameters to these options look like they might instead be targets of the subcommand. For example, if you pass a versioned file's path to the --file (-F) option, Subversion assumes you've made a mistake, that the path was instead intended as the target of the operation, and that you simply failed to provide some otherunversioned--file as the source of your log message. To assert your intent and override these types of errors, pass the --force-log option to commands that accept log messages.


--help, -h, -?

If used with one or more subcommands, show the built-in help text for each subcommand. If used alone, display the general client help text.


--ignore-ancestry

Ignore ancestry when calculating differences (i.e., rely on path contents alone).


--incremental

Print output in a format suitable for concatenation.


--message message, -m message

Use message as the commit message. For example:

     $ svn commit -m "They don't make Sunday." 


--new arg

Use arg as the newer target when producing a diff.


--no-auth-cache

Do not cache authentication information (e.g., username and password) in the Subversion administrative directories.


--no-auto-props

Disable auto-props, overriding the enable-auto-props directive in the config file.


--no-diff-deleted

Do not print differences for deleted files. The default behavior when you remove a file is for svn diff to print the same differences that you would see if you had left the file but removed all the content.


--no-ignore

Show files in the status listing that would normally be omitted because they match a pattern in the svn:ignore property.


--non-interactive

In the case of an authentication failure, or insufficient credentials, do not prompt for credentials (e.g., username or password). This is useful if you're running Subversion inside of an automated script where it's better to have Subversion fail instead of trying to prompt for more information.


--non-recursive, -N

Stop a subcommand from recursing into subdirectories. Most subcommands recurse by default, but some subcommandsusually those that have the potential to remove or undo your local modificationsdo not.


--notice-ancestry

Pay attention to ancestry when calculating differences.


--old arg

Use arg as the older target when producing a diff.


--password pass

Use pass as the password for authentication on the command line; otherwise, if it is needed, Subversion prompts you for it.


--quiet, -q

Print only essential information while performing an operation.


--recursive, -R

Make a subcommand recurse into subdirectories. Most subcommands recurse by default.


--relocate from to [path ...]

Used with the svn switch subcommand to change the location of the repository that your working copy references. This is useful if the location of your repository changes and you have an existing working copy that you'd like to continue to use. See svn switch in the svn Subcommands section, later in this chapter, for an example.


--revision rev, -r rev

Use rev as the revision (or range of revisions) for a particular operation. You can provide revision numbers, revision keywords, or dates (in curly braces) as arguments to the revision option. To provide a range of revisions, provide two revisions separated by a colon. For example:

     $ svn log -r 1729     $ svn log -r 1729:HEAD     $ svn log -r 1729:1744     $ svn log -r {2001-12-04}:{2002-02-17}     $ svn log -r 1729:{2002-02-17} 

The acceptable revision keywords for --revision are:


BASE

The original, unmodified version of the working copy. This keyword cannot refer to a URL.


COMMITTED

The last revision, before or at BASE, at which an item actually changed. This keyword cannot refer to a URL.


HEAD

The most recent revision in the repository.


PREV

The revision just before that at which an item changed. Equivalent to COMMITED - 1. This keyword cannot refer to a URL.


Revision Date

A date specification enclosed in curly braces, { and }, such as {2002-02-17}, {15:30}, {"2002-02-17 15:30"}, {2002-02-17T15:30}, or {20020217T1530-0500}. See Version Control with Subversion (O'Reilly) for full details.


--revprop

Operate on a revision property instead of a Subversion property specific to a file or directory. This option requires that you also pass a revision with the --revision (-r) option.


--show-updates, -u

Display information about which files in your working copy are out of date. This doesn't actually update any of your files; it just shows you which files will be updated if you run svn update.


--stop-on-copy

Cause a Subversion subcommand that is traversing the history of a versioned resource to stop harvesting that historical information when it encounters a copythat is, a location in history where that resource was copied from another location in the repository.


--strict

Use strict semantics, a notion that is rather vague unless talking about specific subcommands. See Version Control with Subversion (O'Reilly) for more information.


--targets filename

Retrieve the list of files to operate on from filename instead of listing all the files on the command line.


--username name

Use name as the username for authentication; otherwise, if it is needed, Subversion prompts you for it.


--verbose, -v

Print out as much information as possible while running any subcommand. This may result in Subversion printing out additional fields, detailed information about every file, or additional information regarding its actions.


--version

Print the client version info. This information not only includes the version number of the client, but also a listing of all repository access modules that the client can use to access a Subversion repository.


--xml

Prints output in XML format.

14.4.2. svn Subcommands

The svn command is the main user interface to Subversion. It works by accepting subcommands with arguments. The general form is:

svn subcommand[options] arguments
add

 svn add path ... 

Add files and directories to your working copy and schedule them for addition to the repository. They will be uploaded and added to the repository on your next commit. If you add something and change your mind before committing, you can unschedule the addition using svn revert.

Alternate names: none

Changes: working copy

Accesses repository: no

Options

--auto-props
--config-dir dir
--no-auto-props
--non-recursive (-N)
--quiet (-q)
--targets filename

Examples

To add a file to your working copy:

     $ svn add foo.c     A         foo.c 

You can add a directory without adding its contents:

     $ svn add --non-recursive otherdir     A         otherdir 

blame

 svn blame target ... 

Show author and revision information inline for the specified files or URLs. Each line of text is annotated at the beginning with the author (username) and the revision number for the last change to that line.

Alternate names: praise, annotate, ann

Changes: nothing

Accesses repository: yes

Options

--config-dir dir
--no-auth-cache
--non-interactive
--password pass
--revision rev, -r rev
--username user
cat

     svn cat target ... 

Output the contents of the specified files or URLs. For listing the contents of directories, see svn list.

Alternate names: none

Changes: nothing

Accesses repository: yes

Options

--config-dir dir
--no-auth-cache
--non-interactive
--password pass
--revision rev, -r rev
--username user

Examples

To view readme.txt in your repository without checking it out:

     $ svn cat http://svn.red-bean.com/repos/test/readme.txt     This is a README file.     You should read this. 

NOTE

If your working copy is out of date (or if you have local modifications) and you want to see the HEAD revision of a file in your working copy, svn cat automatically fetches the HEAD revision when you give it a path:

     $ cat foo.c     This file is in my local working copy     and has changes that I've made.           $ svn cat foo.c     Latest revision fresh from the repository! 

checkout

     svn checkout URL ... [path] 

Check out a working copy from a repository. If path is omitted, the basename of the URL is used as the destination. If multiple URLs are given, each one is checked out into a subdirectory of path, with the name of the subdirectory being the basename of the URL.

Alternate names: co

Changes: creates a working copy

Accesses repository: yes

Options

--config-dir dir
--no-auth-cache
--non-interactive
--non-recursive (-N)
--password pass
--quiet (-q)
--revision rev, -r rev
--username user

Examples

Check out a working copy into a directory called mine:

     $ svn checkout file:///tmp/repos/test mine     A  mine/a     A  mine/b     Checked out revision 2.     $ ls     mine 

If you interrupt a checkout (or something else interrupts your checkout, such as loss of connectivity, etc.), you can restart it either by issuing the identical checkout command again or by updating the incomplete working copy:

     $ svn checkout file:///tmp/repos/test test     A  test/a     A  test/b     ^C     svn: The operation was interrupted     svn: caught SIGINT           $ svn checkout file:///tmp/repos/test test     A  test/c     A  test/d     ^C     svn: The operation was interrupted     svn: caught SIGINT           $ cd test     $ svn update     A  test/e     A  test/f     Updated to revision 3. 

cleanup

     svn cleanup [path ...] 

Recursively clean up the working copy, removing locks and resuming unfinished operations. If you ever get a working-copy-locked error, run this command to remove stale locks and get your working copy into a usable state again.

If, for some reason, an svn update fails due to a problem running an external diff program (e.g., user input or network failure), pass the --diff3-cmd option to allow cleanup to complete any merging with your external diff program. You can also specify any configuration directory with the --config-dir option, but you should need these options extremely infrequently.

Alternate names: none

Changes: working copy

Accesses repository: no

Options:

--config-dir dir
--diff3-cmd cmd
commit

     svn commit [path ...] 

Send changes from your working copy to the repository. If you do not supply a log message with your commit by using either the --file or --message option, svn starts your editor for you to compose a commit message.

NOTE

If you begin a commit and Subversion starts your editor to compose the commit message, you can still abort without committing your changes. To cancel your commit, just quit your editor without saving your commit message and Subversion prompts you to abort the commit, continue with no message, or edit the message again.

Alternate names: ci (short for check innot co, which is short for checkout)

Changes: working copy, repository

Accesses repository: yes

Options

--config-dir dir
--encoding enc
--file file, -F file
--force-log
--message text, -m text
--no-auth-cache
--non-interactive
--non-recursive (-N)
--password pass
--quiet (-q)
--targets filename
--username user

Examples

Commit a simple modification to a file with the commit message on the command line and an implicit target of your current directory (.):

     $ svn commit -m "added howto section."     Sending        a     Transmitting file data .     Committed revision 3. 

To commit a file scheduled for deletion:

     $ svn commit -m "removed file 'c'."     Deleting       c     Committed revision 7. 

copy

     svn copy src dst 

Copy a file in a working copy or in the repository. src and dst can each be either a working-copy (WC) path or a 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

Options

--config-dir dir
--editor-cmd editor
--encoding enc
--file file, -F file
--force-log
--message text, -m text
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--revision rev, -r rev
--username user

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 from the repository to your working copy (just schedules the copy; nothing goes into the repository until you commit):

NOTE

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 copy."     Committed revision 9. 

NOTE

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 "tag tree"     Committed revision 12. 

delete

     svn delete path ...     svn delete URL ... 

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 option 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

Options

--config-dir dir
--editor-cmd editor
--encoding enc
--file file, -F file
--force-log
--force
--message text, -m text
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--targets filename
--username user
diff

     svn diff [-r N[:M]] [--old old-tgt] [--new new-tgt] [path ...]     svn diff -r N:M URL     svn diff [-r N[:M]] URL1[@N] URL2[@M] 

Display the differences between two paths. The three different ways you can use svn diff are:


svn diff [-r N[:M]] [--old old-tgt] [--new new-tgt] [path ...]

Display the differences between old-tgt and new-tgt. If paths are given, they are treated as relative to old-tgt and new-tgt, and the output is restricted to differences in only those paths. old-tgt and new-tgt may be working copy paths or URL[@rev]. old-tgt defaults to the current working directory, and new-tgt defaults to old-tgt. N defaults to BASE or, if old-tgt is a URL, to HEAD. M defaults to the current working version or, if new-tgt is a URL, to HEAD. svn diff -r N sets the revision of old-tgt to N, whereas svn diff -r N:M also sets the revision of new-tgt to M.


svn diff -r N:M URL

A shorthand for svn diff -r N:M --old=URL --new=URL.


svn diff [-r N[:M]] URL1[@N] URL2[@M]

A shorthand for svn diff [-r N[:M]] --old=URL1 --new=URL2.

If target is a URL, then revisions N and M can be given either via the --revision option or by using @ notation as described earlier.

If target is a working copy path, then the --revision option means:


--revision N:M

The server compares target@N and target@M.


--revision N

The client compares target@N against the working copy.


No --revision option

The client compares the base and working copies of target.

If the alternate syntax is used, the server compares URL1 and URL2 at revisions N and M respectively. If either N or M are omitted, a value of HEAD is assumed.

By default, svn diff ignores the ancestry of files and merely compares the contents of the two files being compared. If you use --notice-ancestry, the ancestry of the paths in question is taken into consideration when comparing revisions. (That is, if you run svn diff on two files with identical contents but different ancestry you will see the entire contents of the file as having been removed and added again.)

Alternate names: di

Changes: nothing

Accesses repository: for obtaining differences against anything but the BASE revision in your working copy

Options

--config-dir dir
--diff-cmd cmd
--extensions args, -x args
--new new-target
--no-auth-cache
--no-diff-deleted
--non-interactive
--non-recursive (-N)
--notice-ancestry
--old old-target
--password pass
--revision rev, -r rev
--username user

Examples

Compare BASE and your working copy:

     $ svn diff COMMITTERS     Index: COMMITTERS     =================================================     ==================     --- COMMITTERS  (revision 4404)     +++ COMMITTERS  (working copy)     ... 

See how your working copy's modifications compare against an older revision:

     $ svn diff -r 3900 COMMITTERS     Index: COMMITTERS     =================================================     ==================     --- COMMITTERS  (revision 3900)     +++ COMMITTERS  (working copy)     ... 

Use --diff-cmd cmd and -x to pass arguments directly to the external diff program:

     $ svn diff --diff-cmd /usr/bin/diff -x "-i -b" COMMITTERS     Index: COMMITTERS     =================================================     ==================     0a1,2     > This is a test     > 

export

     svn export [-r rev] URL [path]     svn export path1 path2 

The first form exports a clean directory tree into path from the repository specified by URL, at revision rev if it is givenotherwise at HEAD. If path is omitted, the last component of the URL is used for the local directory name.

The second form exports a clean directory tree from the working copy specified by path1 into path2. All local changes are preserved, but files not under version control are not copied.

Alternate names: none

Changes: local disk

Accesses repository: only if exporting from a URL

Options

--config-dir dir
--force
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--revision rev, -r rev
--username user
help

     svn help [subcommand ...] 

Provide a quick usage summary. With subcommand, provide information about the given subcommand.

Alternate names: ?, h

Changes: nothing

Accesses repository: no

Options

--quiet (-q)
--version
import

     svn import [path] URL 

Recursively commit a copy of path to URL. If path is omitted, . is assumed. Parent directories are created in the repository as necessary.

Alternate names: none

Changes: repository

Accesses repository: yes

Options

--auto-props
--config-dir dir
--editor-cmd editor
--encoding enc
--file file, -F file
--force-log
--message text, -m text
--no-auth-cache
--no-auto-props
--non-interactive
--non-recursive (-N)
--password pass
--quiet (-q)
--username user

Examples

Import the local directory myproj into the root of your repository:

     $ svn import -m "New import" myproj \     > http://svn.red-bean.com/repos/test     Adding         myproj/sample.txt     ...     Transmitting file data .........     Committed revision 16. 

Import the local directory myproj into trunk/vendors in your repository. The directory trunk/vendors need not exist before you import into it; svn import will recursively create directories for you:

     $ svn import -m "New import" myproj \     > http://svn.red-bean.com/repos/test/trunk/vendors/myproj     Adding         myproj/sample.txt     ...     Transmitting file data .........     Committed revision 19. 

After importing data, note that the original tree is not under version control. To start working, you still need to svn checkout a fresh working copy of the tree.

info

     svn info [path ...] 

Print information about paths in your working copy, including:

  • Path

  • Name

  • URL

  • Revision

  • Node kind

  • Last changed author

  • Last changed revision

  • Last changed date

  • Text last updated

  • Properties last updated

  • Checksum

Alternate names: none

Changes: nothing

Accesses repository: no

Options

--config-dir dir
--recursive (-R)
--targets filename
list

     svn list [target ...] 

List each target file and the contents of each target directory as they exist in the repository. If target is a working copy path, the corresponding repository URL is used. The default target is ., meaning the repository URL of the current working-copy directory.

With --verbose, the following fields show the status of the item:

  • Revision number of the last commit

  • Author of the last commit

  • Size (in bytes)

  • Date and time of the last commit

Alternate names: ls

Changes: nothing

Accesses repository: yes

Options

--config-dir dir
--no-auth-cache
--non-interactive
--password pass
--recursive (-R)
--revision rev, -r rev
--username user
--verbose (-v)

Examples

To see what files a repository has without downloading a working copy:

     $ svn list http://svn.red-bean.com/repos/test/support     README.txt     INSTALL     examples/     ... 

Pass the --verbose option for additional information:

     $ svn list --verbose file:///tmp/repos          16 sally         28361 Jan 16 23:18 README.txt          27 sally             0 Jan 18 15:27 INSTALL          24 harry               Jan 18 11:27 examples/ 

log

     svn log [path]     svn log URL [path ...] 

The default target is the path of your current directory. If no arguments are supplied, svn log shows the log messages for all files and directories inside of (and including) the current working directory of your working copy. You can refine the results by specifying a path, one or more revisions, or any combination of the two. The default revision range for a local path is BASE:1.

If you specify a URL alone, the command prints log messages for everything that the URL contains. If you add paths past the URL, only messages for those paths under that URL are printed. The default revision range for a URL is HEAD:1.

With --verbose, svn log also prints all affected paths with each log message. With --quiet, svn log does not print the log message body itself (this is compatible with --verbose).

Each log message is printed just once, even if more than one of the affected paths for that revision were explicitly requested. Logs follow copy history by default. Use --stop-on-copy to disable this behavior, which can be useful for determining branch points.

Alternate names: none

Changes: nothing

Accesses repository: yes

Options

--config-dir dir
--incremental
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--revision rev, -r rev
--stop-on-copy
--targets filename
--username user
--verbose (-v)
--xml

Examples

To see the log messages for all the paths that changed in your working copy, run svn log from the top:

     $ svn log     ------------------------------------------------------------------------     r20 | harry | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003)     | 1 line           Tweak.     ------------------------------------------------------------------------     r17 | sally | 2003-01-16 23:21:19 -0600 (Thu, 16 Jan 2003)     | 2 lines     ... 

If you don't have a working copy handy, you can log a URL:

     $ svn log http://svn.red-bean.com/repos/test/foo.c     ------------------------------------------------------------------------     r32 | sally | 2003-01-13 00:43:13 -0600 (Mon, 13 Jan 2003)     | 1 line           Added defines.     ------------------------------------------------------------------------     r28 | sally | 2003-01-07 21:48:33 -0600 (Tue, 07 Jan 2003)     | 3 lines     ... 

If you run svn log on a specific path and provide a specific revision and get no output at all:

     $ svn log -r 20 http://svn.red-bean.com/untouched.txt     ------------------------------------------------------------------------ 

That just means that the path was not modified in that revision. If you log from the top of the repository, or know the file that changed in that revision, you can specify it explicitly:

     $ svn log -r 20 touched.txt     ------------------------------------------------------------------------     r20 | sally | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003)     | 1 line           Made a change.     ------------------------------------------------------------------------ 

merge

     svn merge sourceURL1[@N] sourceURL2[@M] [wcpath]     svn merge -r N:M source [path] 

In the first form, the source URLs are specified at revisions N and M. These are the two sources to be compared. The revisions default to HEAD if omitted.

In the second form, source can be a URL or working-copy item, in which case the corresponding URL is used. This URL, at revisions N and M, defines the two sources to be compared.

wcpath is the working-copy path that will receive the changes. If wcpath is omitted, a default value of "." is assumed, unless the sources have identical basenames that match a file within ".", in which case, the differences are applied to that file.

Unlike svn diff, this command takes the ancestry of a file into consideration when performing a merge operation. This is very important when you're merging changes from one branch into another and you've renamed a file on one branch but not the other.

Alternate names: none

Changes: working copy

Accesses repository: only if working with URLs

Options

--config-dir dir
--diff3-cmd cmd
--dry-run
--force
--ignore-ancestry
--no-auth-cache
--non-interactive
--non-recursive (-N)
--password pass
--quiet (-q)
--revision rev, -r rev
--username user

Examples

Merge a branch back into the trunk (assuming that you have a working copy of the trunk and that the branch was created in revision 250):

     $ svn merge -r 250:HEAD \     > http://svn.red-bean.com/repos/branches/my-branch     U  myproj/tiny.txt     U  myproj/thhgttg.txt     U  myproj/win.txt     U  myproj/flo.txt 

If you branched at revision 23, and you want to merge changes from the trunk into your branch, you could do this from inside the working copy of your branch:

     $ svn merge -r 23:30 file:///tmp/repos/trunk/vendors     U  myproj/thhgttg.txt     ... 

To merge changes to a single file:

     $ cd myproj     $ svn merge -r 30:31 thhgttg.txt     U  thhgttg.txt 

mkdir

     svn mkdir path ...     svn mkdir URL ... 

Create a directory with a name given by the final component of the path or URL. A directory specified by a working copy path is scheduled for addition in the working copy. A directory specified by a URL is created in the repository via an immediate commit. Multiple directory URLs are committed atomically. In both cases, all the intermediate directories must already exist.

Alternate names: none

Changes: working copy; repository if operating on a URL

Accesses repository: only if operating on a URL

Options

--config-dir dir
--editor-cmd editor
--encoding enc
--file file, -F file
--force-log
--message text, -m text
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--username user
move

     svn move src dst 

This command moves (renames) a file or directory in your working copy or in the repository.

NOTE

This command is equivalent to an svn copy followed by svn delete.


WC WC

Move and schedule a file or directory for addition (with history).


URL URL

Complete server-side rename.

NOTE

Subversion does not support moving between working copies and URLs. In addition, you can move files only within a single repository; Subversion does not support cross-repository moving.

Alternate names: mv, rename, ren

Changes: working copy; repository if operating on a URL

Accesses repository: only if operating on a URL

Options

--config-dir dir
--editor-cmd editor
--encoding enc
--file file, -F file
--force-log
--force
--message text, -m text
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--revision rev, -r rev
--username user
propdel

     svn propdel propname [path ...]     svn propdel propname --revprop -r rev [URL] 

This removes properties from files, directories, or revisions. The first form removes versioned properties in your working copy, while the second removes unversioned remote properties on a repository revision.

Alternate names: pdel, pd

Changes: working copy; repository only if operating on a URL

Accesses repository: only if operating on a URL

Options

--config-dir dir
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--recursive (-R)
--revision rev, -r rev
--revprop
--username user

Examples

Delete a property from a file in your working copy:

     $ svn propdel svn:mime-type some-script     property 'svn:mime-type' deleted from 'some-script'. 

Delete a revision property:

     $ svn propdel --revprop -r 26 release-date     property 'release-date' deleted from repository revision     '26' 

propedit

     svn propedit propname path ...     svn propedit propname --revprop -r rev [URL] 

Edit one or more properties using your favorite editor. The first form edits versioned properties in your working copy, while the second edits unversioned remote properties on a repository revision.

Alternate names: pedit, pe

Changes: working copy; repository only if operating on a URL

Accesses repository: only if operating on a URL

Options

--config-dir dir
--editor-cmd editor
--encoding enc
--no-auth-cache
--non-interactive
--password pass
--revision rev, -r rev
--revprop
--username user
propget

     svn propget propname [path ...]     svn propget propname --revprop -r rev [URL] 

Print the value of a property on files, directories, or revisions. The first form prints the versioned property of an item or items in your working copy, while the second prints the unversioned remote property on a repository revision.

Alternate names: pget, pg

Changes: working copy; repository only if operating on a URL

Accesses repository: only if operating on a URL

Options

--config-dir dir
--no-auth-cache
--non-interactive
--password pass
--recursive (-R)
--revision rev, -r rev
--revprop
--strict
--username user
proplist

     svn proplist propname [path ...]     svn proplist propname --revprop -r rev [URL] 

List all properties on files, directories, or revisions. The first form lists versioned properties in your working copy, while the second lists unversioned remote properties on a repository revision.

Alternate names: plist, pl

Changes: working copy; repository only if operating on a URL

Accesses repository: only if operating on a URL

Options

--config-dir dir
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--recursive (-R)
--revision rev, -r rev
--revprop
--username user
--verbose (-v)

Examples

You can use svn proplist to see the properties on an item in your working copy:

     $ svn proplist foo.c     Properties on 'foo.c':       svn:mime-type       svn:keywords       owner 

But with the --verbose flag, svn proplist is extremely handy, as it also shows you the values for the properties:

     $ svn proplist --verbose foo.c     Properties on 'foo.c':       svn:mime-type : text/plain       svn:keywords : Author Date Rev       owner : sally 

propset

     svn propset propname [propval] path ...     svn propset propname --revprop -r rev [propval] [URL] 

Set propname to propval on files, directories, or revisions. The first example creates a versioned, local property change in the working copy, and the second creates an unversioned, remote property change on a repository revision. The new property value, propval, may be provided literally, or using the -F valfile option.

Alternate names: pset, ps

Changes: working copy; repository only if operating on a URL

Accesses repository: only if operating on a URL

Options

--config-dir dir
--encoding enc
--file file, -F file
--force
--no-auth-cache
--non-interactive
--password pass
--quiet (-q)
--recursive (-R)
--revision rev, -r rev
--revprop
--targets filename
--username user

Examples

Set the mimetype on a file:

     $ svn propset svn:mime-type image/jpeg foo.jpg     property 'svn:mime-type' set on 'foo.jpg' 

On a Unix system, if you want a file to have the executable permission set:

     $ svn propset svn:executable ON somescript     property 'svn:executable' set on 'somescript' 

By default, you cannot modify revision properties in a Subversion repository. Your repository administrator must explicitly enable revision property modifications by creating a hook named pre-revprop-change.


resolved

     svn resolved path ... 

Remove the conflicted state on working-copy files or directories. This command does not semantically resolve conflict markers; it merely removes conflict-related artifact files and allows path to be committed again; that is, it tells Subversion that the conflicts have been resolved. Use it after you have resolved the conflict in the file.

Alternate names: none

Changes: working copy

Accesses repository: no

Options

--config-dir dir
--quiet (-q)
--recursive (-R)
--targets filename

Example

If you get a conflict on an update, your working copy will contain three additional files:

     $ svn update      C  foo.c     Updated to revision 31.     $ ls      foo.c                   Merged version with conflict markers     foo.c.mine              Original working copy version     foo.c.r30               Unmodified BASE version     foo.c.r31               Unmodified HEAD version 

Once you've resolved the conflict and foo.c is ready to be committed, run svn resolved to let your working copy know you've taken care of everything.

NOTE

You can just remove the conflict files and commit, but svn resolved fixes up some bookkeeping data in the working-copy administrative area in addition to removing the conflict files, so you should use this command.

revert

     svn revert path ... 

Revert any local changes to a file or directory, and resolve any conflicted states. svn revert reverts not only the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have done (e.g., files scheduled for addition or deletion can be unscheduled).

Alternate names: none

Changes: working copy

Accesses repository: no

Options

--config-dir dir
--quiet (-q)
--recursive (-R)
--targets filename

Examples

Discard changes to a file:

     $ svn revert foo.c     Reverted foo.c 

If you want to revert a whole directory of files, use the --recursive flag:

     $ svn revert --recursive .     Reverted newdir/afile     Reverted foo.c     Reverted bar.txt 

If you provide no targets to svn revert, it does nothing; to protect you from accidentally losing changes in your working copy, svn revert requires you to provide at least one target.


status

     svn status [path ...] 

Print the status of working-copy files and directories. With no arguments, it prints only locally modified items (no repository access). With --show-updates, add working revision and server out-of-date information. With --verbose, print full revision information on every item.

The first five columns in the output are each one character wide, and each column gives you information about different aspects of each working-copy item.

The first column indicates that an item was added, deleted, or otherwise changed:


space

No modifications.


A

Item is scheduled for addition.


D

Item is scheduled for deletion.


M

Item has been modified.


C

Item is in conflict with updates received from the repository.


X

Item is related to an externals definition.


I

Item is being ignored (e.g., with the svn:ignore property).


?

Item is not under version control.


!

Item is missing (e.g., you moved or deleted it without using svn). This also indicates that a directory is incomplete (a checkout or update was interrupted).


~

Item is versioned as a directory but has been replaced by a file, or vice versa.

The second column tells the status of a file's or directory's properties:


space

No modifications.


M

Properties for this item have been modified.


C

Properties for this item are in conflict with property updates received from the repository.

The third column is populated only if the working copy directory is locked:


space

Item is not locked.


L

Item is locked.

The fourth column is populated only if the item is scheduled for addition-with-history:


space

No history scheduled with commit.


+

History scheduled with commit.

The fifth column is populated only if the item is switched relative to its parent:


space

Item is a child of its parent directory.


S

Item is switched.

If you pass the --show-updates option, the out-of-date information appears in the eighth column:


space

The item in your working copy is up to date.


*

A newer revision of the item exists on the server.

The remaining fields are variable width and delimited by spaces. The working revision is the next field if the --show-updates or --verbose options are passed.

If the --verbose option is passed, the last committed revision and last committed author are displayed next.

The working-copy path is always the final field, so it can include spaces.

Alternate names: stat, st

Changes: nothing

Accesses repository: only if using --show-updates

Options

--config-dir
--no-auth-cache
--no-ignore
--non-interactive
--non-recursive (-N)
--password pass
--quiet (-q)
--show-updates (-u)
--username user
--verbose (-v)

Examples

To find out what changes you have made to your working copy:

     $ svn status wc      M     wc/bar.c     A  +   wc/qax.c 

To find out what files in your working copy are out of date, pass the --show-updates option (this does not make any changes to your working copy). Here you can see that wc/foo.c has changed in the repository since we last updated our working copy:

     $ svn status --show-updates wc      M           965    wc/bar.c            *     965    wc/foo.c     A  +         965    wc/qax.c     Status against revision:    981 

NOTE

--show-updates places an asterisk only next to items that are out of date (that is, items that will be updated from the repository if you run svn update). --show-updates does not cause the status listing to reflect the repository's version of the item.

And finally, the most information you can get out of the status subcommand:

     $ svn status --show-updates --verbose wc      M           965       938 sally        wc/bar.c            *     965       922 harry        wc/foo.c     A  +         965       687 harry        wc/qax.c                  965       687 harry        wc/zig.c     Head revision:   981 

switch

     svn switch URL [path] 

This subcommand updates your working copy to mirror a new URLusually a URL that shares a common ancestor with your working copy, although not necessarily. This is the Subversion way to move a working copy to a new branch.

Alternate names: sw

Changes: working copy

Accesses repository: yes

Options

--config-dir dir
--diff3-cmd cmd
--no-auth-cache
--non-interactive
--non-recursive (-N)
--password pass
--quiet (-q)
--relocate
--revision rev, -r rev
--username user

Examples

If you're currently inside the directory vendors, which was branched to vendors-with-fix, and you'd like to switch your working copy to that branch:

     $ svn switch http://svn.red-bean.com/repos/branches/ \     > vendors-with-fix .     U  myproj/foo.txt     U  myproj/bar.txt     U  myproj/baz.c     U  myproj/qux.c     Updated to revision 31. 

And to switch back, just provide the URL to the location in the repository from which you originally checked out your working copy:

     $ svn switch http://svn.red-bean.com/repos/trunk/vendors .     U  myproj/foo.txt     U  myproj/bar.txt     U  myproj/baz.c     U  myproj/qux.c     Updated to revision 31. 

NOTE

You can just switch part of your working copy to a branch if you don't want to switch your entire working copy.

Sometimes an administrator might change the "base location" of your repository; in other words, the contents of the repository doesn't change, but the main URL used to reach the root of the repository does. For example, the hostname may change, or the URL schema, or perhaps just the path that leads to the repository. Rather than checking out a new working copy, you can have the svn switch command "rewrite" the beginnings of all the URLs in your working copy. Use the --relocate command to do the substitution. No file contents are changed, nor is the repository contacted. It's similar to running a sed script over your working copy .svn/ directories, which runs s/OldRoot/NewRoot/:

     $ cd /tmp     $ svn checkout file:///tmp/repos test     A  test/a     A  test/b     ...           $ mv repos newlocation     $ cd test/           $ svn update     svn: Unable to open an ra_local session to URL     svn: Unable to open repository 'file:///tmp/repos'           $ svn switch --relocate file:///tmp/repos file:///tmp/newlocation .     $ svn update     At revision 3. 

update

     svn update [PATH ...] 

svn update brings changes from the repository into your working copy. If no revision is given, it brings your working copy up to date with the HEAD revision. Otherwise, it synchronizes the working copy to the revision given by the --revision option.

For each updated item Subversion prints a line starting with a specific character reporting the action taken. These characters have the following meaning:


A

Added


D

Deleted


U

Updated


C

Conflict


G

Merged

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.

NOTE

If you want to examine an older revision of a single file, you may want to use svn cat.

 

Alternate names: up

Changes: working copy

Accesses repository: yes

Options

--config-dir dir
--diff3-cmd cmd
--no-auth-cache
--non-interactive
--non-recursive (-N)
--password pass
--quiet (-q)
--revision rev, -r rev
--username user


Linux in a Nutshell
Linux in a Nutshell
ISBN: 0596154488
EAN: 2147483647
Year: 2004
Pages: 147

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net