[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111428: Try to handle buffer/file mo
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111428: Try to handle buffer/file modifications which conflict with VCS locking. |
Date: |
Sun, 06 Jan 2013 10:58:57 +0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111428
fixes bug: http://debbugs.gnu.org/11490
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2013-01-06 10:58:57 +0800
message:
Try to handle buffer/file modifications which conflict with VCS locking.
* vc/vc-hooks.el (vc-after-save): DTRT for locking VCSes.
* vc/vc.el (vc-next-action): Detect buffer modifications
conflicting with locking VCS operation.
modified:
lisp/ChangeLog
lisp/vc/vc-hooks.el
lisp/vc/vc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-01-05 13:48:16 +0000
+++ b/lisp/ChangeLog 2013-01-06 02:58:57 +0000
@@ -1,3 +1,10 @@
+2013-01-06 Chong Yidong <address@hidden>
+
+ * vc/vc.el (vc-next-action): Detect buffer modifications
+ conflicting with locking VCS operation (Bug#11490).
+
+ * vc/vc-hooks.el (vc-after-save): DTRT for locking VCSes.
+
2013-01-05 Michael Albinus <address@hidden>
* net/tramp-adb.el (tramp-do-parse-file-attributes-with-ls):
=== modified file 'lisp/vc/vc-hooks.el'
--- a/lisp/vc/vc-hooks.el 2013-01-02 16:13:04 +0000
+++ b/lisp/vc/vc-hooks.el 2013-01-06 02:58:57 +0000
@@ -703,19 +703,21 @@
;; the state to 'edited and redisplay the mode line.
(let* ((file buffer-file-name)
(backend (vc-backend file)))
- (and backend
- (or (and (equal (vc-file-getprop file 'vc-checkout-time)
- (nth 5 (file-attributes file)))
- ;; File has been saved in the same second in which
- ;; it was checked out. Clear the checkout-time
- ;; to avoid confusion.
- (vc-file-setprop file 'vc-checkout-time nil))
- t)
- (eq (vc-checkout-model backend (list file)) 'implicit)
- (vc-state-refresh file backend)
- (vc-mode-line file backend))
- ;; Try to avoid unnecessary work, a *vc-dir* buffer is
- ;; present if this is true.
+ (cond
+ ((null backend))
+ ((eq (vc-checkout-model backend (list file)) 'implicit)
+ ;; If the file was saved in the same second in which it was
+ ;; checked out, clear the checkout-time to avoid confusion.
+ (if (equal (vc-file-getprop file 'vc-checkout-time)
+ (nth 5 (file-attributes file)))
+ (vc-file-setprop file 'vc-checkout-time nil))
+ (if (vc-state-refresh file backend)
+ (vc-mode-line file backend)))
+ ;; If we saved an unlocked file on a locking based VCS, that
+ ;; file is not longer up-to-date.
+ ((eq (vc-file-getprop file 'vc-state) 'up-to-date)
+ (vc-file-setprop file 'vc-state nil)))
+ ;; Resynch *vc-dir* buffers, if any are present.
(when vc-dir-buffers
(vc-dir-resynch-file file))))
=== modified file 'lisp/vc/vc.el'
--- a/lisp/vc/vc.el 2013-01-02 16:13:04 +0000
+++ b/lisp/vc/vc.el 2013-01-06 02:58:57 +0000
@@ -659,6 +659,10 @@
(eval-when-compile
(require 'dired))
+(declare-function dired-get-filename "dired" (&optional localp noerror))
+(declare-function dired-move-to-filename "dired" (&optional err eol))
+(declare-function dired-marker-regexp "dired" ())
+
(unless (assoc 'vc-parent-buffer minor-mode-alist)
(setq minor-mode-alist
(cons '(vc-parent-buffer vc-parent-buffer-name)
@@ -1072,6 +1076,17 @@
;; among all the `files'.
(model (nth 4 vc-fileset)))
+ ;; If a buffer has unsaved changes, a checkout would discard those
+ ;; changes, so treat the buffer as having unlocked changes.
+ (when (and (not (eq model 'implicit)) (eq state 'up-to-date))
+ (let ((files files))
+ (while files
+ (let ((buffer (get-file-buffer (car files))))
+ (and buffer
+ (buffer-modified-p buffer)
+ (setq state 'unlocked-changes
+ files nil))))))
+
;; Do the right thing
(cond
((eq state 'missing)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111428: Try to handle buffer/file modifications which conflict with VCS locking.,
Chong Yidong <=