sasha2002 Blog's

Just another blog from admin's

Subversion command summary cheat sheet —

Subversion command summary cheat sheet

Command Description
svn --help List Subversion commands
svn help command
Also: ? or h
Help on given “command
svn add filename

svn add directory

Add a file or directory to Subversion CM control.
Must also perform: svn ci filename (or svn commit)
to upload the file or directory. File will not be available in the
repository until a “commit” is performed. If adding a directory, the
directory and all of its contents recursively are added. i.e.:
svn ci directory
svn commit directory
svn commit .
svn blame filename
svn blame -r RevisionNumber filename
Also: praise, annotate, ann
Show file contents with revisions annotated with author information.
svn cat filename List contents of file under Subversion control.
svn checkout http://node-name/repos/svn/trunk/parentPath/path
This creates:
path/file1
path/file2
...

svn checkout http://node-name/repos/svn/trunk/parentPath .
This creates:
path/file1
path/file2
...
Note the difference a "." makes.

svn checkout file:///repos/svn/trunk/path/
svn co -r 497 http://node-name/repos/svn/trunk/path file-name
Also: svn co https://..., svn://..., and svn+ssh://
MS/Windows: svn co file:///c:/repository/project/trunk

Checkout every file from the path and subdirectories specified below. Creates “working” copy of files and directories.
Checkout a repository.

Use option “-r” to specify a specific revision other than the latest.

The URL “svn://” communicates with an SVN server (port 3690)

The URL “http://” comunicates with the Apache server and module mod_dav_svn (port 80) [more common server]

svn cleanup Cleanup subversion files resulting from escaped processes and crashed.
svn commit filename
svn commit --message "Message goes here." filename
svn commit -m "Message goes here." filename
svn ci filename1 filename2 filename3
svn ci .
Check-in (commit) local “working” file,
files or directory and contents (recursively) into Subversion
repository. Atomic, i.e. all committed or none, no incomplete check-in.
svn copy source destination_clone
Also: svn cp ...
Copy file or directory tree. One can copy
from one local working copy to another or to repository server URL’s.
The sources and destinations can be working copies or URLs.
svn copy http://host/repos/project/trunk http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of the repository and assigns a name. This can be performed at any directory branch.
svn copy . http://host/repos/project/tags/TagName-1.4.5 -m "Tag Release 1.4.5" Tag a release. Takes a snapshot of your local working copy and assigns a name. This can be performed at any directory branch.
svn delete filename
svn delete directory
Also: del, remove or rm
svn rm https://host/repos/project/trunk/file-or-directory
Delete file from repository. The UNIX command rm file-name. Must perform a “commit” to update the repository and local working directory with the changes. i.e.:
svn commit .
svn diff filename
svn di filename
Show file diffs between SVN repository and your file changes using GNU file diff format. Use GUI diff tools as shown below.
svn diff -r rev1:rev2 filename Show file diffs between specified versions.
Example: svn diff -r 456:459 subfn.cpp
Using GUI diff tool: svn diff -r 457:459 --diff-cmd kdiff3 file-name
svn diff filename > patch-file Generate patch file used by the patch command.
svn export directory Export directory tree to your file system but it will not be a “working directory” under SVN control.
svn export -r Rev-Number http://node-name/path Export directory tree of specified version and create local directory tree and files not under SVN control.
svn import local-directory http://node/repos/svn/trunk/directory Add directory (and files in it recursively) to path in repository specified.
svn info filename Display information about file or directory. (Date modified, author, revision, path in repository.)
Can not specify a URL.
svn list directory
svn list file-name
List file or directory of files in repository. Used to browse repository before checkout. If current directory is given (svn list ./), then Subversion will list the repository URL of the current directory.
svn list -r RevisionNumber directory List directory of files in repository in specified revision.
svn lock filename -m "comment as to why its locked or by whom"

 

(Comment is not required but is often useful)

