emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/vc-rcs.el,v


From: Eric S. Raymond
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-rcs.el,v
Date: Wed, 18 Jul 2007 16:32:38 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Eric S. Raymond <esr>   07/07/18 16:32:37

Index: vc-rcs.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc-rcs.el,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- vc-rcs.el   24 Mar 2007 11:32:37 -0000      1.50
+++ vc-rcs.el   18 Jul 2007 16:32:37 -0000      1.51
@@ -96,6 +96,11 @@
   :group 'vc)
 
 
+;;; Properties of the backend
+
+(defun vc-rcs-revision-granularity ()
+     'file)
+
 ;;;
 ;;; State-querying functions
 ;;;
@@ -230,10 +235,15 @@
 ;;; State-changing functions
 ;;;
 
-(defun vc-rcs-register (file &optional rev comment)
-  "Register FILE into the RCS version-control system.
-REV is the optional revision number for the file.  COMMENT can be used
-to provide an initial description of FILE.
+(defun vc-rcs-create-repo ()
+  "Create a new RCS repository."
+  ;; RCS is totally file-oriented, so all we have to do is make the directory
+  (make-directory "RCS"))
+
+(defun vc-rcs-register (files &optional rev comment)
+  "Register FILES into the RCS version-control system.
+REV is the optional revision number for the files.  COMMENT can be used
+to provide an initial description for each FILES.
 
 `vc-register-switches' and `vc-rcs-register-switches' are passed to
 the RCS command (in that order).
@@ -241,6 +251,7 @@
 Automatically retrieve a read-only version of the file with keywords
 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
     (let ((subdir (expand-file-name "RCS" (file-name-directory file))))
+    (dolist (file files)
       (and (not (file-exists-p subdir))
           (not (directory-files (file-name-directory file)
                                 nil ".*,v$" t))
@@ -273,7 +284,7 @@
                          (if (re-search-forward
                               "^initial revision: \\([0-9.]+\\).*\n"
                               nil t)
-                             (match-string 1))))))
+                             (match-string 1)))))))
 
 (defun vc-rcs-responsible-p (file)
   "Return non-nil if RCS thinks it would be responsible for registering FILE."
@@ -307,9 +318,11 @@
         (yes-or-no-p (format "Directory %s is empty; remove it? " dir))
         (delete-directory dir))))
 
-(defun vc-rcs-checkin (file rev comment)
+(defun vc-rcs-checkin (files rev comment)
   "RCS-specific version of `vc-backend-checkin'."
   (let ((switches (vc-switches 'RCS 'checkin)))
+    ;; Now operate on the files
+    (dolist (file files)
     (let ((old-version (vc-workfile-version file)) new-version
          (default-branch (vc-file-getprop file 'vc-rcs-default-branch)))
       ;; Force branch creation if an appropriate
@@ -355,7 +368,7 @@
            ;; exit status of 1 is also accepted.
            ;; It means that the lock was removed before.
            (vc-do-command nil 1 "rcs" (vc-name file)
-                          (concat "-u" old-version))))))))
+                            (concat "-u" old-version)))))))))
 
 (defun vc-rcs-find-version (file rev buffer)
   (apply 'vc-do-command
@@ -427,28 +440,29 @@
                    new-version)))))
        (message "Checking out %s...done" file)))))
 
