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-svn.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/vc-svn.el
Date: Thu, 08 May 2003 14:31:21 -0400

Index: emacs/lisp/vc-svn.el
diff -c emacs/lisp/vc-svn.el:1.5 emacs/lisp/vc-svn.el:1.6
*** emacs/lisp/vc-svn.el:1.5    Mon May  5 12:13:39 2003
--- emacs/lisp/vc-svn.el        Thu May  8 14:31:21 2003
***************
*** 32,41 ****
  
  ;;; Bugs:
  
! ;; - VC-dired is either not working or (really) dog slow.
! ;; - vc-print-log does not always jump to the proper log entry because
! ;;   it tries to jump to version 1234 even if there's only an entry
! ;;   for 1232 (because the file hasn't changed since).
  
  ;;; Code:
  
--- 32,38 ----
  
  ;;; Bugs:
  
! ;; - VC-dired is (really) slow.
  
  ;;; Code:
  
***************
*** 198,212 ****
  
  (defun vc-svn-dired-state-info (file)
    "SVN-specific version of `vc-dired-state-info'."
!   (let* ((svn-state (vc-state file))
!        (state (cond ((eq svn-state 'edited)   "modified")
!                     ((eq svn-state 'needs-patch)      "patch")
!                     ((eq svn-state 'needs-merge)      "merge")
!                     ;; FIXME: those two states cannot occur right now
!                     ((eq svn-state 'unlocked-changes) "conflict")
!                     ((eq svn-state 'locally-added)    "added")
!                     )))
!     (if state (concat "(" state ")"))))
  
  
  ;;;
--- 195,206 ----
  
  (defun vc-svn-dired-state-info (file)
    "SVN-specific version of `vc-dired-state-info'."
!   (let ((svn-state (vc-state file)))
!     (cond ((eq svn-state 'edited)
!          (if (equal (vc-workfile-version file) "0")
!              "(added)" "(modified)"))
!         ((eq svn-state 'needs-patch) "(patch)")
!         ((eq svn-state 'needs-merge) "(merge)"))))
  
  
  ;;;
***************
*** 219,237 ****
  
  `vc-register-switches' and `vc-svn-register-switches' are passed to
  the SVN command (in that order)."
!   (let ((switches (append
!                  (if (stringp vc-register-switches)
!                      (list vc-register-switches)
!                    vc-register-switches)
!                  (if (stringp vc-svn-register-switches)
!                      (list vc-svn-register-switches)
!                    vc-svn-register-switches))))
! 
!     (apply 'vc-svn-command nil 0 file
!          "add"
!          ;; (and comment (string-match "[^\t\n ]" comment)
!          ;;   (concat "-m" comment))
!          switches)))
  
  (defun vc-svn-responsible-p (file)
    "Return non-nil if SVN thinks it is responsible for FILE."
--- 213,223 ----
  
  `vc-register-switches' and `vc-svn-register-switches' are passed to
  the SVN command (in that order)."
!   (apply 'vc-svn-command nil 0 file
!        "add"
!        ;; (and comment (string-match "[^\t\n ]" comment)
!        ;;     (concat "-m" comment))
!        (vc-switches 'SVN 'register)))
  
  (defun vc-svn-responsible-p (file)
    "Return non-nil if SVN thinks it is responsible for FILE."
***************
*** 246,263 ****
  
  (defun vc-svn-checkin (file rev comment)
    "SVN-specific version of `vc-backend-checkin'."
!   (let ((switches (if (stringp vc-checkin-switches)
!                     (list vc-checkin-switches)
!                   vc-checkin-switches))
!       status)
!     (setq status (apply 'vc-svn-command nil 1 file
!                       "ci" (list* "-m" comment switches)))
      (set-buffer "*vc*")
      (goto-char (point-min))
      (unless (equal status 0)
        ;; Check checkin problem.
        (cond
!        ((re-search-forward "Up-to-date check failed" nil t)
          (vc-file-setprop file 'vc-state 'needs-merge)
          (error (substitute-command-keys
                  (concat "Up-to-date check failed: "
--- 232,245 ----
  
  (defun vc-svn-checkin (file rev comment)
    "SVN-specific version of `vc-backend-checkin'."
!   (let ((status (apply 'vc-svn-command nil 1 file
!                      "ci" (list* "-m" comment (vc-switches 'SVN 'checkin)))))
      (set-buffer "*vc*")
      (goto-char (point-min))
      (unless (equal status 0)
        ;; Check checkin problem.
        (cond
!        ((search-forward "Transaction is out of date" nil t)
          (vc-file-setprop file 'vc-state 'needs-merge)
          (error (substitute-command-keys
                  (concat "Up-to-date check failed: "
***************
*** 279,295 ****
         "cat"
         (and rev (not (string= rev ""))
              (concat "-r" rev))
!        (if (stringp vc-checkout-switches)
!            (list vc-checkout-switches)
!          vc-checkout-switches)))
  
  (defun vc-svn-checkout (file &optional editable rev)
    (message "Checking out %s..." file)
    (with-current-buffer (or (get-file-buffer file) (current-buffer))
!     (let ((switches (if (stringp vc-checkout-switches)
!                       (list vc-checkout-switches)
!                     vc-checkout-switches)))
!       (vc-call update file editable rev switches)))
    (vc-mode-line file)
    (message "Checking out %s...done" file))
  
--- 261,272 ----
         "cat"
         (and rev (not (string= rev ""))
              (concat "-r" rev))
!        (vc-switches 'SVN 'checkout)))
  
  (defun vc-svn-checkout (file &optional editable rev)
    (message "Checking out %s..." file)
    (with-current-buffer (or (get-file-buffer file) (current-buffer))
!     (vc-call update file editable rev (vc-switches 'SVN 'checkout)))
    (vc-mode-line file)
    (message "Checking out %s...done" file))
  
***************
*** 403,436 ****
  
  (defun vc-svn-diff (file &optional oldvers newvers)
    "Get a difference report using SVN between two versions of FILE."
!   (let (status (diff-switches-list (vc-diff-switches-list 'SVN)))
!     (if (string= (vc-workfile-version file) "0")
!       ;; This file is added but not yet committed; there is no master file.
!       (if (or oldvers newvers)
!           (error "No revisions of %s exist" file)
!         ;; We regard this as "changed".
!         ;; Diff it against /dev/null.
!           ;; Note: this is NOT a "svn diff".
!           (apply 'vc-do-command "*vc-diff*"
!                  1 "diff" file
!                  (append diff-switches-list '("/dev/null"))))
!       (setq status
!             (apply 'vc-svn-command "*vc-diff*"
!                    (if (and (vc-svn-stay-local-p file)
!                           (or oldvers newvers) ; Svn diffs those locally.
!                           (fboundp 'start-process))
!                      'async
!                    1)
!                    file "diff"
                   (append
                    (when oldvers
!                     (list "-r"
!                           (if newvers (concat oldvers ":" newvers) oldvers)))
!                   (when diff-switches-list
!                     (list "-x" (mapconcat 'identity diff-switches-list " 
"))))))
!       (if (vc-svn-stay-local-p file)
!           1 ;; async diff, pessimistic assumption
!         status))))
  
  (defun vc-svn-diff-tree (dir &optional rev1 rev2)
    "Diff all files at and below DIR."
--- 380,415 ----
  
  (defun vc-svn-diff (file &optional oldvers newvers)
    "Get a difference report using SVN between two versions of FILE."
!   (if (string= (vc-workfile-version file) "0")
!       ;; This file is added but not yet committed; there is no master file.
!       (if (or oldvers newvers)
!         (error "No revisions of %s exist" file)
!       ;; We regard this as "changed".
!       ;; Diff it against /dev/null.
!       ;; Note: this is NOT a "svn diff".
!       (apply 'vc-do-command "*vc-diff*"
!              1 "diff" file
!              (append (vc-switches nil 'diff) '("/dev/null")))
!       ;; Even if it's empty, it's locally modified.
!       1)
!     (let* ((switches (vc-switches 'SVN 'diff))
!          (async (and (vc-svn-stay-local-p file)
!                      (or oldvers newvers) ; Svn diffs those locally.
!                      (fboundp 'start-process)))
!          (status
!           (apply 'vc-svn-command "*vc-diff*"
!                  (if async 'async 1)
!                  file "diff"
                   (append
+                   (when switches
+                     (list "-x" (mapconcat 'identity switches " ")))
                    (when oldvers
!                     (list "-r" (if newvers (concat oldvers ":" newvers)
!                                  oldvers)))))))
!       (if async 1                   ; async diff => pessimistic assumption
!       ;; For some reason `svn diff' does not return a useful
!       ;; status w.r.t whether the diff was empty or not.
!       (buffer-size (get-buffer "*vc-diff*"))))))
  
  (defun vc-svn-diff-tree (dir &optional rev1 rev2)
    "Diff all files at and below DIR."
***************
*** 450,463 ****
                   (vc-diff-internal ',f ',rev1 ',rev2))))))
        ;; svn diff: use a single call for the entire tree
        (let ((coding-system-for-read (or coding-system-for-read 'undecided))
!           (diff-switches-list (vc-diff-switches-list 'SVN)))
          (apply 'vc-svn-command "*vc-diff*" 1 nil "diff"
               (append
                (when rev1
!                 (list "-r"
!                       (if rev2 (concat rev1 ":" rev2) rev1)))
!               (when diff-switches-list
!                 (list "-x" (mapconcat 'identity diff-switches-list " 
")))))))))
  
  ;;;
  ;;; Snapshot system
--- 429,441 ----
                   (vc-diff-internal ',f ',rev1 ',rev2))))))
        ;; svn diff: use a single call for the entire tree
        (let ((coding-system-for-read (or coding-system-for-read 'undecided))
!           (switches (vc-switches 'SVN 'diff)))
          (apply 'vc-svn-command "*vc-diff*" 1 nil "diff"
               (append
                (when rev1
!                 (list "-r" (if rev2 (concat rev1 ":" rev2) rev1)))
!               (when switches
!                 (list "-x" (mapconcat 'identity switches " ")))))))))
  
  ;;;
  ;;; Snapshot system
***************
*** 586,592 ****
                                     (setq stay-local (not stay-local)))
                                 (if stay-local
                                     'yes
!                                  'no))))))))))))))
        (if (eq prop 'yes) t nil))))
  
  (defun vc-svn-parse-status (localp)
--- 564,572 ----
                                     (setq stay-local (not stay-local)))
                                 (if stay-local
                                     'yes
!                                  'no))))))))
!                   ;; vc-svn-stay-local is neither nil nor list nor string.
!                   (t 'yes)))))))
        (if (eq prop 'yes) t nil))))
  
  (defun vc-svn-parse-status (localp)
***************
*** 596,608 ****
    (let (file status)
      (goto-char (point-min))
      (while (re-search-forward
!           "^[ ADMCI?!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([0-9]+\\) 
+\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
        (setq file (expand-file-name
                  (buffer-substring (point) (line-end-position))))
        (setq status (char-after (line-beginning-position)))
        (unless (eq status ??)
        (vc-file-setprop file 'vc-backend 'SVN)
!       (vc-file-setprop file 'vc-workfile-version (match-string 2))
        (vc-file-setprop
         file 'vc-state
         (cond
--- 576,590 ----
    (let (file status)
      (goto-char (point-min))
      (while (re-search-forward
!           "^[ ADMCI?!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) 
+\\([0-9?]+\\) +\\([^ ]+\\) +" nil t)
        (setq file (expand-file-name
                  (buffer-substring (point) (line-end-position))))
        (setq status (char-after (line-beginning-position)))
        (unless (eq status ??)
        (vc-file-setprop file 'vc-backend 'SVN)
!       ;; Use the last-modified revision, so that searching in vc-print-log
!       ;; output works.
!       (vc-file-setprop file 'vc-workfile-version (match-string 3))
        (vc-file-setprop
         file 'vc-state
         (cond
***************
*** 613,618 ****
--- 595,602 ----
                                (nth 5 (file-attributes file)))
             'up-to-date))
          ((eq status ?A)
+          ;; If the file was actually copied, (match-string 2) is "-".
+          (vc-file-setprop file 'vc-workfile-version "0")
           (vc-file-setprop file 'vc-checkout-time 0)
           'edited)
          ((memq status '(?M ?C))




reply via email to

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