bug#3214: 23.0.92; VC dir mode fails after commit when files are deleted

Bob Rogers <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>
   To reproduce:

   1.  Find or create a working copy of a repository, and identify a
file that you want to remove from the repo, call it "foo.text".  (I used
SVN, but the problem doesn't seem to be backend-dependent.)  You will
need to commit in order to trigger the bug, so be sure you really don't
mind getting rid of it.

   2.  "emacs -Q" in the working copy.

   3.  "C-x C-f foo.text RET".  The deleted file must be visited in
order to trigger the bug.

   4.  Remove the file via the VC command-line tools, but don't commmit
yet.  (Don't use vc-delete-file, as that will also delete the buffer.)

   5.  "C-x v d" to get VC dir mode in the other window.  It should tag
foo.text as "removed".  (FWIW, if you do "C-x v d" first, you will see
bug #3213.)

   6.  Type "v" on the foo.text line, then "C-c C-c" in the log entry
buffer to commit the change.  You should then get a "File foo.text no
longer exists!" error.  A sample backtrace is shown below.

   The patch after the backtrace cures the symptom crudely, albeit by
papering over it, and possibly hiding other bugs.  It would be better if
vc-finish-logentry could recognize which files are being deleted, and
then have vc-resynch-buffer simply delete those buffers, but it is not
clear to me how to do that in a backend-independent way.

   Admittedly, this is a comparatively minor nuisance; the VC change is
comitted properly, and the partially-updated VC-dir buffer can be fixed
by typing "g".  (And I don't know whether this is a regression.)

					-- Bob Rogers
					   http://www.rgrjr.com/

Backtrace:
Debugger entered--Lisp error: (error "File /home/rogers/projects/test2/test/foo.text no longer exists!")
  signal(error ("File /home/rogers/projects/test2/test/foo.text no longer exists!"))
  error("File %s no longer exists!" "/home/rogers/projects/test2/test/foo.text")
  revert-buffer(t t t)
  vc-revert-buffer-internal(t t)
  vc-resynch-window("/home/rogers/projects/test2/test/foo.text" t t)
  vc-resynch-buffer("/home/rogers/projects/test2/test/foo.text" t t)
  #[(file) "=3fffc2	=3fffc3#=3fff87" [file vc-keep-workfiles vc-resynch-buffer t] 4]("/home/rogers/projects/test2/test/foo.text")
  mapc(#[(file) "=3fffc2	=3fffc3#=3fff87" [file vc-keep-workfiles vc-resynch-buffer t] 4] ("/home/rogers/projects/test2/test/foo.text"))
  vc-finish-logentry()
  call-interactively(vc-finish-logentry)
  log-edit-done()
  call-interactively(log-edit-done nil nil)
------------------------------------------------------------------------
Index: lisp/vc-dispatcher.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc-dispatcher.el,v
retrieving revision 1.67
diff -c -r1.67 vc-dispatcher.el
*** lisp/vc-dispatcher.el	5 Jan 2009 03:19:52 -0000	1.67
--- lisp/vc-dispatcher.el	4 May 2009 19:29:54 -0000
***************
*** 444,453 ****
      ;; and mark properly even in cases where vc-restore-buffer-context
      ;; would fail.  However, save-excursion might also get it wrong --
      ;; in this case, vc-restore-buffer-context gives it a second try.
!     (save-excursion
!       ;; t means don't call normal-mode;
!       ;; that's to preserve various minor modes.
!       (revert-buffer arg no-confirm t))
      (vc-restore-buffer-context context)))
  
  (defun vc-resynch-window (file &optional keep noquery)
--- 444,457 ----
      ;; and mark properly even in cases where vc-restore-buffer-context
      ;; would fail.  However, save-excursion might also get it wrong --
      ;; in this case, vc-restore-buffer-context gives it a second try.
!     (condition-case error
! 	(save-excursion
! 	  ;; t means don't call normal-mode;
! 	  ;; that's to preserve various minor modes.
! 	  (revert-buffer arg no-confirm t))
!       (error
!         (message "Got error %S" error)
! 	(sit-for 2)))
      (vc-restore-buffer-context context)))
  
  (defun vc-resynch-window (file &optional keep noquery)
------------------------------------------------------------------------
In GNU Emacs 23.0.92.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2009-04-24 on rgr
Windowing system distributor `The X.Org Foundation', version 11.0.10400090
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Debugger

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.