Lock file to grant exclusive access to one and forbid all others. A commit will unlock the file (unless the “–no-unlock” option is used). A lock can be removed with the commands: svn unlock filename, svnlook and the svnadmin comands (i.e. List: svnadmin lslocks and remove: svnadmin rmlocks filename).
svn log filename
svn log .
svn log http://URL/path/file
svn log -v .
svn log -r RevisionNumber http://URL/path/file
Show the Subversion log messages for a set of revision(s) and/or file(s) and/or all directory contents in repository.
List verbose. Includes list of all files in change
Shows the file changes associated with revision number.
svn merge http://url/path/branch1 http://url/path/branch2 working-local-dir
svn merge file1@revJ file2@revK
svn merge -r 414:411 http://url/path working-dir
svn merge -r 413:HEAD file-name
Merge directory changes into your current
working directory or merge a file in Subversion into the file in your
working directory. If target is not specified, the identical basename
or current directory is assumed. Used to incorporate changes checked in
which are not accounted for in your file or to merge branches.
Example using GUI merge tool:
svn diff -r 459:454 --diff-cmd kdiff3 --extensions '-m' file-name
Next, tell subversion that the conflicts have been resolved:
svn resolve file-name
Finally, check-in file: svn ci file-name
or abort changes: svn revert file-name
svn merge --dry-run -r 414:413 http://url/path Test merge. No changes are made to your local working copy but shows Subversion feedback as if merge was performed.
svn merge -r 414:413 http://url/path
svn merge -r 414:413 .
Undo changes committed in revision 414.
svn mkdir directory
svn mkdir http://URL/directory
Create a new directory under version control.
svn move directory1 directory2
svn mv directory1 directory2
svn mv file-old-name file-new-name
Rename or move a file or directory. Moves/renames file/directory in repository and in local work area.
Must perform svn ci file-new-name after the move for changes to to take place in repository.
svn revert filename Undo changes in local work files. Throw away local changes.
svn resolved filename Run this command after resolving merge conflicts. Next “commit” your changes.
svn status
svn status -u
svn status -u .
svn status -uq .
Show status of file changes in current directory and recursively in directories below.
Show out of date file info: svn status --show-updates

(equivalent: svn status -u)

-u: Determines status by comparing your local repository with the server
repository. Without this option, the status shown will only be the changes
you have made in your local repository.

-q: Quiet. Do not print “?: File/directory not under version control” or “!: File/directory missing” extraneous information.

First collumn:

  • A: File to be added
  • C: Conflicting changes
  • D: File to be deleted
  • G: File to be merged with updates from server
  • M: File has been modified
  • R: File to be replaced
  • G: File to be merged
  • X: Resource is external to repository (svn:externals)
  • ?: File/directory not under version control
  • !: File/directory missing
  • ~: Versioned item obstructed by some item of a different kind.

Second collumn: Modification of properties

  • ‘ ‘ no modifications. Working copy is up to date.
  • ‘C’ Conflicted
  • ‘M’ Modified
  • ‘*’ Local file different than repository. A newer revision exists on the server. Update will result in merge or possible conflict.
  • Third collumn: Locks

    • ‘ ‘ not locked
    • ‘L’ locked
    • ‘S’ switched to a branch
svn switch http://server/new-branch
svn switch --relocate http://server/old-path http://server/new-path
Switch your local working copy to mirror a
new repository branch instead of main trunk or previous branch. Also
allows you to point your repository to a new path on the server if the
server path changes since you performed a check-out.
svn update
svn update filename
svn update -r458 filename
svn update --ignore-externals ./
Migrate all updates from Subversion
repository to your local copy (recusively for all files in the current
directory and all below it). If there have been updates to the svn
repository since you downloaded the files, subversion will give you the
opportunity to merge. Status of files will use the coding as stated
above for “status”. Files marked with a “C” (conflict) should be merged
of reverted. If merged then one can perform a “resolve” and then a
“check-in”.
If a file name is specified, only that file is updated.
Can also syncronize to a specified revision given by -r.
Use –ignore-externals to avoid the slow processing of externals to a potentially slow distant internet server.

Where RevisionNumber is:

  • HEAD: The latest revision in the repository.
  • BASE: The “pristine” revision of an item in a working copy. Matches checked out version before any modifications.
  • COMMITTED: The last revision in which an item changed before (or at) BASE.
  • PREV: The revision just before the last revision in which an item changed. (Technically, COMMITTED – 1.)

Categorised as: Linux


3 Comments

  1. sasha2002 says:

    If you have :
    # svn ci
    svn: Commit failed (details follow):
    svn: Aborting commit: ‘system.log’ remains in conflict

    You need to do :
    svn remove –force system.log
    svn resolve –accept=working system.log

    After this you can successful do :
    svn ci

  2. sasha2002 says:

    svn propedit svn:ignore .

  3. sasha2002 says:

    If you have some trouble with NON UTF-8, like :
    svn status
    svn: Valid UTF-8 data
    (hex: 4b)
    followed by invalid UTF-8 sequence
    (hex: fc 63 68 65)

    DO THIS :
    # convmv -f latin1 -t utf-8 * -r –notest –replace

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.