Commit daee954c authored by Glenn Morris's avatar Glenn Morris
Browse files

Don't bother making files writable for commit with modern VCS

* lisp/vc/vc.el (vc-next-action):
Only gripe about committing read-only files for RCS and SCCS.

Fixes: debbugs:9781
parent 4695c850
2012-09-27 Glenn Morris <rgm@gnu.org>
* vc/vc.el (vc-next-action): Only gripe about committing read-only
files for RCS and SCCS. (Bug#9781)
2012-09-27 Chong Yidong <cyd@gnu.org> 2012-09-27 Chong Yidong <cyd@gnu.org>
   
* progmodes/verilog-mode.el (verilog-mode-release-emacs): Fix last * progmodes/verilog-mode.el (verilog-mode-release-emacs): Fix last
......
...@@ -1105,24 +1105,27 @@ For old-style locking-based version control systems, like RCS: ...@@ -1105,24 +1105,27 @@ For old-style locking-based version control systems, like RCS:
;; Files have local changes ;; Files have local changes
((vc-compatible-state state 'edited) ((vc-compatible-state state 'edited)
(let ((ready-for-commit files)) (let ((ready-for-commit files))
;; If files are edited but read-only, give user a chance to correct. ;; CVS, SVN and bzr don't care about read-only (bug#9781).
(dolist (file files) ;; RCS does, SCCS might (someone should check...).
;; If committing a mix of removed and edited files, the (when (memq backend '(RCS SCCS))
;; fileset has state = 'edited. Rather than checking the ;; If files are edited but read-only, give user a chance to correct.
;; state of each individual file in the fileset, it seems (dolist (file files)
;; simplest to just check if the file exists. Bug#9781. ;; If committing a mix of removed and edited files, the
(when (and (file-exists-p file) (not (file-writable-p file))) ;; fileset has state = 'edited. Rather than checking the
;; Make the file+buffer read-write. ;; state of each individual file in the fileset, it seems
(unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue? " file)) ;; simplest to just check if the file exists. Bug#9781.
(error "Aborted")) (when (and (file-exists-p file) (not (file-writable-p file)))
;; Maybe we somehow lost permissions on the directory. ;; Make the file+buffer read-write.
(condition-case nil (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue? " file))
(set-file-modes file (logior (file-modes file) 128)) (error "Aborted"))
(error (error "Unable to make file writable"))) ;; Maybe we somehow lost permissions on the directory.
(let ((visited (get-file-buffer file))) (condition-case nil
(when visited (set-file-modes file (logior (file-modes file) 128))
(with-current-buffer visited (error (error "Unable to make file writable")))
(read-only-mode -1)))))) (let ((visited (get-file-buffer file)))
(when visited
(with-current-buffer visited
(read-only-mode -1)))))))
;; Allow user to revert files with no changes ;; Allow user to revert files with no changes
(save-excursion (save-excursion
(dolist (file files) (dolist (file files)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment