[macemacsjp-cvs 411] CVS update: CarbonEmacsPackage/GPL

Zurück zum Archiv-Index

Seiji Zenitani zenit****@users*****
2006年 9月 16日 (土) 19:01:17 JST


Index: CarbonEmacsPackage/GPL/psvn.el
diff -u CarbonEmacsPackage/GPL/psvn.el:1.6 CarbonEmacsPackage/GPL/psvn.el:1.7
--- CarbonEmacsPackage/GPL/psvn.el:1.6	Tue Aug 29 10:11:45 2006
+++ CarbonEmacsPackage/GPL/psvn.el	Sat Sep 16 19:01:16 2006
@@ -2,7 +2,7 @@
 ;; Copyright (C) 2002-2006 by Stefan Reichoer
 
 ;; Author: Stefan Reichoer, <stefa****@xstev*****>
-;; $Id: psvn.el 21273 2006-08-26 18:48:54Z xsteve $
+;; $Id: psvn.el 21434 2006-09-11 18:47:59Z xsteve $
 
 ;; psvn.el is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -206,7 +206,7 @@
       (require 'diff-mode))
   (error nil))
 
-(defconst svn-psvn-revision "$Id: psvn.el 21273 2006-08-26 18:48:54Z xsteve $"
+(defconst svn-psvn-revision "$Id: psvn.el 21434 2006-09-11 18:47:59Z xsteve $"
   "The revision number of psvn.")
 
 ;;; user setable variables
@@ -773,11 +773,13 @@
 (put 'svn-global-keymap 'risky-local-variable t)
 (when (not svn-global-keymap)
   (setq svn-global-keymap (make-sparse-keymap))
+  (define-key svn-global-keymap (kbd "v") 'svn-status-version)
   (define-key svn-global-keymap (kbd "s") 'svn-status-this-directory)
-  (define-key svn-global-keymap (kbd "l") 'svn-status-show-svn-log)
   (define-key svn-global-keymap (kbd "u") 'svn-status-update-cmd)
+  (define-key svn-global-keymap (kbd "l") 'svn-status-show-svn-log)
   (define-key svn-global-keymap (kbd "=") 'svn-status-show-svn-diff)
-  (define-key svn-global-keymap (kbd "b") 'svn-status-blame)
+  (define-key svn-global-keymap (kbd "f =") 'svn-file-show-svn-diff)
+  (define-key svn-global-keymap (kbd "f b") 'svn-status-blame)
   (define-key svn-global-keymap (kbd "c") 'svn-status-commit)
   (define-key svn-global-keymap (kbd "S") 'svn-status-switch-to-status-buffer)
   (define-key svn-global-keymap (kbd "o") 'svn-status-pop-to-status-buffer))
@@ -984,7 +986,9 @@
 ARGLIST is flattened and any every nil value is discarded.
 
 If the variable `svn-status-edit-svn-command' is non-nil then the user
-can edit ARGLIST before running svn."
+can edit ARGLIST before running svn.
+
+The hook svn-pre-run-hook allows to monitor/modify the ARGLIST."
   (setq arglist (svn-status-flatten-list arglist))
   (if (eq (process-status "svn") nil)
       (progn
@@ -998,6 +1002,7 @@
           (when (eq svn-status-edit-svn-command t)
             (svn-status-toggle-edit-cmd-flag t))
           (message "svn-run %s: %S" cmdtype arglist))
+        (run-hooks 'svn-pre-run-hook)
         (unless (eq mode-line-process 'svn-status-mode-line-process)
           (setq svn-pre-run-mode-line-process mode-line-process)
           (setq mode-line-process 'svn-status-mode-line-process))
@@ -1198,10 +1203,10 @@
         ;(svn-status-show-process-buffer)
         (let ((passwd (read-passwd
                        (format "Enter svn password for %s: " (match-string 1)))))
-          (svn-process-send-string (concat passwd "\n") t)))
+          (svn-process-send-string-and-newline passwd t)))
       (when (looking-at "Username: ")
         (let ((user-name (read-string "Username for svn operation: ")))
-          (svn-process-send-string (concat user-name "\n")))))))
+          (svn-process-send-string-and-newline user-name))))))
 
 (defun svn-parse-rev-num (str)
   (if (and str (stringp str)
@@ -1651,6 +1656,7 @@
      :style toggle :selected svn-status-hide-unknown]
     ["Hide Unmodified" svn-status-toggle-hide-unmodified
      :style toggle :selected svn-status-hide-unmodified]
+    ["Show Client versions" svn-status-version t]
     ))
 
 
@@ -2962,6 +2968,15 @@
       (set-buffer "*svn-process*")
       (svn-log-view-mode))))
 
+(defun svn-status-version ()
+  "Show the version numbers for the svn command line client and for psvn.el"
+  (interactive)
+  (svn-run nil t 'version "--version")
+  (svn-status-show-process-output 'info t)
+  (with-current-buffer svn-status-last-output-buffer-name
+    (goto-char (point-min))
+    (insert (format "psvn.el revision: %s\n\n" svn-psvn-revision))))
+
 (defun svn-status-info ()
   "Run `svn info' on all selected files.
 See `svn-status-marked-files' for what counts as selected."
@@ -2991,6 +3006,15 @@
   (svn-status-show-svn-diff-internal (list (svn-status-get-line-information)) t
                                      (if arg :ask :auto)))
 
+(defun svn-file-show-svn-diff (arg)
+  "Run `svn diff' on the current file.
+If there is a newer revision in the repository, the diff is done against HEAD,
+otherwise compare the working copy with BASE.
+If ARG then prompt for revision to diff against."
+  (interactive "P")
+  (svn-status-show-svn-diff-internal (list (svn-status-make-line-info buffer-file-name)) nil
+                                     (if arg :ask :auto)))
+
 (defun svn-status-show-svn-diff-for-marked-files (arg)
   "Run `svn diff' on all selected files.
 If some files have been marked, compare those non-recursively;
@@ -3611,6 +3635,17 @@
     (set-marker (process-mark (get-process "svn")) (point)))
   (process-send-string "svn" string))
 
+(defun svn-process-send-string-and-newline (string &optional send-passwd)
+  "Send a string to the running svn process.
+Just call `svn-process-send-string' with STRING and an end of line termination.
+When called with a prefix argument, read the data from user as password."
+  (interactive (let* ((use-passwd current-prefix-arg)
+                      (s (if use-passwd
+                             (read-passwd "Send secret line to svn process: ")
+                           (read-string "Send line to svn process: "))))
+                 (list s use-passwd)))
+  (svn-process-send-string (concat string "\n") send-passwd))
+
 ;; --------------------------------------------------------------------------------
 ;; Property List stuff
 ;; --------------------------------------------------------------------------------
@@ -4216,6 +4251,8 @@
 
 (when (not svn-info-mode-map)
   (setq svn-info-mode-map (make-sparse-keymap))
+  (define-key svn-info-mode-map [?s] 'svn-status-pop-to-status-buffer)
+  (define-key svn-info-mode-map (kbd "RET") 'svn-info-show-context)
   (define-key svn-info-mode-map [?q] 'bury-buffer))
 
 (defun svn-info-mode ()
@@ -4224,7 +4261,26 @@
   (kill-all-local-variables)
   (use-local-map svn-info-mode-map)
   (setq major-mode 'svn-info-mode)
-  (setq mode-name "svn-info"))
+  (setq mode-name "svn-info")
+  (toggle-read-only 1))
+
+(defun svn-info-show-context ()
+  "Show the context for a line in the info buffer.
+Currently is the output from the svn update command known."
+  (interactive)
+  (cond ((save-excursion
+           (goto-char (point-max))
+           (forward-line -1)
+           (beginning-of-line)
+           (looking-at "Updated to revision"))
+         ;; svn-info contains info from an svn update
+         (let ((file-name (buffer-substring-no-properties (+ 3 (line-beginning-position)) (line-end-position)))
+               (pos))
+           (with-current-buffer svn-status-buffer-name
+             (setq pos (svn-status-get-file-name-buffer-position file-name)))
+           (when pos
+             (pop-to-buffer svn-status-buffer-name)
+             (goto-char pos))))))
 
 ;; --------------------------------------------------------------------------------
 ;; svn-process-mode
@@ -4234,13 +4290,26 @@
 
 (when (not svn-process-mode-map)
   (setq svn-process-mode-map (make-sparse-keymap))
+  (define-key svn-process-mode-map (kbd "RET") 'svn-process-send-string-and-newline)
+  (define-key svn-process-mode-map [?s] 'svn-process-send-string)
   (define-key svn-process-mode-map [?q] 'bury-buffer))
 
+(easy-menu-define svn-process-mode-menu svn-process-mode-map
+"'svn-process-mode' menu"
+                  '("SvnProcess"
+                    ["Send line to process" svn-process-send-string-and-newline t]
+                    ["Send raw string to process" svn-process-send-string t]
+                    ["Bury process buffer" bury-buffer t]))
+
 (defun svn-process-mode ()
-  "Major Mode to view process output from svn."
+  "Major Mode to view process output from svn.
+
+You can send a new line terminated string to the process via \\[svn-process-send-string-and-newline]
+You can send raw data to the process via \\[svn-process-send-string]."
   (interactive)
   (kill-all-local-variables)
   (use-local-map svn-process-mode-map)
+  (easy-menu-add svn-log-view-mode-menu)
   (setq major-mode 'svn-process-mode)
   (setq mode-name "svn-process"))
 


macemacsjp-cvs メーリングリストの案内
Zurück zum Archiv-Index