comparison lisp/vc-svn.el @ 91040:14c4a6aac623

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 866-879) - Merge multi-tty branch - Update from CVS - Merge from emacs--rel--22 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
author Miles Bader <miles@gnu.org>
date Thu, 11 Oct 2007 16:14:00 +0000
parents b83d0dadb2a7 c2cc930bdd9e
children d38543a1c0f9
comparison
equal deleted inserted replaced
91039:eefadc1e1d5e 91040:14c4a6aac623
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA. 23 ;; Boston, MA 02110-1301, USA.
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;; This is preliminary support for Subversion (http://subversion.tigris.org/). 27 ;; Sync'd with Subversion's vc-svn.el as of revision 5801. but this version
28 ;; It started as `sed s/cvs/svn/ vc.cvs.el' (from version 1.56) 28 ;; has been extensively modified since to handle filesets.
29 ;; and hasn't been completely fixed since.
30
31 ;; Sync'd with Subversion's vc-svn.el as of revision 5801.
32 29
33 ;;; Bugs: 30 ;;; Bugs:
34 31
35 ;; - VC-dired is (really) slow. 32 ;; - VC-dired is (really) slow.
36 33
380 (save-current-buffer 377 (save-current-buffer
381 (vc-setup-buffer buffer) 378 (vc-setup-buffer buffer)
382 (let ((inhibit-read-only t)) 379 (let ((inhibit-read-only t))
383 (goto-char (point-min)) 380 (goto-char (point-min))
384 ;; Add a line to tell log-view-mode what file this is. 381 ;; Add a line to tell log-view-mode what file this is.
385 (insert "Working file(s): " (vc-delistify (mapcar 'file-relative-name files)) "\n")) 382 ;; FIXME if there are multiple files, log-view-current-file
383 ;; breaks. It's trivial to adapt log-view-file-re for the
384 ;; changed prefix, but less trivial to make
385 ;; log-view-current-file actually do the right thing in the
386 ;; multiple file case.
387 (insert (format "Working file%s: "
388 (if (= (length files) 1)
389 ""
390 "s"))
391 (vc-delistify (mapcar 'file-relative-name files)) "\n"))
386 (vc-svn-command 392 (vc-svn-command
387 buffer 393 buffer
388 (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0) 394 (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0)
389 files "log" 395 files "log"
390 ;; By default Subversion only shows the log upto the working version, 396 ;; By default Subversion only shows the log upto the working version,
431 ;; status w.r.t whether the diff was empty or not. 437 ;; status w.r.t whether the diff was empty or not.
432 (buffer-size (get-buffer buffer))))) 438 (buffer-size (get-buffer buffer)))))
433 439
434 (defun vc-svn-diff-tree (dir &optional rev1 rev2) 440 (defun vc-svn-diff-tree (dir &optional rev1 rev2)
435 "Diff all files at and below DIR." 441 "Diff all files at and below DIR."
436 (vc-svn-diff (file-name-as-directory dir) rev1 rev2)) 442 (vc-svn-diff (list (file-name-as-directory dir)) rev1 rev2))
437 443
438 ;;; 444 ;;;
439 ;;; Snapshot system 445 ;;; Snapshot system
440 ;;; 446 ;;;
441 447
509 "\\|^\ndir\n[0-9]+\n\\(?1:.*\\)") nil t) 515 "\\|^\ndir\n[0-9]+\n\\(?1:.*\\)") nil t)
510 ;; This is not a hostname but a URL. This may actually be considered 516 ;; This is not a hostname but a URL. This may actually be considered
511 ;; as a feature since it allows vc-svn-stay-local to specify different 517 ;; as a feature since it allows vc-svn-stay-local to specify different
512 ;; behavior for different modules on the same server. 518 ;; behavior for different modules on the same server.
513 (match-string 1)))) 519 (match-string 1))))
520
521 (defun vc-svn-resolve-when-done ()
522 "Call \"svn resolved\" if the conflict markers have been removed."
523 (save-excursion
524 (goto-char (point-min))
525 (if (not (re-search-forward "^<<<<<<< " nil t))
526 (vc-svn-command nil 0 buffer-file-name "resolved"))))
527
528 ;; Inspired by vc-arch-find-file-hook.
529 (defun vc-svn-find-file-hook ()
530 (when (eq ?C (vc-file-getprop buffer-file-name 'vc-svn-status))
531 ;; If the file is marked as "conflicted", then we should try and call
532 ;; "svn resolved" when applicable.
533 (if (save-excursion
534 (goto-char (point-min))
535 (re-search-forward "^<<<<<<< " nil t))
536 ;; There are conflict markers.
537 (progn
538 (smerge-mode 1)
539 (add-hook 'after-save-hook 'vc-svn-resolve-when-done nil t))
540 ;; There are no conflict markers. This is problematic: maybe it means
541 ;; the conflict has been resolved and we should immediately call "svn
542 ;; resolved", or it means that the file's type does not allow Svn to
543 ;; use conflict markers in which case we don't really know what to do.
544 ;; So let's just punt for now.
545 nil)
546 (message "There are unresolved conflicts in this file")))
514 547
515 (defun vc-svn-parse-status (&optional filename) 548 (defun vc-svn-parse-status (&optional filename)
516 "Parse output of \"svn status\" command in the current buffer. 549 "Parse output of \"svn status\" command in the current buffer.
517 Set file properties accordingly. Unless FILENAME is non-nil, parse only 550 Set file properties accordingly. Unless FILENAME is non-nil, parse only
518 information about FILENAME and return its status." 551 information about FILENAME and return its status."
532 ;; which is instead set in vc-registered. 565 ;; which is instead set in vc-registered.
533 (unless filename (vc-file-setprop file 'vc-backend 'SVN)) 566 (unless filename (vc-file-setprop file 'vc-backend 'SVN))
534 ;; Use the last-modified revision, so that searching in vc-print-log 567 ;; Use the last-modified revision, so that searching in vc-print-log
535 ;; output works. 568 ;; output works.
536 (vc-file-setprop file 'vc-workfile-version (match-string 3)) 569 (vc-file-setprop file 'vc-workfile-version (match-string 3))
570 ;; Remember Svn's own status.
571 (vc-file-setprop file 'vc-svn-status status)
537 (vc-file-setprop 572 (vc-file-setprop
538 file 'vc-state 573 file 'vc-state
539 (cond 574 (cond
540 ((eq status ?\ ) 575 ((eq status ?\ )
541 (if (eq (char-after (match-beginning 1)) ?*) 576 (if (eq (char-after (match-beginning 1)) ?*)