diff options
| author | Glenn Morris | 2012-09-26 23:59:21 -0700 |
|---|---|---|
| committer | Glenn Morris | 2012-09-26 23:59:21 -0700 |
| commit | daee954c00b30e0253fde6e2c2f3b4a5c70f2a06 (patch) | |
| tree | 30f8db3719d20ae88d4db56845d10b4b0c692123 | |
| parent | 4695c85095e55ca7d919d788ede0149fc1f56a59 (diff) | |
| download | emacs-daee954c00b30e0253fde6e2c2f3b4a5c70f2a06.tar.gz emacs-daee954c00b30e0253fde6e2c2f3b4a5c70f2a06.zip | |
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
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 39 |
2 files changed, 26 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2bca85608be..7c803fcd2ea 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-09-27 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * vc/vc.el (vc-next-action): Only gripe about committing read-only | ||
| 4 | files for RCS and SCCS. (Bug#9781) | ||
| 5 | |||
| 1 | 2012-09-27 Chong Yidong <cyd@gnu.org> | 6 | 2012-09-27 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * progmodes/verilog-mode.el (verilog-mode-release-emacs): Fix last | 8 | * progmodes/verilog-mode.el (verilog-mode-release-emacs): Fix last |
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 89e0d0c3ecd..2da721b41d8 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -1105,24 +1105,27 @@ For old-style locking-based version control systems, like RCS: | |||
| 1105 | ;; Files have local changes | 1105 | ;; Files have local changes |
| 1106 | ((vc-compatible-state state 'edited) | 1106 | ((vc-compatible-state state 'edited) |
| 1107 | (let ((ready-for-commit files)) | 1107 | (let ((ready-for-commit files)) |
| 1108 | ;; If files are edited but read-only, give user a chance to correct. | 1108 | ;; CVS, SVN and bzr don't care about read-only (bug#9781). |
| 1109 | (dolist (file files) | 1109 | ;; RCS does, SCCS might (someone should check...). |
| 1110 | ;; If committing a mix of removed and edited files, the | 1110 | (when (memq backend '(RCS SCCS)) |
| 1111 | ;; fileset has state = 'edited. Rather than checking the | 1111 | ;; If files are edited but read-only, give user a chance to correct. |
| 1112 | ;; state of each individual file in the fileset, it seems | 1112 | (dolist (file files) |
| 1113 | ;; simplest to just check if the file exists. Bug#9781. | 1113 | ;; If committing a mix of removed and edited files, the |
| 1114 | (when (and (file-exists-p file) (not (file-writable-p file))) | 1114 | ;; fileset has state = 'edited. Rather than checking the |
| 1115 | ;; Make the file+buffer read-write. | 1115 | ;; state of each individual file in the fileset, it seems |
| 1116 | (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue? " file)) | 1116 | ;; simplest to just check if the file exists. Bug#9781. |
| 1117 | (error "Aborted")) | 1117 | (when (and (file-exists-p file) (not (file-writable-p file))) |
| 1118 | ;; Maybe we somehow lost permissions on the directory. | 1118 | ;; Make the file+buffer read-write. |
| 1119 | (condition-case nil | 1119 | (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue? " file)) |
| 1120 | (set-file-modes file (logior (file-modes file) 128)) | 1120 | (error "Aborted")) |
| 1121 | (error (error "Unable to make file writable"))) | 1121 | ;; Maybe we somehow lost permissions on the directory. |
| 1122 | (let ((visited (get-file-buffer file))) | 1122 | (condition-case nil |
| 1123 | (when visited | 1123 | (set-file-modes file (logior (file-modes file) 128)) |
| 1124 | (with-current-buffer visited | 1124 | (error (error "Unable to make file writable"))) |
| 1125 | (read-only-mode -1)))))) | 1125 | (let ((visited (get-file-buffer file))) |
| 1126 | (when visited | ||
| 1127 | (with-current-buffer visited | ||
| 1128 | (read-only-mode -1))))))) | ||
| 1126 | ;; Allow user to revert files with no changes | 1129 | ;; Allow user to revert files with no changes |
| 1127 | (save-excursion | 1130 | (save-excursion |
| 1128 | (dolist (file files) | 1131 | (dolist (file files) |