15.4. The Subversion Command Line Client: svn

 < Day Day Up > 

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

     svn [options    ] subcommand [arguments] 

The options and subcommand may be provided in any order.

15.4.1. svn Options

While Subversion has different options for its subcommands, all options are global that is, each option is guaranteed to mean the same thing regardless of the subcommand that you use it with. For example, --verbose (-v) always means "verbose output," no matter which 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. Normally, 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 changes either in the sandbox 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 "I know what I'm doing as well as the possible repercussions of doing it, 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 that 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 other unversioned--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 since 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 subcommands usually those that have the potential to remove or undo your local modifications do 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 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 list of revision keywords is provided later in this section.


--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 copy that 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 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

Print output in XML format.

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}. Full details are provided in Version Control with Subversion.


15.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

--non-recursive (-N)

--config-dir dir

--quiet (-q)

--no-auto-props

--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 in-line 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

--password pass

--no-auth-cache

--revision rev, -r rev

--non-interactive

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

--password pass

--no-auth-cache

--revision rev, -r rev

--non-interactive

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

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

--password pass

--no-auth-cache

--quiet (-q)

--non-interactive

--revision rev, -r rev

--non-recursive (-N)

--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 like 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 rarely need these options.

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 don't 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.

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. Subversion prompts you to either abort the commit, continue with no message, or edit the message again.


Alternate Names:

ci (short for "check in," not co, which is short for "check out")

Changes:

Working copy, repository

Accesses Repository:

Yes


Options

--config-dir dir

--non-interactive

--encoding enc

--non-recursive (-N)

--file file, -F file

--password pass

--force-log

--quiet (-q)

--message text, -m text

--targets filename

--no-auth-cache

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

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

--no-auth-cache

--editor-cmd editor

--non-interactive

--encoding enc

--password pass

--file file, -F file

--quiet (-q)

--force-log

--revision rev, -r rev

--message text, -m text

--username user


Examples

Copy an item within your working copy (just schedule 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 schedule the copy nothing goes into the repository until you commit):

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

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


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. 

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

--no-auth-cache

--editor-cmd editor

--non-interactive

--encoding enc

--password pass

--file file, -F file

--quiet (-q)

--force-log

--targets filename

--force

--username user

--message text, -m text

 


diff

 svn     diff [-r N[:M]] [--old old-tgt][--new new-tgt] [path ...] svn diff -r N:M URLsvn 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

--non-recursive (-N)

--diff-cmd cmd

--notice-ancestry

--extensions args, -x args

--old old-target

--new new-target

--password pass

--no-auth-cache

--revision rev, -r rev

--no-diff-deleted

--username user

--non-interactive

 


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 from the repository specified by URL (at revision rev if it is given, otherwise at HEAD) into path. 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

--password pass

--force

--quiet (-q)

--no-auth-cache

--revision rev, -r rev

--non-interactive

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

--no-auth-cache

--config-dir dir

--no-auto-props

--editor-cmd editor

--non-interactive

--encoding enc

--non-recursive (-N)

--file file, -F file

--password pass

--force-log

--quiet (-q)

--message text, -m text

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

--recursive (-R)

--no-auth-cache

--revision rev, -r rev

--non-interactive

--username user

--password pass

--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 sue         28361 Jan 16 23:18 README.txt          27 sue             0 Jan 18 15:27 INSTALL          24 joe               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, svn log 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

--revision rev, -r rev

--incremental

--stop-on-copy

--no-auth-cache

--targets filename

--non-interactive

--username user

--password pass

--verbose (-v)

--quiet (-q)

--xml


Examples

To see the log messages for all the paths that changed in your working copy, run svn log from the top (some long output lines have wrapped):

     $ svn log     -------------------------------------------------------------------     r20 | joe | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line     Tweak.     -------------------------------------------------------------------     r17 | sue | 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 | sue | 2003-01-13 00:43:13 -0600 (Mon, 13 Jan 2003) | 1 line     Added defines.     -------------------------------------------------------------------     r28 | sue | 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     -------------------------------------------------

then 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 | sue | 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

--non-interactive

--diff3-cmd cmd

--non-recursive (-N)

--dry-run

--password pass

--force

--quiet (-q)

--ignore-ancestry

--revision rev, -r rev

--no-auth-cache

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

--no-auth-cache

--editor-cmd editor

--non-interactive

--encoding enc

--password pass

--file file, -F file

--quiet (-q)

--force-log

--username user

--message text, -m text

 


move

 svn move src dst

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

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.

Subversion does not support moving between working copies and URLs. In addition, you can only move files 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

--no-auth-cache

--editor-cmd editor

--non-interactive

--encoding enc

--password pass

--file file, -F file

--quiet (-q)

--force-log

--revision rev, -r rev

--force

--username user

--message text, -m text

 


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, whereas 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

--recursive (-R)

--no-auth-cache

--revision rev, -r rev

--non-interactive

--revprop

--password pass

--username user

--quiet (-q)

 


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

--password pass

--editor-cmd editor

--revision rev, -r rev

--encoding enc

--revprop

--no-auth-cache

--username user

--non-interactive

 


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

--recursive (-R)

--no-auth-cache

--revprop

--non-interactive

--strict

--password pass

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

--recursive (-R)

--no-auth-cache

--revision rev, -r rev

--non-interactive

--revprop

--password pass

--username user

--quiet (-q)

--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 : sue

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

--quiet (-q)

--encoding enc

--recursive (-R)

--file file, -F file

--revision rev, -r rev

--force

--revprop

--no-auth-cache

--targets filename

--non-interactive

--username user

--password pass

 


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 execute permission:

     $ 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

--recursive (-R)

--quiet (-q)

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

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 not only reverts 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

--recursive (-R)

--quiet (-q)

--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, print 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 dir

--password pass

--no-auth-cache

--quiet (-q)

--no-ignore

--show-updates (-u)

--non-interactive

--username user

--non-recursive (-N)

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

--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 sue        wc/bar.c            *     965       922 joe        wc/foo.c     A  +         965       687 joe        wc/qax.c                  965       687 joe        wc/zig.c     Head revision:   981

switch

 svn switch URL [path]

This subcommand updates your working copy to mirror a new URL usually 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

--password pass

--diff3-cmd cmd

--quiet (-q)

--no-auth-cache

--relocate

--non-interactive

--revision rev, -r rev

--non-recursive (-N)

--username user


Examples

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

     $ svn switch http://svn.red-bean.com/repos/branches/fixed .     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. 

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 check 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 that 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

C

Conflict

D

Deleted

G

Merged

U

Updated


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.

Alternate Names:

up

Changes:

Working copy

Accesses Repository:

Yes


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


Options

--config-dir dir

--password pass

--diff3-cmd cmd

--quiet (-q)

--no-auth-cache

--revision rev, -r rev

--non-interactive

--username user

--non-recursive (-N)

 


     < Day Day Up > 


    Unix in a Nutshell
    Unix in a Nutshell, Fourth Edition
    ISBN: 0596100299
    EAN: 2147483647
    Year: 2005
    Pages: 201

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