[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

psvn.el, some patches

From: Shun-ichi GOTO <gotoh_at_taiyo.co.jp>
Date: 2003-06-07 16:07:56 CEST

Hi,

I've started using subversion mainly instead of cvs.
I'm living on Windows and using Meadow (yet another Emacs for Windows).

There's some patch for psvn.el.

ChangeLog:
2003-06-06 Shun-ichi GOTO <gotoh@taiyo.co.jp>

        * psvn.el (svn-process-sentinel): For windows environment, convert
        path separator as UNIX (Emacs) style.
        (svn-process-sentinel): Do not show event symbol name reporting
        except not handled.
        (svn-parse-status-result): Parse status line with format not using
        `split-string' to treat a filename which contains spaces. And also
        "A +" status line format can be handled correctly.

I think the modification about `svn-parse-status-result' clears a one
of TODO.

 ;; * Parse the following line correct:
 ;; A + - ? ? ./psvn.el -- show the + also


Index: psvn.el
===================================================================
RCS file: /usr/home/gotoh/Repository/lisp/psvn.el,v
retrieving revision 1.3
diff -u -u -F^.def -r1.3 psvn.el
--- psvn.el 5 Jun 2003 16:41:21 -0000 1.3
+++ psvn.el 7 Jun 2003 14:07:09 -0000
@@ -202,7 +202,7 @@ (defun svn-status (dir &optional arg)
   (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")
+ ;;(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*")))
@@ -271,6 +271,12 @@ (defun svn-process-sentinel (process eve
         (progn
           (cond ((eq svn-process-cmd 'status)
                  ;;(message "svn status finished")
+ (if (eq system-type 'windows-nt)
+ ;; convert path separator as UNIX style
+ (save-excursion
+ (goto-char 1)
+ (while (search-forward "\\" nil t)
+ (replace-match "/"))))
                  (svn-parse-status-result)
                  (set-buffer act-buf)
                  (svn-status-update-buffer))
@@ -319,75 +325,72 @@ (defun svn-process-sentinel (process eve
                 ((eq svn-process-cmd 'propset)
                  (svn-status-update))
                 ((eq svn-process-cmd 'propdel)
- (svn-status-update)))
- (message "svn-process had event: %s" event))
+ (svn-status-update))
+ (t
+ (message "svn-process had event: %s" event))))
       ;;(message (format "SVN Error: :%s:" event))
       (svn-status-show-process-buffer-internal t))))
 
+(defun svn-parse-rev-num (str)
+ (if (and str (stringp str)
+ (save-match-data (string-match "^[0-9]+" str)))
+ (string-to-number str)
+ -1))
+
 (defun svn-parse-status-result ()
   (setq svn-status-head-revision nil)
   (save-excursion
     (let ((old-marked-files (svn-status-marked-file-names))
           (line-string)
           (user-mark)
- (file-svn-info)
+ (svn-marks)
           (svn-file-mark)
           (svn-property-mark)
+ (svn-update-mark) ; to be update?
           (local-rev)
           (last-change-rev)
- (modified-external)
           (author)
           (path))
       (set-buffer "*svn-process*")
       (setq svn-status-info nil)
       (goto-char (point-min))
       (while (> (- (point-at-eol) (point-at-bol)) 0)
- (setq modified-external nil)
- (setq line-string (buffer-substring-no-properties
- (point-at-bol)
- (point-at-eol)))
- (if (string-match "Head revision:[ ]+\\([0-9]+\\)" line-string)
- (setq svn-status-head-revision (match-string 1 line-string))
- (setq file-svn-info (append (list (substring line-string 0 4))
- (if svn-xemacsp
- (cdr (split-string (substring line-string 5)))
- (split-string (substring line-string 5)))))
- (when (string= (nth 1 file-svn-info) "*")
- (setq modified-external t)
- ; remove the (nth 1) entry
- (setq file-svn-info (append
- (list (car file-svn-info))
- ; nth 1 removed
- (cddr file-svn-info))))
- (setq svn-file-mark (string-to-char (car file-svn-info)))
- (setq svn-property-mark (string-to-char (substring (car file-svn-info) 1)))
- (when (eq svn-property-mark 0) (setq svn-property-mark nil))
- ;is this necessary?
+ (if (looking-at "Head revision:[ ]+\\([0-9]+\\)")
+ (setq svn-status-head-revision (match-string 1))
+ (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
           (when (eq svn-property-mark ?\ ) (setq svn-property-mark nil))
- (cond ((eq svn-file-mark ??)
- (setq path (nth 1 file-svn-info)
- local-rev -1
- last-change-rev -1
- author "?"))
- (t
- (setq path (nth 4 file-svn-info)
- local-rev (string-to-number (nth 1 file-svn-info))
- last-change-rev (string-to-number (nth 2 file-svn-info))
- author (nth 3 file-svn-info))))
+ (when (eq svn-update-mark ?\ ) (setq svn-update-mark nil))
+ (forward-char 8)
+ (skip-chars-forward " ")
+ (cond
+ ((looking-at "\\([-?]\\|[0-9]+\\) +\\([-?]\\|[0-9]+\\) +\\([^ ]+\\) *\\(.+\\)")
+ (setq local-rev (svn-parse-rev-num (match-string 1))
+ last-change-rev (svn-parse-rev-num (match-string 2))
+ author (match-string 3)
+ path (match-string 4)))
+ ((looking-at "\\(.*\\)")
+ (setq path (match-string 1)
+ local-rev -1
+ last-change-rev -1
+ author "?"))
+ (t
+ (error "Unknown status line format."))))
           (unless path (setq path "."))
           (setq user-mark (not (not (member path old-marked-files))))
- (setq svn-status-info (append svn-status-info
- (list
- (list user-mark
- svn-file-mark
- svn-property-mark
- path
- local-rev
- last-change-rev
- author
- modified-external)))))
+ (setq svn-status-info (cons (list user-mark
+ svn-file-mark
+ svn-property-mark
+ path
+ local-rev
+ last-change-rev
+ author
+ svn-update-mark)
+ svn-status-info))
                                                ;;file-svn-info
- (next-line 1)))))
+ (forward-line 1))
+ (setq svn-status-info (nreverse svn-status-info)))))
 
 (condition-case nil
     ;;(easy-menu-add-item nil '("tools") ["SVN Status" svn-status t] "PCL-CVS")

--- Regards,
 Shun-ichi Goto <gotoh@taiyo.co.jp>
   R&D Group, TAIYO Corp., Tokyo, JAPAN

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jun 7 16:08:58 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.