CVS & Subversion

From IthrynWiki

Jump to: navigation, search

Contents

Help

Action CVS command Subversion command
Help cvs --help-commands

cvs -H <command>

svn --help

svn help <command>


Checking in and out

  • <URL> means a URL of the form [XXX]
  • <directory> means a path of the form [XXX], ending in a directory.
  • <file> means a path of the form [XXX], ending in a file name.

Note that in Subversion changes to URL operate on the repository directly and automatically commit (they'll ask you for a message). Local changes won't occur in the repository until you commit, so they're probably better.

Action CVS command Subversion command
Checking out cvs checkout <directory>

cvs co <directory>

svn checkout <URL>

svn co <URL>

Checking out from a branch cvs checkout -r <branch> <directory>

cvs co -r <branch> <directory>

svn checkout <branch URL>

svn co <branch URL>

Checking in / Committing cvs commit <directory, or files>

cvs ci <directory, or files>

svn commit <directory, or files>

svn ci <directory, or files>

Updating cvs update -d <file> svn update <URL, directory, or file>
Revert local changes cvs -d release <directory>.

But if there are changes it will force you to delete them yourself.

svn revert <directory, or file>


Views

Action CVS command Subversion command
Viewing differences cvs diff <directory or file>

cvs diff -r <revision> <directory or file>
cvs diff -r <revision1> -r <revision2> <directory or file>

svn diff <URL, directory, or file>

svn diff -r <revision> <URL, directory, or file>
svn diff -r <revision1>:<revision2> <URL, directory, or file>

Viewing repository cvs -n update <directory> svn list <URL or directory>
Viewing file contents No specific operation. svn cat <URL or file>
Viewing logs cvs log <directory, or file> svn log <URL, directory, or file>
Viewing status cvs status <directory, or file> svn status <URL, directory, or file>
Annotations cvs annotate <file> svn annotate <URL or file>


Copying, Moving & Removing

CVS doesn't make any of this easy. No version information is kept on directories at all. Files have version information but copying or moving them doesn't carry it over.

Subversion's copies are all logical copies: version information is carried over, and no actual copies are made in the repository unless changes are actually made.

Action CVS command Subversion command
Removing directories Edit the repository directly.

Change is not undoable.

svn remove <URL or directory>
Removing files cvs remove <file> svn remove <URL or file>
Copying directories No way to do so directly. Add a new file in a new directory and copy the files in the working directory. Version information is lost. svn copy <old URL or directory> <new URL or directory>
Copying files Edit the repository directly, unless you don't mind losing version information. Otherwise:

cp <old file> <new file>
cvs add <new file>

svn move <URL or file>
Renaming directories Edit the repository directly.

Change is not undoable by CVS.

svn move <URL or directory>
Renaming files Edit the repository directly, unless you don't mind losing version information. Otherwise:

cp <old file> <new file>
cvs remove <old file>
cvs add <new file> Change is not undoable by CVS.

svn move <URL or file>


Tags

CVS tag names are just symbolic: mixtures of alphanumerics, dashes and underscores.

In Subversion "tag URL, directory or files" means a path below the tags/ directory in the repository.

Action CVS command Subversion command
Adding tags cvs tag <tag name> [<files>]

cvs rtag <tag name> [<directories>]

svn copy <trunk URL, directory, or files> <tag URL, directory or files>
Removing tags cvs tag -d <tag name> [<files>]

cvs rtag -d <tag name> [<directories>]

svn remove <tag URL, directory or files>
Copying tags cvs (r)tag -r <existing tag name> <new tag name> svn copy <existing tag URL, directory, or files> <new tag URL, directory or files>
Renaming tags cvs (r)tag -r <existing tag name> <new tag name>

cvs (r)tag -d <existing tag name>

svn move <existing tag URL, directory or files> <new tag URL, directory, or files>


Branches

CVS branch names are just tag names. They have to be distinguished from other tags explicitly.

In Subversion "branch URL, directory or files" means a path below the branches/ directory in the repository.

Action CVS command Subversion command
Adding branches cvs tag -b <branch name> [<files>]

cvs rtag -b <branch name> [<directories>]
cvs rtag -r <existing tag name> -b <branch name> [<directories>]

svn copy <trunk URL, directory, or files> <branch URL, directory or files>
Removing branches cvs tag -d <existing branch name> [<files>]

cvs rtag -d <existing branch name> [<directories>]

svn remove <branch URL, directory or files>
Copying branches cvs rtag -r <existing branch name> -b <new branch name> svn copy <old branch URL, directory, or files> <new branch URL, directory or files>
Renaming branches cvs rtag -r <existing branch name> -b <new branch name>

cvs (r)tag -d <existing branch name>

svn move <old branch URL, directory or files> <new branch URL, directory, or files>
Merging branches Not going to even try explaining this. It takes pages of the CVS manual on merges to show how to do it properly. svn merge <branch URL>@<last merge's revision> <branch URL>@<current revision> <directory to merge to>

svn merge -r <last merge's revision>:<current revision> <branch URL> <directory to merge to>

Also read the SVN manual on merges

Personal tools