-(defun vc-rcs-revert (file &optional contents-done)
-  "Revert FILE to the version it was based on."
-  (vc-do-command nil 0 "co" (vc-name file) "-f"
-                 (concat (if (eq (vc-state file) 'edited) "-u" "-r")
-                         (vc-workfile-version file))))
-
-(defun vc-rcs-cancel-version (file editable)
-  "Undo the most recent checkin of FILE.
-EDITABLE non-nil means previous version should be locked."
-  (let* ((target (vc-workfile-version file))
-        (previous (if (vc-trunk-p target) "" (vc-branch-part target)))
+(defun vc-rcs-rollback (files)
+  "Roll back, undoing the most recent checkins of FILES."
+  (if (not files)
+      (error "RCS backend doesn't support directory-level rollback."))
+  (dolist (file files)
+         (let* ((discard (vc-workfile-version file))
+                (previous (if (vc-trunk-p discard) "" (vc-branch-part 
discard)))
         (config (current-window-configuration))
         (done nil))
-    (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target))
-    ;; Check out the most recent remaining version.  If it fails, because
-    ;; the whole branch got deleted, do a double-take and check out the
-    ;; version where the branch started.
+           (if (null (yes-or-no-p (format "Remove version %s from %s history? 
" 
+                                          discard file)))
+               (error "Aborted"))
+           (message "Removing revision %s from %s." discard file)
+           (vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" discard))
+           ;; Check out the most recent remaining version.  If it
+           ;; fails, because the whole branch got deleted, do a
+           ;; double-take and check out the version where the branch
+           ;; started.
     (while (not done)
       (condition-case err
          (progn
            (vc-do-command nil 0 "co" (vc-name file) "-f"
-                          (concat (if editable "-l" "-u") previous))
+                                  (concat "-u" previous))
            (setq done t))
        (error (set-buffer "*vc*")
               (goto-char (point-min))
@@ -460,7 +474,13 @@
                          ;; restoring the old window configuration.
                          (set-window-configuration config))
                 ;; No, it was some other error: re-signal it.
-                (signal (car err) (cdr err))))))))
+                        (signal (car err) (cdr err)))))))))
+
+(defun vc-rcs-revert (file &optional contents-done)
+  "Revert FILE to the version it was based on."
+  (vc-do-command nil 0 "co" (vc-name file) "-f"
+                 (concat (if (eq (vc-state file) 'edited) "-u" "-r")
+                         (vc-workfile-version file))))
 
 (defun vc-rcs-merge (file first-version &optional second-version)
   "Merge changes into current working copy of FILE.
@@ -484,19 +504,38 @@
 ;;; History functions
 ;;;
 
-(defun vc-rcs-print-log (file &optional buffer)
+(defun vc-rcs-print-log (files &optional buffer)
   "Get change log associated with FILE."
-  (vc-do-command buffer 0 "rlog" (vc-name file)))
+  (vc-do-command buffer 0 "rlog" (mapcar 'vc-name files)))
 
-(defun vc-rcs-diff (file &optional oldvers newvers buffer)
-  "Get a difference report using RCS between two versions of FILE."
-  (if (not oldvers) (setq oldvers (vc-workfile-version file)))
-  (apply 'vc-do-command (or buffer "*vc-diff*") 1 "rcsdiff" file
+(defun vc-rcs-diff (files &optional oldvers newvers buffer)
+  "Get a difference report using RCS between two sets of files."
+  (apply 'vc-do-command (or buffer "*vc-diff*") 
+        1              ;; Always go synchronous, the repo is local
+        "rcsdiff" (vc-expand-dirs files)
          (append (list "-q"
-                       (concat "-r" oldvers)
+                       (and oldvers (concat "-r" oldvers))
                        (and newvers (concat "-r" newvers)))
                  (vc-switches 'RCS 'diff))))
 
+(defun vc-rcs-wash-log ()
+  "Remove all non-comment information from log output."
+  (let ((separator (concat "^-+\nrevision [0-9.]+\ndate: .*\n"
+                          "\\(branches: .*;\n\\)?"
+                          "\\(\\*\\*\\* empty log message \\*\\*\\*\n\\)?")))
+    (goto-char (point-max)) (forward-line -1)
+    (while (looking-at "=*\n")
+      (delete-char (- (match-end 0) (match-beginning 0)))
+      (forward-line -1))
+    (goto-char (point-min))
+    (if (looking-at "[\b\t\n\v\f\r ]+")
+       (delete-char (- (match-end 0) (match-beginning 0))))
+    (goto-char (point-min))
+    (re-search-forward separator nil t)
+    (delete-region (point-min) (point))
+    (while (re-search-forward separator nil t)
+      (delete-region (match-beginning 0) (match-end 0)))))
+
 (defun vc-rcs-annotate-command (file buffer &optional revision)
   "Annotate FILE, inserting the results in BUFFER.
 Optional arg REVISION is a revision to annotate from."
@@ -666,7 +705,6 @@
                              "  "
                              (aref rda 0)
                              ls)
-                      :vc-annotate-prefix t
                       :vc-rcs-r/d/a rda)))
         (maphash
          (if all-me




reply via email to

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