SvnStatusMode

Foreword

SubVersion, like other revision control systems starting with CVS, can manage groups of files and entire directory trees, rather than just one file at a time like preceding systems like RCS and CSSC. The design of Emacs’ VersionControl mode unfortunately only supports these single-file operations. PclCvs was the first Emacs mode to support aggregate operations on CVS files. The following are modes that can also operate on many files in a SubVersion repository.

Psvn

StefanReichoer provides a SubVersion mode called psvn.el, which is similar to pcvs/pcl-cvs for the ConcurrentVersionsSystem. The main advantages to this mode over the official mode is:

  1. It is in the standard Subversion install and “blessed” by the Subversion maintainers since the pre-1.0 days.
  2. It can commit over more than one file at time.

You can find the very latest version at:

The above version has this note at the top “This version is currently not under svn control”, which means that it’s newer than HEAD of trunk:

SurendraSinghi has confirmed that the psvn.el works with XEmacs

A version prepared for Marmalade is hosted on the Wiki’s ElispArea:

Subversion 1.7

In subversion 1.7 the format of the working copy was changed. Now there’s only one .svn subdirectory in the root of the project. Unfortunately psvn expects each directory to have a .svn subdirectory.

In this post there’s a patch to update HEAD of trunk to work with this new format. But as this is not the latest version, I’ve created this psvn.el.patch to work with the latest version (timestamped “2012-03-26, 21:23:49”).

Also in subversion 1.7 the output of modified externals has changed to include the full path rather the relative one, this confuses psvn. I’ve used a pre-parse hook to put output back into the expected format. If you don’t use externals or edit them you don’t need this.

(add-hook 'svn-pre-parse-status-hook 'svn-status-parse-fixup-externals-full-path)

(defun svn-status-parse-fixup-externals-full-path ()
 "Subversion 1.7 adds the full path to externals.  This
pre-parse hook fixes it up to look like pre-1.7, allowing
psvn to continue functioning as normal."
 (goto-char (point-min))
 (let (( search-string  (file-truename default-directory) ))
      (save-match-data
        (save-excursion
          (while (re-search-forward search-string (point-max) t)
          (replace-match "" nil nil)
          )))))

Usage

To check the status of a Subversion repository at ‘DIR’:

  M-x svn-examine DIR RET

From inside the *svn-status* buffer:

‘g’
Refresh status of files shown.
‘U’
Update files for currently examined Subversion repository.
‘C-u U REVISION RET’
Update the files to ‘REVISION’.
‘M-- U’
Update only marked files.
‘m’
Mark file at point.
`* %’
Mark files by RegularExpression.
‘u’
Unmark file at point.
‘c’
Commit marked files or file file at point.
`=’
Run diff on the marked files or file at point.
`C-u = REVISION RET’
Run diff on the marked files or file at point against ‘REVISION’.
‘l’
Display log for marked files or file at point.

From the *svn-log* buffer:

‘RET’
Visit the file at point.
`=’
View the diff for the revision at point.

For a more discursive treatment, see Ted Carnahan’s A Brief Introduction to Emacs psvn.

For more details, read the commentary section at the top of the psvn.el.

Dsvn

DavidKågedal contributed a Subversion mode called dsvn, which is also influenced by pcvs and psvn. However, it can more efficiently work with large repositories containing many files and subdirectories.

Download it from the “contributed” section of the official Subversion repository:

Question: How do I mark a directory for deletion if the directory is not listed in svn buffer (svn rm <dir> command)?


CategoryVersionControl