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.el,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/vc.el,v
Date: Fri, 18 Jan 2008 14:12:47 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/01/18 14:12:46

Index: vc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/vc.el,v
retrieving revision 1.514
retrieving revision 1.515
diff -u -b -r1.514 -r1.515
--- vc.el       16 Jan 2008 06:22:57 -0000      1.514
+++ vc.el       18 Jan 2008 14:12:43 -0000      1.515
@@ -537,6 +537,9 @@
 ;; - make it easier to write logs, maybe C-x 4 a should add to the log
 ;;   buffer if there's one instead of the ChangeLog.
 ;;
+;; - make vc-state for all backends return 'unregistered instead of
+;;   nil for unregistered files, then update vc-next-action.
+;;
 ;; - deal with push/pull operations.
 ;;
 ;; - decide if vc-status should replace vc-dired.
@@ -1434,9 +1437,9 @@
         revision)
     ;; Verify that the fileset is homogenous
     (dolist (file (cdr files))
-      (if (not (vc-compatible-state (vc-state file) state))
+      (unless (vc-compatible-state (vc-state file) state)
          (error "Fileset is in a mixed-up state"))
-      (if (not (eq (vc-checkout-model file) model))
+      (unless (eq (vc-checkout-model file) model)
          (error "Fileset has mixed checkout models")))
     ;; Check for buffers in the fileset not matching the on-disk contents.
     (dolist (file files)
@@ -1458,13 +1461,15 @@
                (error "Aborted"))
            ;; Now, check if we have unsaved changes.
            (vc-buffer-sync t)
-           (if (buffer-modified-p)
+           (when (buffer-modified-p)
                (or (y-or-n-p (message "Use %s on disk, keeping modified 
buffer? " file))
                    (error "Aborted")))))))
     ;; Do the right thing
     (cond
      ;; Files aren't registered
-     ((not state)
+     ((or (not state)  ;; RCS uses nil for unregistered files.
+         (eq state 'unregistered)
+         (eq state 'ignored))
       (mapc 'vc-register files))
      ;; Files are up-to-date, or need a merge and user specified a revision
      ((or (eq state 'up-to-date) (and verbose (eq state 'needs-patch)))
@@ -1488,32 +1493,30 @@
       (let ((ready-for-commit files))
        ;; If files are edited but read-only, give user a chance to correct
        (dolist (file files)
-         (if (not (file-writable-p file))
-             (progn
+         (unless (file-writable-p file)
                ;; Make the file+buffer read-write.
                (unless (y-or-n-p (format "%s is edited but read-only; make it 
writable and continue?" file))
                  (error "Aborted"))
                (set-file-modes file (logior (file-modes file) 128))
                (let ((visited (get-file-buffer file)))
-                 (if visited
+             (when visited
                      (with-current-buffer visited
-                       (toggle-read-only -1)))))))
+                 (toggle-read-only -1))))))
        ;; Allow user to revert files with no changes
        (save-excursion
           (dolist (file files)
             (let ((visited (get-file-buffer file)))
               ;; For files with locking, if the file does not contain
               ;; any changes, just let go of the lock, i.e. revert.
-              (if (and (not (eq model 'implicit))
+              (when (and (not (eq model 'implicit))
                        (vc-workfile-unchanged-p file)
                        ;; If buffer is modified, that means the user just
                        ;; said no to saving it; in that case, don't revert,
                        ;; because the user might intend to save after
                        ;; finishing the log entry and committing.
                        (not (and visited (buffer-modified-p))))
-                  (progn
                     (vc-revert-file file)
-                    (delete file ready-for-commit))))))
+               (delete file ready-for-commit)))))
        ;; Remaining files need to be committed
        (if (not ready-for-commit)
            (message "No files remain to be committed")
@@ -1539,13 +1542,13 @@
                          "%s is not up-to-date.  Get latest revision? "
                          (file-name-nondirectory file)))
            (vc-checkout file (eq model 'implicit) t)
-         (if (and (not (eq model 'implicit))
+         (when (and (not (eq model 'implicit))
                   (yes-or-no-p "Lock this revision? "))
              (vc-checkout file t)))))
      ;; needs-merge
      ((eq state 'needs-merge)
       (dolist (file files)
-       (if (yes-or-no-p (format
+       (when (yes-or-no-p (format
                          "%s is not up-to-date.  Merge in changes now? "
                          (file-name-nondirectory file)))
            (vc-maybe-resolve-conflicts file (vc-call merge-news file)))))
@@ -1697,7 +1700,7 @@
 entered COMMENT.  If COMMENT is t, also do action immediately with an
 empty comment.  Remember the file's buffer in `vc-parent-buffer'
 \(current one if no file).  AFTER-HOOK specifies the local value
-for vc-log-operation-hook."
+for `vc-log-after-operation-hook'."
   (let ((parent
          (if (eq major-mode 'vc-dired-mode)
              ;; If we are called from VC dired, the parent buffer is
@@ -2562,6 +2565,7 @@
   ;; Must be in sync with vc-status-printer.
   (forward-char 25))
 
+;;;###autoload
 (defun vc-status (dir)
   "Show the VC status for DIR."
   (interactive "DVC status for directory: ")




reply via email to

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