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: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/vc.el,v
Date: Fri, 09 May 2008 16:41:29 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        08/05/09 16:41:27

Index: vc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/vc.el,v
retrieving revision 1.646
retrieving revision 1.647
diff -u -b -r1.646 -r1.647
--- vc.el       9 May 2008 16:01:50 -0000       1.646
+++ vc.el       9 May 2008 16:41:26 -0000       1.647
@@ -1193,7 +1193,12 @@
          state)))
      ;; conflict
      ((eq state 'conflict)
-      (vc-mark-resolved files))
+      ;; FIXME: Is it really the UI we want to provide?
+      ;; In my experience, the conflicted files should be marked as resolved
+      ;; one-by-one when saving the file after resolving the conflicts.
+      ;; I.e. stating explicitly that the conflicts are resolved is done
+      ;; very rarely.
+      (vc-mark-resolved backend files))
      ;; needs-update
      ((eq state 'needs-update)
       (dolist (file files)
@@ -1210,7 +1215,8 @@
        (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)))))
+         (vc-maybe-resolve-conflicts
+           file (vc-call-backend backend 'merge-news file)))))
 
      ;; unlocked-changes
      ((eq state 'unlocked-changes)
@@ -1228,7 +1234,7 @@
              (not (beep))
              (yes-or-no-p (concat "File has unlocked changes.  "
                                   "Claim lock retaining changes? ")))
-           (progn (vc-call steal-lock file)
+           (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.
@@ -1340,7 +1346,7 @@
          (signal (car err) (cdr err))))
       `((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 
'implicit)
                              (not writable))
-                         (if (vc-call latest-on-branch-p file)
+                         (if (vc-call-backend backend 'latest-on-branch-p file)
                              'up-to-date
                            'needs-update)
                        'edited))
@@ -1348,10 +1354,10 @@
   (vc-resynch-buffer file t t)
   (run-hooks 'vc-checkout-hook))
 
-(defun vc-mark-resolved (files)
+(defun vc-mark-resolved (backend files)
   (with-vc-properties
    files
-   (vc-call mark-resolved files)
+   (vc-call-backend backend 'mark-resolved files)
    ;; XXX: Is this TRTD?  Might not be.
    `((vc-state . edited))))
 
@@ -1564,9 +1570,10 @@
   (interactive
    (let* ((vc-fileset (vc-deduce-fileset))
          (files (cdr vc-fileset))
+          (backend (car vc-fileset))
          (first (car files))
          (completion-table
-          (vc-call revision-completion-table files))
+          (vc-call-backend backend 'revision-completion-table files))
          (rev1-default nil)
          (rev2-default nil))
      (cond
@@ -1582,7 +1589,7 @@
        (setq rev1-default (vc-working-revision first)))
       ;; if the file is not locked, use last and previous revisions as defaults
       (t
-       (setq rev1-default (vc-call previous-revision first
+       (setq rev1-default (vc-call-backend backend 'previous-revision first
                                   (vc-working-revision first)))
        (when (string= rev1-default "") (setq rev1-default nil))
        (setq rev2-default (vc-working-revision first))))
@@ -1774,9 +1781,7 @@
          (read-string (concat "Branch or revision to merge from "
                               "(default news on current branch): ")))
     (if (string= first-revision "")
-       (if (not (vc-find-backend-function backend 'merge-news))
-           (error "Sorry, merging news is not implemented for %s" backend)
-         (setq status (vc-call merge-news file)))
+        (setq status (vc-call-backend backend 'merge-news file))
       (if (not (vc-find-backend-function backend 'merge))
          (error "Sorry, merging is not implemented for %s" backend)
        (if (not (vc-branch-p first-revision))
@@ -1788,7 +1793,8 @@
          (setq second-revision first-revision)
          ;; first-revision must be the starting point of the branch
          (setq first-revision (vc-branch-part first-revision)))
-       (setq status (vc-call merge file first-revision second-revision))))
+       (setq status (vc-call-backend backend 'merge file
+                                      first-revision second-revision))))
     (vc-maybe-resolve-conflicts file status "WORKFILE" "MERGE SOURCE")))
 
 (defun vc-maybe-resolve-conflicts (file status &optional name-A name-B)
@@ -2192,7 +2198,8 @@
       (error "Rollback is not supported in %s" backend))
     (when (and (not (eq granularity 'repository)) (/= (length files) 1))
       (error "Rollback requires a singleton fileset or repository versioning"))
-    (when (not (vc-call latest-on-branch-p (car files)))
+    ;; FIXME: latest-on-branch-p should take the fileset.
+    (when (not (vc-call-backend backend 'latest-on-branch-p (car files)))
       (error "Rollback is only possible at the tip revision."))
     ;; If any of the files is visited by the current buffer, make
     ;; sure buffer is saved.  If the user says `no', abort since
@@ -2210,7 +2217,9 @@
     (not-modified)
     (message "Finding changes...")
     (let* ((tip (vc-working-revision (car files)))
-          (previous (vc-call previous-revision (car files) tip)))
+           ;; FIXME: `previous-revision' should take the fileset.
+          (previous (vc-call-backend backend 'previous-revision
+                                      (car files) tip)))
       (vc-diff-internal nil vc-fileset previous tip))
     ;; Display changes
     (unless (yes-or-no-p "Discard these revisions? ")
@@ -2257,10 +2266,8 @@
                     (vc-state file)
                     (substitute-command-keys
                      "\\[vc-next-action] to correct")))
-         (if (not (vc-find-backend-function backend 'merge-news))
-             (error "Sorry, merging news is not implemented for %s"
-                    backend)
-           (vc-maybe-resolve-conflicts file (vc-call merge-news file))))))))
+          (vc-maybe-resolve-conflicts
+           file (vc-call-backend backend 'merge-news file)))))))
 
 (defun vc-version-backup-file (file &optional rev)
   "Return name of backup file for revision REV of FILE.
@@ -2381,8 +2388,8 @@
            (vc-file-setprop file 'vc-checkout-time nil)))))
     (when move
       (vc-switch-backend file old-backend)
-      (setq comment (vc-call comment-history file))
-      (vc-call unregister file))
+      (setq comment (vc-call-backend old-backend 'comment-history file))
+      (vc-call-backend old-backend 'unregister file))
     (vc-switch-backend file new-backend)
     (when (or move edited)
       (vc-file-setprop file 'vc-state 'edited)
@@ -2446,7 +2453,7 @@
        ;; command, kill the buffer created by the above
        ;; `find-file-noselect' call.
        (unless buf (kill-buffer (current-buffer)))))
-    (vc-call delete-file file)
+    (vc-call-backend backend 'delete-file file)
     ;; If the backend hasn't deleted the file itself, let's do it for him.
     (when (file-exists-p file) (delete-file file))
     ;; Forget what VC knew about the file.
@@ -2701,7 +2708,7 @@
   "Return a string with all log entries stored in BACKEND for FILE."
   (when (vc-find-backend-function backend 'print-log)
     (with-current-buffer "*vc*"
-      (vc-call print-log (list file))
+      (vc-call-backend backend 'print-log (list file))
       (vc-call-backend backend 'wash-log)
       (buffer-string))))
 
@@ -2718,7 +2725,7 @@
       (vc-file-tree-walk
        dir
        (lambda (f)
-        (vc-call assign-name f name))))))
+        (vc-call-backend backend 'assign-name f name))))))
 
 (defun vc-default-retrieve-snapshot (backend dir name update)
   (if (string= name "")
@@ -2728,7 +2735,7 @@
          (lambda (f) (and
                 (vc-up-to-date-p f)
                 (vc-error-occurred
-                 (vc-call checkout f nil "")
+                 (vc-call-backend backend 'checkout f nil "")
                  (when update (vc-resynch-buffer f t t)))))))
     (let ((result (vc-snapshot-precondition dir)))
       (if (stringp result)
@@ -2737,7 +2744,7 @@
         (vc-file-tree-walk
          dir
          (lambda (f) (vc-error-occurred
-                (vc-call checkout f nil name)
+                (vc-call-backend backend 'checkout f nil name)
                 (when update (vc-resynch-buffer f t t)))))))))
 
 (defun vc-default-revert (backend file contents-done)
@@ -2759,7 +2766,8 @@
                   ;; Change buffer to get local value of vc-checkout-switches.
                   (with-current-buffer file-buffer
                     (let ((default-directory (file-name-directory file)))
-                      (vc-call find-revision file rev outbuf)))))
+                      (vc-call-backend backend 'find-revision
+                                       file rev outbuf)))))
               (setq failed nil))
           (when backup-name
             (if failed
@@ -3015,18 +3023,20 @@
                ;; In case it had to be uniquified.
                (setq temp-buffer-name (buffer-name))))
     (with-output-to-temp-buffer temp-buffer-name
-      (vc-call annotate-command file (get-buffer temp-buffer-name) rev)
+      (let ((backend (vc-backend file)))
+        (vc-call-backend backend 'annotate-command file
+                         (get-buffer temp-buffer-name) rev)
       ;; we must setup the mode first, and then set our local
       ;; variables before the show-function is called at the exit of
       ;; with-output-to-temp-buffer
       (with-current-buffer temp-buffer-name
         (unless (equal major-mode 'vc-annotate-mode)
          (vc-annotate-mode))
-        (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
+          (set (make-local-variable 'vc-annotate-backend) backend)
         (set (make-local-variable 'vc-annotate-parent-file) file)
         (set (make-local-variable 'vc-annotate-parent-rev) rev)
         (set (make-local-variable 'vc-annotate-parent-display-mode)
-             display-mode)))
+               display-mode))))
 
     (with-current-buffer temp-buffer-name
       (vc-exec-after
@@ -3103,7 +3113,8 @@
       (if (not rev-at-line)
          (message "Cannot extract revision number from the current line")
        (setq prev-rev
-             (vc-call previous-revision vc-annotate-parent-file rev-at-line))
+             (vc-call-backend vc-annotate-backend 'previous-revision
+                               vc-annotate-parent-file rev-at-line))
        (vc-annotate-warp-revision prev-rev)))))
 
 (defun vc-annotate-show-log-revision-at-line ()
@@ -3126,7 +3137,8 @@
       (if (not rev-at-line)
          (message "Cannot extract revision number from the current line")
        (setq prev-rev
-             (vc-call previous-revision vc-annotate-parent-file rev-at-line))
+             (vc-call-backend vc-annotate-backend 'previous-revision
+                               vc-annotate-parent-file rev-at-line))
        (if (not prev-rev)
            (message "Cannot diff from any revision prior to %s" rev-at-line)
          (save-window-excursion
@@ -3157,7 +3169,7 @@
        ((and (integerp revspec) (> revspec 0))
        (setq newrev vc-annotate-parent-rev)
        (while (and (> revspec 0) newrev)
-              (setq newrev (vc-call next-revision
+          (setq newrev (vc-call-backend vc-annotate-backend 'next-revision
                                     vc-annotate-parent-file newrev))
               (setq revspec (1- revspec)))
        (unless newrev
@@ -3166,7 +3178,7 @@
        ((and (integerp revspec) (< revspec 0))
        (setq newrev vc-annotate-parent-rev)
        (while (and (< revspec 0) newrev)
-              (setq newrev (vc-call previous-revision
+          (setq newrev (vc-call-backend vc-annotate-backend 'previous-revision
                                     vc-annotate-parent-file newrev))
               (setq revspec (1+ revspec)))
        (unless newrev




reply via email to

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