Wednesday, January 7, 2009

Using Emacs CVS commands

This tutorial is for us (really lazy Emacs users) who hate to get out of Emacs for those boring CVS tasks (checkout, commit...).

From shell (or if you've started Emacs and don't want to get out of Emacs try 'M-x shell')

1) Set the environment variable CVSROOT
2) Login to CVS
3) Start Emacs if you haven't already (and don't bother getting out)

Whenever I say something like go to the file and type x to do some CVS action. It means go to the line for that particular file in *cvs* buffer.

The first thing we've got to do is to checkout a repository so that we can work on it. The Emacs command for that is 'M-x cvs-checkout'. Emacs will prompt you for the name of the module (In some future version, there'll be some command 'M-x cvs-checkout-mindread' that will read your mind and figure out the module). After checking out, a *cvs* buffer will pop up showing the list of files downloaded.

If you want to edit a file, go to that file and type 'o'. After hours of typing away if you want to know the status of files, go to *cvs* and do 'M-x cvs-status'. This will show you which files were modified after checkout. If you want to find out what modifications you have made to a particular file, go to that file and type '='.

And finally when it's time to commit
'M-x cvs-do-commit'
Emacs will prompt you for a commit message. After typing it in do 'C-c C-c' to commit.

Not very relevant but you may find this useful

'C-u n C-x ^' to increase the size of a window by n lines. This is very useful for increasing the size of the window you are editing in (as you may want to keep *cvs* window small).

No comments: