Python-Xlib and PLWM Subversion Guide
Introduction
Migrating to Subversion opens up many new possibilities, including using tools like Bazaar, Mercurial, and SVK to facilitate offline, decentralized revision control on top of the Subversion repository. (Note: The author personally finds Bazaar to be the easiest to use in this regard, although Subversion integration requires a separate plugin in Bazaar.)
Working with Subversion
The first thing you'll need to do when switching to Subversion is get a new checkout. After checking out a working copy, you can continue using it in much the same fashion as a CVS checkout.
Checking out
To check out a working copy of the Python-Xlib repository, use the following command:
~/dev $ svn co https://python-xlib.svn.sourceforge.net/svnroot/python-xlib/trunk python-xlib-svn
To check out a working copy of the PLWM repository, use the following command:
~/dev $ svn co https://plwm.svn.sourceforge.net/svnroot/plwm/trunk plwm-svn
Adding, removing, and modifying files
- Adding files and directories
~/dev/plwm-svn $ svn add newfile A newfile
~/dev/plwm-svn $ svn add newdir A newdir A newdir/bar A newdir/fez A newdir/foo
- Deleting files and directories
~/dev/plwm-svn $ svn del newfile D newfile
~/dev/plwm-svn $ svn del newdir D newdir/bar D newdir/fez D newdir/foo D newdir
- Modifying files
- Simply modify the given file in the appropriate editor, and Subversion will notice you've changed it.
- Reviewing your changes
- Use svn status to review your changes. If you have created a new file but not yet added it using Subversion, it will be preceeded by a "?". If you've deleted a file without telling Subversion, it will be preceeded by a "!".
~/dev/plwm-svn $ svn status ! NEWS ? newdir/baz M newfile
- Reviewing recent commits
- Note: If you have just committed a set of changes, that commit will not show up in svn log's output until you run svn update.
~/dev/python-xlib-svn $ svn log --limit 3 ------------------------------------------------------------------------ r122 | funkiedamouse | 2008-02-26 15:06:26 -0500 (Tue, 26 Feb 2008) | 1 line Fixed svn:executable property on a few scripts, and changed the example scripts from using "/usr/bin/python" directly to using "/usr/bin/env python". (the latter is the recommended method) ------------------------------------------------------------------------ r120 | mggrant | 2007-10-01 17:42:24 -0400 (Mon, 01 Oct 2007) | 2 lines minor updates for 0.14 ------------------------------------------------------------------------ r119 | mggrant | 2007-10-01 17:40:24 -0400 (Mon, 01 Oct 2007) | 2 lines tiny bit of help text ------------------------------------------------------------------------
- You can also review changes to a given file.
~/dev/python-xlib-svn $ svn log --limit 3 NEWS ------------------------------------------------------------------------ r120 | mggrant | 2007-10-01 17:42:24 -0400 (Mon, 01 Oct 2007) | 2 lines minor updates for 0.14 ------------------------------------------------------------------------ r117 | mggrant | 2007-06-10 10:21:04 -0400 (Sun, 10 Jun 2007) | 2 lines Prep for 0.14rc1 ------------------------------------------------------------------------ r115 | mggrant | 2007-03-18 11:57:14 -0400 (Sun, 18 Mar 2007) | 2 lines Updates to changelogs ------------------------------------------------------------------------
Working with the repository
- Getting the latest changes
~/dev/plwm-svn $ svn update A newdir A newdir/foo A newdir/bar A newdir/fez A newfile Updated to revision 122.
- Committing your changes
~/dev/plwm-svn $ svn commit -m "Added test stuff that we don't need." Authentication realm: <https://plwm.svn.sourceforge.net:443> SourceForge Subversion area Password for 'funkiedamouse': Adding newdir/baz Deleting newdir/fez Sending newfile Transmitting file data .. Committed revision 123.
- Rolling back your changes
- If you made changes to a file (including deleting it) and you want to restore that file to its state in the revision you checked out, simply use svn revert:
~/dev/plwm-svn $ svn revert NEWS Reverted 'NEWS'
Migrating outstanding changes to Subversion
If you currently have outstanding changes in your CVS checkout, you can either check them in before the CVS freeze, or you can copy the changes into a new Subversion checkout.
- In your CVS checkout, check what files you've modified locally:
~/dev/plwm-cvs $ cvs -n update
or~/dev/plwm-cvs $ cvs status | grep Status | grep -v 'Up-to-date'
- Check out a copy of the Subversion repository, if you haven't already:
~/dev $ svn co https://plwm.svn.sourceforge.net/svnroot/plwm/trunk plwm-svn
- Copy the modified files from your CVS checkout to the corresponding places in your new Subversion checkout:
~/dev $ cp plwm-cvs/modified-file plwm-cvs/added-file plwm-svn
- Add any new files to your Subversion checkout:
~/dev/plwm-svn $ svn add added-file
- Commit your changes when you are ready:
~/dev/plwm-svn $ svn commit -m "Commit message."