[ Web Proxy ]
URL:
Viewing: https://wiki.python.org/moin/../python/platforms/MacPython/../../../python/archive/CvsToSvn.html [Back]  [Original]

Cvs to Svn - Python Wiki
Python Wiki
psf/wiki 0 0
Copy page

Cvs to Svn

Legacy Wiki Page

This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.

The Python development team recently switched from using CVS hosted at SourceForge to Subversion hosted at svn.python.org. There are many similarities between the two, but there are some differences as well. This page provides general tips. More details about using Subversion as it relates specifically to Python development are available in the Python developers FAQ.

(Most of the initial content came from a python-dev post by Tim Peters.)

Update vs. Status

CVS uses update for all sorts of things. SVN has different commands for several of the use cases CVSs update conflates:

  • Updating to the current server state. svnupdate does that, and SVNs update isnt useful for anything other than that.

  • Finding out whats changed in your sandbox. Use svnstatus for that. Bonus: in return for creating zillions of admin files, svnstatus is a local operation (no network access required). Do svnstatus-u (which does require network access) to get a listing of files that would change if you were to do svnupdate.

  • Merging. Use svnmerge for that. This includes the case of reverting a checkin, in which case just reverse the revision numbers:

    svn merge URL -rNEW:OLD
    

    NEW is the revision number of the checkin you want to revert, and OLD is typically NEW-1. Very nice:

    this reverts all changes made in revision NEW, no matter how many files were involved.

Checkins

Revision numbers apply to the entire repository, not just to single files. Every checkin conceptually creates a new version of the entire repository, uniquely identified by its revision number. This is very powerful, but subtle, and CVS has nothing like it. A glimpse of its power was given just above, talking about the ease of reverting an entire checkin in one easy gulp.

Branching

Youre working on a trunk sandbox and discover its going to take longer than you hoped. Now you wish you had created a branch. This is actually dead easy: create a new branch of the trunk. svnswitch your sandbox to that new branch; this leaves your local change alone, which is key. svncommit youre done! Theres now a branch on the server matching your fiddled local state.

svn cp -m "Create new branch from rev xxx." svn+ssh://pythondev@svn.python.org/python/trunk \
    svn+ssh://pythondev@svn.python.org/python/branches/my-branch
svn switch svn+ssh://pythondev@svn.python.org/python/branches/my-branch
svn ci -m "Commit first modifications on my branch."

Making a branch or tag goes very fast under SVN. Because branches and tags are just conventionally-named directories, you can delete them (like any other directory) when youre done with them. These conspire to make simple applications of branches much more pleasant than under CVS.

File Modes

CVS uses text mode for files by default. SVN uses binary mode. The latter is safer, but creates endless low-level snags for x-platform development. I encourage Python developers to include this gibberish in their SVN config file:

[auto-props]
# Setting eol-style to native on all files is a trick:  if svn
# believes a new file is binary, it won't honor the eol-style
# auto-prop.  However, svn considers the request to set eol-style
# to be an error then, and if adding multiple files with one
# svn "add" cmd, svn will stop adding files after the first
# such error.  A future release of svn will probably consider
# this to be a warning instead (and continue adding files).
* = svn:eol-style=native
*.c = svn:keywords=Id
*.h = svn:keywords=Id
*.py = svn:keywords=Id

Then SVN will set the necessary svn:eol-style property to native on new text files you commit. Ive never yet seen it tag a file inappropriately using this trick, but its guaranteed to screw up _all_ text files without something like this (unless you have the patience and discipline to manually set eol-style=native on all new text files you add).

For the above to work you will also have to make sure the enable-auto-props configuration key is set to yes.

Back to top

Web Proxy Viewer  |  New URL  |  Original Page