emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2fb8b14: Remove clear-headers from VC's public meth


From: Eric S. Raymond
Subject: [Emacs-diffs] master 2fb8b14: Remove clear-headers from VC's public method set.
Date: Tue, 02 Dec 2014 04:50:53 +0000

branch: master
commit 2fb8b146f74791d7cbe702292b8197913d437c75
Author: Eric S. Raymond <address@hidden>
Commit: Eric S. Raymond <address@hidden>

    Remove clear-headers from VC's public method set.
    
    * vc/vc.el and all backends: API simplification; clear-headers is no
    longer a public method.  It is now local to the one place it's used,
    in the RCS steal-lock method.
---
 lisp/ChangeLog    |    6 ++++++
 lisp/vc/vc-git.el |    1 -
 lisp/vc/vc-hg.el  |    1 -
 lisp/vc/vc-rcs.el |   19 +++++++++++++++++--
 lisp/vc/vc-src.el |    1 -
 lisp/vc/vc.el     |   31 -------------------------------
 6 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6c2b33e..d005cbe 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-02  Eric S. Raymond  <address@hidden>
+
+       * vc/vc.el and all backends: API simplification; clear-headers
+       is no longer a public method.  It is now local to the one place
+       it's used, in the RCS steal-lock method.
+
 2014-12-01  Eric S. Raymond  <address@hidden>
 
        * vc/vc.el and all backends: API simplification; could-register
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 93c5ff8..3538f2c 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -95,7 +95,6 @@
 ;; - previous-revision (file rev)                  OK
 ;; - next-revision (file rev)                      OK
 ;; - check-headers ()                              COULD BE SUPPORTED
-;; - clear-headers ()                              NOT NEEDED
 ;; - delete-file (file)                            OK
 ;; - rename-file (old new)                         OK
 ;; - find-file-hook ()                             OK
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index b5be8d5..35f5354 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -85,7 +85,6 @@
 ;; - previous-revision (file rev)              OK
 ;; - next-revision (file rev)                  OK
 ;; - check-headers ()                          ??
-;; - clear-headers ()                          ??
 ;; - delete-file (file)                        TEST IT
 ;; - rename-file (old new)                     OK
 ;; - find-file-hook ()                         added for bug#10709
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index c9e4d40..40a1027 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -528,7 +528,22 @@ Needs RCS 5.6.2 or later for -M."
     (vc-do-command "*vc*" 0 "rcs" (vc-master-name file) "-M" (concat "-u" rev))
     ;; Do a real checkout after stealing the lock, so that we see
     ;; expanded headers.
-    (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" (concat "-l" 
rev))))
+    (vc-do-command "*vc*" 0 "co" (vc-master-name file) "-f" (concat "-l" rev))
+    ;; Must clear any headers here because they wouldn't
+    ;; show that the file is locked now.
+    (let* ((filename (or file buffer-file-name))
+          (visited (find-buffer-visiting filename)))
+      (if visited
+         (let ((context (vc-buffer-context)))
+           ;; save-excursion may be able to relocate point and mark
+           ;; properly.  If it fails, vc-restore-buffer-context
+           ;; will give it a second try.
+           (save-excursion
+             (vc-rcs-clear-headers))
+           (vc-restore-buffer-context context))
+       (set-buffer (find-file-noselect filename))
+       (vc-rcs-clear-headers)
+       (kill-buffer filename)))))
 
 (defun vc-rcs-modify-change-comment (files rev comment)
   "Modify the change comments change on FILES on a specified REV.  If FILE is a
@@ -943,7 +958,7 @@ Uses `rcs2log' which only works for RCS and CVS."
 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t)))
 
 (defun vc-rcs-clear-headers ()
-  "Implementation of vc-clear-headers for RCS."
+  "Clear RCS header value parts."
   (let ((case-fold-search nil))
     (goto-char (point-min))
     (while (re-search-forward
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index c93ff96..f3d0585 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -73,7 +73,6 @@
 ;; - previous-revision (file rev)              ??
 ;; - next-revision (file rev)                  ??
 ;; - check-headers ()                          ??
-;; - clear-headers ()                          ??
 ;; - delete-file (file)                        ??
 ;; * rename-file (old new)                     OK
 ;; - find-file-hook ()                         NOT NEEDED
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 9e6b049..52deb13 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -514,15 +514,6 @@
 ;;
 ;;   Return non-nil if the current buffer contains any version headers.
 ;;
-;; - clear-headers ()
-;;
-;;   In the current buffer, reset all version headers to their unexpanded
-;;   form.  This function should be provided if the state-querying code
-;;   for this backend uses the version headers to determine the state of
-;;   a file.  This function will then be called whenever VC changes the
-;;   version control state in such a way that the headers would give
-;;   wrong information.
-;;
 ;; - delete-file (file)
 ;;
 ;;   Delete FILE and mark it as deleted in the repository.  If this
@@ -1287,9 +1278,6 @@ For old-style locking-based version control systems, like 
RCS:
                                   "Claim lock retaining changes? ")))
            (progn (vc-call-backend backend 'steal-lock file)
                   (clear-visited-file-modtime)
-                  ;; Must clear any headers here because they wouldn't
-                  ;; show that the file is locked now.
-                  (vc-clear-headers file)
                   (write-file buffer-file-name)
                   (vc-mode-line file backend))
          (if (not (yes-or-no-p
@@ -2001,25 +1989,6 @@ the variable `vc-BACKEND-header'."
              (when (string-match (car f) buffer-file-name)
                (insert (format (cdr f) (car hdstrings)))))))))))
 
-(defun vc-clear-headers (&optional file)
-  "Clear all version headers in the current buffer (or FILE).
-The headers are reset to their non-expanded form."
-  (let* ((filename (or file buffer-file-name))
-        (visited (find-buffer-visiting filename))
-        (backend (vc-backend filename)))
-    (when (vc-find-backend-function backend 'clear-headers)
-       (if visited
-           (let ((context (vc-buffer-context)))
-             ;; save-excursion may be able to relocate point and mark
-             ;; properly.  If it fails, vc-restore-buffer-context
-             ;; will give it a second try.
-             (save-excursion
-               (vc-call-backend backend 'clear-headers))
-             (vc-restore-buffer-context context))
-         (set-buffer (find-file-noselect filename))
-         (vc-call-backend backend 'clear-headers)
-         (kill-buffer filename)))))
-
 (defun vc-modify-change-comment (files rev oldcomment)
   "Edit the comment associated with the given files and revision."
   ;; Less of a kluge than it looks like; log-view mode only passes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]