From 357017ef24f82f6fc5365476bab3e0205cc90deb Mon Sep 17 00:00:00 2001 From: jorton Date: Thu, 23 Sep 2004 08:34:44 +0000 Subject: [PATCH] - update to 1.0.8 - remove -neonver patch - update psvn.el to 11062 --- psvn.el | 200 +++++++++++++++++++++++++++++++++++++++++------- sources | 2 +- subversion.spec | 3 +- 3 files changed, 175 insertions(+), 30 deletions(-) diff --git a/psvn.el b/psvn.el index ca1a05c..8993276 100644 --- a/psvn.el +++ b/psvn.el @@ -1,8 +1,8 @@ ;;; psvn.el --- Subversion interface for emacs ;; Copyright (C) 2002-2004 by Stefan Reichoer -;; Author: Stefan Reichoer, -;; $Id: psvn.el 10695 2004-08-20 19:52:33Z xsteve $ +;; Author: Stefan Reichoer, +;; $Id: psvn.el 11062 2004-09-21 20:12:42Z 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 @@ -85,7 +85,7 @@ ;; Start the svn interface with M-x svn-status ;; The latest version of psvn.el can be found at: -;; http://xsteve.nit.at/prg/emacs/psvn.el +;; http://www.xsteve.at/prg/emacs/psvn.el ;; Or you can check it out from the subversion repository: ;; svn co http://svn.collab.net/repos/svn/trunk/contrib/client-side/psvn psvn @@ -144,9 +144,13 @@ ;;; user setable variables (defvar svn-log-edit-file-name "++svn-log++" "*Name of a saved log file.") +(defvar svn-log-edit-insert-files-to-commit t "*Insert the filelist to commit in the *svn-log* buffer") (defvar svn-status-hide-unknown nil "*Hide unknown files in *svn-status* buffer.") (defvar svn-status-hide-unmodified nil "*Hide unmodified files in *svn-status* buffer.") (defvar svn-status-directory-history nil "*List of visited svn working directories.") +(defvar svn-status-sort-status-buffer t "Sort the *svn-status* buffer. +Setting this variable to nil speeds up M-x svn-status. +However, it is possible, that the sorting is wrong in this case.") (defvar svn-status-unmark-files-after-list '(commit revert) "*List of operations after which all user marks will be removed. @@ -216,6 +220,7 @@ Possible values are: commit, revert.") (defvar svn-temp-suffix (make-temp-name ".")) (defvar svn-status-temp-file-to-remove nil) (defvar svn-status-temp-arg-file (concat svn-status-temp-dir "svn.arg" svn-temp-suffix)) +(defvar svn-status-options nil) ;;; faces (defface svn-status-marked-face @@ -291,6 +296,7 @@ Else return TEXT unchanged." (if (not (fboundp 'puthash)) (defalias 'puthash 'cl-puthash)) +(defvar svn-status-display-new-status-buffer nil) ;;;###autoload (defun svn-status (dir &optional arg) "Examine the status of Subversion working copy in directory DIR. @@ -308,8 +314,10 @@ If ARG then pass the -u argument to `svn status'." (setq dir (file-name-as-directory dir)) (setq svn-status-directory-history (delete dir svn-status-directory-history)) (add-to-list 'svn-status-directory-history dir) - (unless (string= (buffer-name) "*svn-status*") - (message "psvn: Saving initial window configuration") + (if (string= (buffer-name) "*svn-status*") + (setq svn-status-display-new-status-buffer nil) + (setq svn-status-display-new-status-buffer t) + ;;(message "psvn: Saving initial window configuration") (setq svn-status-initial-window-configuration (current-window-configuration))) (let* ((status-buf (get-buffer-create "*svn-status*")) (proc-buf (get-buffer-create "*svn-process*"))) @@ -404,7 +412,10 @@ for example: '(\"revert\" \"file1\"\)" (insert "Output from svn command:\n") (insert svn-status-update-previous-process-output) (goto-char (point-min)) - (setq svn-status-update-previous-process-output nil))) + (setq svn-status-update-previous-process-output nil)) + (when svn-status-display-new-status-buffer + (set-window-configuration svn-status-initial-window-configuration) + (switch-to-buffer "*svn-status*"))) ((eq svn-process-cmd 'log) (svn-status-show-process-buffer-internal t) (pop-to-buffer "*svn-process*") @@ -490,7 +501,7 @@ for example: '(\"revert\" \"file1\"\)" (defun svn-parse-status-result () - "Parse the *svn-process* buffer. + "Parse the *svn-process* buffer. The results are used to build the `svn-status-info' variable." (setq svn-status-head-revision nil) (save-excursion @@ -506,7 +517,7 @@ The results are used to build the `svn-status-info' variable." (author) (path) (user-elide nil) - (ui-status '(nil nil)) ; contains (user-mark user-elide) + (ui-status '(nil nil)) ; contains (user-mark user-elide) (revision-width svn-status-default-revision-width) (author-width svn-status-default-author-width)) (set-buffer "*svn-process*") @@ -516,8 +527,7 @@ The results are used to build the `svn-status-info' variable." (cond ((= (point-at-eol) (point-at-bol)) ;skip blank lines nil) - ((or (looking-at "Head revision:[ ]+\([0-9]+\)") ;svn version < 0.29 - (looking-at "Status against revision:[ ]+\([0-9]+\)")); svn version >= 0.29 + ((looking-at "Status against revision:[ ]+\\([0-9]+\\)") ;; the above message appears for the main listing plus once for each svn:externals entry (unless svn-status-head-revision (setq svn-status-head-revision (match-string 1)))) @@ -529,12 +539,12 @@ The results are used to build the `svn-status-info' variable." ) (t (setq svn-marks (buffer-substring (point) (+ (point) 8)) - svn-file-mark (elt svn-marks 0) ; 1st column - svn-property-mark (elt svn-marks 1) ; 2nd column + svn-file-mark (elt svn-marks 0) ; 1st column + svn-property-mark (elt svn-marks 1) ; 2nd column ;;svn-locked-mark (elt svn-marks 2) ; 3rd column ;;svn-added-with-history-mark (elt svn-marks 3); 4th column ;;svn-switched-mark (elt svn-marks 4) ; 5th column - svn-update-mark (elt svn-marks 7)) ; 8th column + svn-update-mark (elt svn-marks 7)) ; 8th column (when (eq svn-property-mark ?\ ) (setq svn-property-mark nil)) (when (eq svn-update-mark ?\ ) (setq svn-update-mark nil)) @@ -565,10 +575,10 @@ The results are used to build the `svn-status-info' variable." svn-update-mark) svn-status-info)) (setq revision-width (max revision-width - (length (number-to-string local-rev)) - (length (number-to-string last-change-rev)))) + (length (number-to-string local-rev)) + (length (number-to-string last-change-rev)))) (setq author-width (max author-width (length author))))) - (forward-line 1)) + (forward-line 1)) ;; With subversion 0.29.0 and above, `svn -u st' returns files in ;; a random order (especially if we have a mixed revision wc) (setq svn-status-default-column @@ -578,7 +588,8 @@ The results are used to build the `svn-status-info' variable." revision-width revision-width author-width)) - (setq svn-status-info (sort svn-status-info 'svn-status-sort-predicate))))) + (when svn-status-sort-status-buffer + (setq svn-status-info (sort svn-status-info 'svn-status-sort-predicate)))))) ;;(string-lessp "." "%") => nil ;(svn-status-sort-predicate '(t t t ".") '(t t t "%")) => t @@ -615,6 +626,8 @@ A and B must be line-info's." (defvar svn-status-mode-map () "Keymap used in `svn-status-mode' buffers.") (defvar svn-status-mode-property-map () "Subkeymap used in `svn-status-mode' for property commands.") +(defvar svn-status-mode-options-map () + "Subkeymap used in `svn-status-mode' for option commands.") (when (not svn-status-mode-map) (setq svn-status-mode-map (make-sparse-keymap)) @@ -709,7 +722,12 @@ A and B must be line-info's." ;; TODO: Why is `svn-status-select-line' in `svn-status-mode-property-map'? (define-key svn-status-mode-property-map (kbd "RET") 'svn-status-select-line) (define-key svn-status-mode-map (kbd "P") svn-status-mode-property-map)) - +(when (not svn-status-mode-options-map) + (setq svn-status-mode-options-map (make-sparse-keymap)) + (define-key svn-status-mode-options-map (kbd "s") 'svn-status-save-state) + (define-key svn-status-mode-options-map (kbd "l") 'svn-status-load-state) + (define-key svn-status-mode-options-map (kbd "x") 'svn-status-toggle-sort-status-buffer) + (define-key svn-status-mode-map (kbd "O") svn-status-mode-options-map)) (easy-menu-define svn-status-mode-menu svn-status-mode-map "'svn-status-mode' menu" @@ -749,6 +767,12 @@ A and B must be line-info's." ["Set svn:keywords List" svn-status-property-set-keyword-list t] ["Set svn:eol-style" svn-status-property-set-eol-style t] ) + ("Options" + ["Save Options" svn-status-save-state t] + ["Load Options" svn-status-load-state t] + ["Toggle sorting of *svn-status* buffer" svn-status-toggle-sort-status-buffer + :style toggle :selected svn-status-sort-status-buffer] + ) "---" ["Edit Next SVN Cmd Line" svn-status-toggle-edit-cmd-flag t] ["Work Directory History..." svn-status-use-history t] @@ -892,6 +916,10 @@ Otherwise run `find-file'." (defun svn-status-line-info->show-user-elide-continuation (line-info) (eq (svn-status-line-info->user-elide line-info) 'directory)) +;; modify the line-info +(defun svn-status-line-info->set-filemark (line-info value) + (setcar (nthcdr 1 line-info) value)) + (defun svn-status-toggle-elide () (interactive) (let ((st-info svn-status-info) @@ -1302,15 +1330,14 @@ If the function is called with a prefix arg, unmark all these files." (goto-char start-pos))) (defun svn-status-find-info-for-file-name (name) - (save-excursion - (let ((info nil)) - (goto-char (point-min)) - (while (< (point) (point-max)) - (goto-char (next-overlay-change (point))) - (when (string= name (svn-status-line-info->filename - (svn-status-get-line-information))) - (setq info (svn-status-get-line-information)))) - info))) + (let* ((st-info svn-status-info) + (info)) + (while st-info + (when (string= name (svn-status-line-info->filename (car st-info))) + (setq info (car st-info)) + (setq st-info nil)) ; terminate loop + (setq st-info (cdr st-info))) + info)) (defun svn-status-marked-files () "Return all files marked by `svn-status-set-user-mark', @@ -1594,7 +1621,9 @@ When called with a prefix argument add the command line switch --force." (let* ((marked-files (svn-status-marked-files))) (setq svn-status-files-to-commit marked-files) (svn-log-edit-show-files-to-commit) - (svn-status-pop-to-commit-buffer))) + (svn-status-pop-to-commit-buffer) + (when svn-log-edit-insert-files-to-commit + (svn-log-edit-insert-files-to-commit)))) (defun svn-status-pop-to-commit-buffer () (interactive) @@ -1632,6 +1661,47 @@ See `svn-status-marked-files' for what counts as selected." (svn-status-create-arg-file svn-status-temp-arg-file "" (svn-status-marked-files) "") (svn-run-svn t t 'resolved "resolved" "--targets" svn-status-temp-arg-file)))) +;; -------------------------------------------------------------------------------- +;; Update the *svn-status* buffer, when a file is saved +;; -------------------------------------------------------------------------------- + +(defvar svn-status-file-modified-after-save-flag ?m + "The flag, that is shown, in the *svn-status* buffer, after +a file is changed and saved in emacs. +Recommended values are ?m or ?M.") +(defun svn-status-after-save-hook () + "Set a modified indication, when a file is saved from a svn working copy." + (let* ((svn-dir (car-safe svn-status-directory-history)) + (svn-dir (when svn-dir (expand-file-name svn-dir))) + (file-dir (file-name-directory (buffer-file-name))) + (svn-dir-len (length (or svn-dir ""))) + (file-dir-len (length file-dir)) + (file-name)) + (when (and svn-dir + (>= file-dir-len svn-dir-len) + (string= (substring file-dir 0 svn-dir-len) svn-dir)) + (setq file-name (substring (buffer-file-name) svn-dir-len)) + ;;(message (format "In svn-status directory %S" file-name)) + (let ((st-info svn-status-info) + (i-fname)) + (while st-info + (setq i-fname (svn-status-line-info->filename (car st-info))) + ;;(message (format "i-fname=%S" i-fname)) + (when (and (string= file-name i-fname) + (not (eq (svn-status-line-info->filemark (car st-info)) ??))) + (svn-status-line-info->set-filemark (car st-info) + svn-status-file-modified-after-save-flag) + (save-excursion + (set-buffer "*svn-status*") + (svn-status-goto-file-name i-fname) + (let ((buffer-read-only nil)) + (delete-region (point-at-bol) (point-at-eol)) + (svn-insert-line-in-status-buffer (car st-info)) + (delete-char 1)))) + (setq st-info (cdr st-info)))))) + nil) + +(add-hook 'after-save-hook 'svn-status-after-save-hook) ;; -------------------------------------------------------------------------------- ;; Getting older revisions @@ -2112,6 +2182,8 @@ Commands: (message "svn-log editing done") (save-excursion (set-buffer (get-buffer "*svn-log-edit*")) + (when svn-log-edit-insert-files-to-commit + (svn-log-edit-remove-comment-lines)) (set-buffer-file-coding-system 'undecided-unix nil) (write-region (point-min) (point-max) (concat svn-status-temp-dir "svn-log-edit.txt" svn-temp-suffix) nil 1)) @@ -2157,6 +2229,27 @@ If ARG then show diff between some other version of the selected files." (set-buffer "*svn-log-edit*") (erase-buffer)) +(defun svn-log-edit-insert-files-to-commit () + (interactive) + (svn-log-edit-remove-comment-lines) + (let ((buf-size (- (point-max) (point-min)))) + (save-excursion + (goto-char (point-min)) + (insert "## Lines starting with '## ' will be removed from the log message.\n") + (insert "## File(s) to commit:\n") + (let ((file-list svn-status-files-to-commit)) + (while file-list + (insert (concat "## " (svn-status-line-info->filename (car file-list)) "\n")) + (setq file-list (cdr file-list))))) + (when (= 0 buf-size) + (goto-char (point-max))))) + +(defun svn-log-edit-remove-comment-lines () + (interactive) + (save-excursion + (goto-char (point-min)) + (flush-lines "^## .*"))) + ;; -------------------------------------------------------------------------------- ;; svn-log-view-mode: @@ -2219,6 +2312,57 @@ When called with a prefix argument, ask the user for the revision." (diff-mode) (font-lock-fontify-buffer)))) +;; -------------------------------------------------------------------------------- +;; svn status persistent options +;; -------------------------------------------------------------------------------- + +(defun svn-status-base-dir () + (let ((base-dir default-directory) + (dot-svn-dir) + (dir-below default-directory)) + (setq dot-svn-dir (concat base-dir ".svn")) + (while (when (file-exists-p dot-svn-dir) + (setq base-dir (file-name-directory dot-svn-dir)) + (string-match "\\(.+/\\).+/" dir-below) + (setq dir-below (match-string 1 dir-below)) + (setq dot-svn-dir (concat dir-below ".svn")))) + base-dir)) + +(defun svn-status-save-state () + (interactive) + (let ((buf (find-file (concat (svn-status-base-dir) "++psvn.state")))) + (delete-region (point-min) (point-max)) + (setq svn-status-options + (list + (list "sort-status-buffer" svn-status-sort-status-buffer))) + (insert (pp-to-string svn-status-options)) + (save-buffer) + (kill-buffer buf))) + +(defun svn-status-load-state () + (interactive) + (let ((file (concat (svn-status-base-dir) "++psvn.state"))) + (if (file-readable-p file) + (with-temp-buffer + (insert-file-contents file) + (setq svn-status-options (read (current-buffer))) + (setq svn-status-sort-status-buffer + (nth 1 (assoc "sort-status-buffer" svn-status-options)))) + (error "%s is not readable." file)) + (message "Loaded %s" file))) + +(defun svn-status-toggle-sort-status-buffer () + "If you turn off sorting, you can speed up M-x svn-status. +However, the buffer is not correct sorted then. +This function will be removed again, when a faster parsing and +display routine for svn-status is available." + (interactive) + (setq svn-status-sort-status-buffer (not svn-status-sort-status-buffer)) + (message (concat "The *svn-status* buffer will be" + (if svn-status-sort-status-buffer "" " not") + " sorted."))) + + (provide 'psvn) ;;; psvn.el ends here diff --git a/sources b/sources index d1de0d3..af6e830 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -160c655194dff55f9fdd856110801d01 subversion-1.0.6.tar.gz +40b5b5edd4e0daec802661cd64d562e4 subversion-1.0.8.tar.gz diff --git a/subversion.spec b/subversion.spec index a81725b..9115b1f 100644 --- a/subversion.spec +++ b/subversion.spec @@ -13,7 +13,7 @@ URL: http://subversion.tigris.org/ Source0: http://subversion.tigris.org/tarballs/subversion-%{version}.tar.gz Source1: subversion.conf Source3: filter-requires.sh -Source4: http://xsteve.nit.at/prg/emacs/psvn.el +Source4: http://www.xsteve.at/prg/emacs/psvn.el Patch1: subversion-0.24.2-swig.patch Patch2: subversion-0.20.1-deplibs.patch Patch3: subversion-0.31.0-rpath.patch @@ -201,6 +201,7 @@ rm -rf ${RPM_BUILD_ROOT} * Thu Sep 23 2004 Joe Orton 1.0.8-2 - update to 1.0.8 - remove -neonver patch +- update psvn.el to 11062 * Mon Aug 23 2004 Joe Orton 1.0.6-3 - add svn_load_dirs.pl to docdir (#128338)