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

patch for vc-svn.el (ediff-revison and vc-print-log)

From: Shun-ichi GOTO <gotoh_at_taiyo.co.jp>
Date: 2003-09-11 19:16:24 CEST

Hi,

How about this patch for vc-svn.el?

  * `ediff-revision' is available.
    We can take non EDITABLE revision with DESTFILE required for
    ediff-revision.

  * Move to correct log entry on vc-print-log.
    It is the problem that 'svn log' only shows committed revision,
    but vc's current revision is not actual last committed revision of
    file.

  * vc-svn.el works on older emacsen (ex. emacs 20.7) if new vc (come
    with emacs 21) is available on it. It's not standard case, but I'm
    using vc-svn.el Meadow 1.15 (based on emacs 20.7).
  

--- c:/develop/subversion/contrib/client-side/vc-svn.el Thu Sep 11 11:55:35 2003
+++ c:/users/gotoh/lisp/vc-svn.el Thu Sep 11 16:38:37 2003
@@ -294,15 +294,23 @@ (defun vc-svn-checkout (file &optional e
 passing nil.
 If optional arg DESTFILE is given, it is an alternate filename to
 write the contents to; we raise an error."
- (unless editable
- (error "VC asked Subversion to check out a read-only copy of file"))
- (when destfile
+ (when (and editable destfile)
     (error "VC asked Subversion to check out a file under another name"))
   (when (equal rev "")
     (setq rev nil))
- (apply 'vc-do-command nil 0 vc-svn-program-name file
- "update" (if rev (list "-r" rev) '()))
- (vc-file-setprop file 'vc-workfile-version nil))
+ (let* ((buf (if (not editable) (get-buffer-create "*vc-svn-cat*")))
+ (cmd (if editable "update" "cat")))
+ (unwind-protect
+ (progn
+ (apply 'vc-do-command buf 0 vc-svn-program-name file
+ cmd (if rev (list "-r" rev) '()))
+ (when (and destfile buf)
+ (save-excursion
+ (set-buffer buf)
+ (write-region (point-min) (point-max) destfile nil 1)))
+ (if editable
+ (vc-file-setprop file 'vc-workfile-version nil)))
+ (kill-buffer buf))))
 
 
 (defun vc-svn-revert (file &optional contents-done)
@@ -349,10 +357,14 @@ (defun vc-svn-print-log (file)
 (defun vc-svn-show-log-entry (version)
   "Search the log entry for VERSION in the current buffer.
 Make sure it is displayed in the buffer's window."
- (when (re-search-forward (concat "^-+\n\\(rev\\) "
- (regexp-quote version)
- ":[^|]+|[^|]+| [0-9]+ lines?"))
- (goto-char (match-beginning 1))
+ (let ((ver (string-to-number version)))
+ ;; The subversion has two version number, tree version and modified
+ ;; version, so we should find log entry of lower youngest version.
+ (while (and (re-search-forward (concat "^-+\nrev \\([0-9]+\\)"
+ ":[^|]+|[^|]+| [0-9]+ lines?"))
+ ;; Above search may cause error if not found.
+ (< ver (string-to-number (match-string 1)))))
+ (beginning-of-line)
     (recenter 1)))
 
 
@@ -404,7 +416,9 @@ (defun vc-svn-diff (file &optional rev1
     (let ((status (apply 'vc-do-command "*vc-diff*" (if async 'async 0)
                          vc-svn-program-name file
                          (append '("diff") rev-switches-list))))
- (if (or async (> (buffer-size (get-buffer "*vc-diff*")) 0))
+ (if (or async (> (save-excursion
+ (set-buffer (get-buffer "*vc-diff*"))
+ (buffer-size)) 0))
           1 0))))
 
 (defun vc-svn-find-version (file rev buffer)

--- 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 Thu Sep 11 19:14:14 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.