2

How can I do a svn revert <file> from Emacs Version Control?
I've read many parts of the manual, but can't find it.

I would like to do it over a file after opening it with vc-directory C-x v d, but any other way would be helpful.

nephewtom
  • 2,219
  • 17
  • 29

2 Answers2

2

You can use M-x vc-revert.

or use this function:

(defun revert-svn()
    (interactive)
    (vc-revert)
    (revert-buffer t t))
(global-set-key (kbd "C-x v u") 'revert-svn)
djangoliv
  • 3,169
  • 16
  • 31
  • So, it seems that the wiki is wrong. With Emacs 24 I have `vc-revert` as `C-x v u`, and `vc-revert-buffer` with no keybinding. Now, I'm not sure what does the `vc-revert-buffer` do... – nephewtom Oct 08 '15 at 11:42
  • Mmm, it seems it acts over the whole fileset, not just a file. http://www.gnu.org/software/emacs/manual/html_node/emacs/VC-Undo.html – nephewtom Oct 08 '15 at 11:44
  • `vc-revert-buffer` is obsolete since 23.1 and the fileset can be just a file. – djangoliv Oct 08 '15 at 13:25
1

As @djangoliv has mentioned, M-x vc-revert works (C-x v u on Emacs 24.5.1).
When doing it over a file on a *vc-dir* buffer (opened by vc-directory command), another buffer with the differences is opened and a prompt message appears in the mini-buffer to confirm it.

Just like this image:

vc-revert

nephewtom
  • 2,219
  • 17
  • 29