• R/O
  • SSH
  • HTTPS

fsvn: Commit


Commit MetaInfo

Revision309 (tree)
Time2014-02-07 22:03:56
Authormhayashi1120

Log Message

some fix (not enoufh tested)
now working simple check for 1.9.x
prepare tramp support

Change Summary

Incremental Difference

--- trunk/fsvn-debug.el (revision 308)
+++ trunk/fsvn-debug.el (revision 309)
@@ -28,7 +28,7 @@
2828 (let ((debug (get-buffer-create fsvn-debug-buffer))
2929 (message (car messages))
3030 prev)
31- ;; this is `call-process' argument...
31+ ;; this is `process-file' argument...
3232 (when (eq message t)
3333 (setq message (current-buffer)))
3434 (cond
--- trunk/fsvn-deps.el (revision 308)
+++ trunk/fsvn-deps.el (revision 309)
@@ -71,8 +71,111 @@
7171 `(let ((process-environment (copy-sequence process-environment)))
7272 (setenv "LC_MESSAGES" "C")
7373 ,@form))
74+
7475
7576
77+(defun fsvn-meta--parse-properties (text)
78+ (unless (string-match "\\`(" text)
79+ (error "Not a valid proeprties text"))
80+ (unless (string-match "\\`()\\'" text)
81+ (let ((start 1)
82+ (len (length text))
83+ res)
84+ (while (< start len)
85+ (let (key val)
86+ (unless (string-match "\\([^ ]+\\) " text start)
87+ (error "Not a valid property name %s" text))
88+ (setq start (match-end 0))
89+ (setq key (match-string 1 text))
90+ (cond
91+ ;;TODO check svn doc. or source.
92+ ((eq (string-match "\\([0-9]+\\) " text start) start)
93+ (setq start (match-end 0))
94+ (let* ((size (string-to-number (match-string 1 text)))
95+ (end (+ start size)))
96+ (setq val (substring text start end))
97+ (setq start (1+ end))))
98+ ((eq (string-match "\\([^ ]+\\)\\(?: \\|\)\\'\\)" text start) start)
99+ (setq start (match-end 0))
100+ (setq val (match-string 1 text)))
101+ (t (error "No matched to value %s" text)))
102+ (setq res (cons (cons key val) res))))
103+ (nreverse res))))
104+
105+(defun fsvn-meta--get-properties1.7 (file &optional propname)
106+ ;; Must check esqlite.el is installed at invoker
107+ (fsvn-let* ((root&atom (fsvn-meta--get-from-nodes "properties" file))
108+ (atom (cadr root&atom))
109+ ((stringp atom))
110+ (props (fsvn-meta--parse-properties atom)))
111+ (if propname
112+ (cdr (assoc propname props))
113+ props)))
114+
115+(defun fsvn-meta--get-database-format (metadir)
116+ (fsvn-let* ((stream (fsvn-meta--sqlite-connect metadir))
117+ (atom (fsvn-meta--sqlite-read-atom
118+ stream
119+ "PRAGMA user_version")))
120+ (string-to-number atom)))
121+
122+(defun fsvn-meta--get-from-nodes (column file)
123+ (fsvn-let* ((metadir (fsvn-file-control-directory file))
124+ (stream (fsvn-meta--sqlite-connect metadir))
125+ (rootdir (file-name-directory metadir))
126+ (relpath (fsvn-url-relative-name file rootdir))
127+ (relpath (if (equal relpath ".") "" relpath))
128+ (atom (fsvn-meta--sqlite-read-atom
129+ stream
130+ ;;TODO FIXME local_relpath is not key.
131+ ;; not enough investigate it but works well for me..
132+ (esqlite-prepare
133+ '("SELECT %o{column} "
134+ " FROM NODES "
135+ " WHERE local_relpath = %V{relpath}"
136+ " ORDER BY op_depth DESC"
137+ " LIMIT 1")
138+ :column column
139+ :relpath relpath))))
140+ (list rootdir atom)))
141+
142+(defun fsvn-meta--sqlite-read-atom (stream query)
143+ (let ((inhibit-redisplay t))
144+ (esqlite-stream-read-atom stream query)))
145+
146+(defvar fsvn-meta--sqlite-connection-pool-size 3)
147+(defvar fsvn-meta--sqlite-connection-pool nil)
148+
149+(defun fsvn-meta--sqlite-connect (metadir)
150+ (let ((wcdb (expand-file-name "wc.db" metadir)))
151+ (catch 'found
152+ (unless (file-exists-p wcdb)
153+ (throw 'found nil))
154+ (dolist (s fsvn-meta--sqlite-connection-pool)
155+ (cond
156+ ((not (esqlite-stream-alive-p s))
157+ (setq fsvn-meta--sqlite-connection-pool
158+ (delq s fsvn-meta--sqlite-connection-pool)))
159+ ((string= (esqlite-stream-filename s) wcdb)
160+ ;; move top of list
161+ (setq fsvn-meta--sqlite-connection-pool
162+ (cons s (delq s fsvn-meta--sqlite-connection-pool)))
163+ (throw 'found s))))
164+ ;; Not found. Connect to file expiring old connection.
165+ (when (> (length fsvn-meta--sqlite-connection-pool)
166+ (1- fsvn-meta--sqlite-connection-pool-size))
167+ (let ((rpool (reverse fsvn-meta--sqlite-connection-pool)))
168+ (esqlite-stream-close (car rpool))
169+ (setq fsvn-meta--sqlite-connection-pool
170+ (reverse (cdr rpool)))))
171+ (let ((stream (let ((inhibit-read-only t))
172+ (esqlite-stream-open wcdb))))
173+ (setq fsvn-meta--sqlite-connection-pool
174+ (cons stream fsvn-meta--sqlite-connection-pool))
175+ stream))))
176+
177+
178+
76179 ;; access to subversion meta directory
77180
78181 ;; http://svn.collab.net/repos/svn/trunk/subversion/libsvn_wc/adm_files.c
@@ -241,28 +344,98 @@
241344 "--config-dir"
242345 ))
243346
244-(defun fsvn-set-command-information ()
245- (unless (setq fsvn-svn-command-internal (executable-find fsvn-svn-command))
246- (error "No executable \"%s\" in `exec-path'" fsvn-svn-command))
247- (unless (setq fsvn-svnadmin-command-internal (executable-find fsvn-svnadmin-command))
248- (error "No executable \"%s\" in `exec-path'" fsvn-svnadmin-command))
249- (fsvn-set-version))
347+(defvar fsvn-svn-command-alist nil
348+ "key-value pair of svn command. Sort ascendant by version.
349+key: version
350+value: command")
250351
251-(defun fsvn-set-version ()
352+(defun fsvn-svn-proper-command (&optional flat-args)
353+ (cond
354+ ((member (car-safe flat-args) '("upgrade"))
355+ fsvn-svn-command-internal)
356+ (t
357+ (condition-case err
358+ (let* ((args flat-args)
359+ (file (catch 'done
360+ (while args
361+ (cond
362+ ((fsvn-url-local-p (car args))
363+ (throw 'done (car args)))
364+ ((string= (car args) "--targets")
365+ ;; ignore next arg
366+ (setq args (cdr args))
367+ (let* ((targets (get-text-property 0 'fsvn-target-files (car args)))
368+ (file (fsvn-find-if 'fsvn-url-local-p targets)))
369+ (when file
370+ (throw 'done file))))
371+ ((string= (car args) "--file")
372+ ;; just ignore next arg
373+ (setq args (cdr args))))
374+ (setq args (cdr args)))))
375+ (ver (fsvn-file-wc-svn-version (or file default-directory))))
376+ (fsvn-svn-fetch-proper-version ver))
377+ (error
378+ (message "%s" err)
379+ ;; default command
380+ fsvn-svn-command-internal)))))
381+
382+(defun fsvn-svn-fetch-proper-version (&optional format-version)
383+ (catch 'found
384+ (unless format-version
385+ (throw 'found fsvn-svn-command-internal))
386+ (let ((pair (assoc format-version fsvn-svn-command-alist)))
387+ (when pair
388+ (throw 'found (cdr pair))))
389+ ;; default
390+ fsvn-svn-command-internal))
391+
392+(defun fsvn-get-version (command)
252393 (with-temp-buffer
253394 (fsvn-deps-process-environment
254395 ;;TODO 1.6.9 stderr "svn: warning: cannot set LC_CTYPE locale"
255396 ;; not depend on fsvn-call-process
256- (call-process fsvn-svn-command-internal nil (list (current-buffer) nil) nil "--version" "--quiet")
257- (let ((raw-version (car (fsvn-text-buffer-line-as-list)))
258- version)
259- (when (fboundp 'version<=)
260- (when (string-match "^\\([0-9]+\\.[0-9]+\\.[0-9]+\\)" raw-version)
261- (setq version (match-string 1 raw-version)))
262- (setq fsvn-svn-version (or version raw-version))
263- (when (version<= fsvn-svn-version "1.4")
264- (error "Svn command must be 1.5.x or later")))))))
397+ (process-file command nil (list (current-buffer) nil) nil "--version" "--quiet"))
398+ (let ((raw-version (car (fsvn-text-buffer-line-as-list)))
399+ version)
400+ ;; trim "1.8.6-dev" like version
401+ (unless (string-match "^\\([0-9]+\\.[0-9]+\\.[0-9]+\\)" raw-version)
402+ (error "Unsupported version"))
403+ (match-string 1 raw-version))))
265404
405+(defun fsvn-get-ensure-version (command)
406+ (let ((ver (fsvn-get-version command)))
407+ (when (fboundp 'version<=)
408+ (when (version<= ver "1.4")
409+ (error "Svn command must be 1.5.x or later")))
410+ ver))
411+
412+(defun fsvn-set-command-information ()
413+ (unless (setq fsvn-svn-command-internal
414+ (executable-find fsvn-svn-command))
415+ (error "No executable \"%s\" in `exec-path'" fsvn-svn-command))
416+ (unless (setq fsvn-svnadmin-command-internal
417+ (executable-find fsvn-svnadmin-command))
418+ (error "No executable \"%s\" in `exec-path'" fsvn-svnadmin-command))
419+ (fsvn-add-command-location fsvn-svn-command-internal)
420+ (let ((ver (fsvn-get-ensure-version fsvn-svn-command-internal)))
421+ (setq fsvn-svn-version ver)))
422+
423+(defun fsvn-add-command-location (svn-command)
424+ (let ((bin (executable-find svn-command)))
425+ (unless bin
426+ (error "Not a executable"))
427+ (let* ((ver (fsvn-get-ensure-version svn-command))
428+ (key (and (string-match "\\`[0-9]+\\.[0-9]+" ver)
429+ (match-string 0 ver)))
430+ (alist fsvn-svn-command-alist)
431+ target)
432+ (unless (setq target (assoc key alist))
433+ (setq target (cons key nil))
434+ (setq alist (cons target alist)))
435+ (setcdr target bin)
436+ (setq fsvn-svn-command-alist alist)
437+ ver)))
438+
266439 (defun fsvn-build-subcommand (&optional force)
267440 (mapc
268441 (lambda (x)
@@ -288,23 +461,23 @@
288461 (fsvn-lisp-save (symbol-value subcommand-var) subcache)
289462 (fsvn-lisp-save (symbol-value arguments-var) argcache))))
290463 (list
291- (list fsvn-svn-command
464+ (list fsvn-svn-command-internal
292465 'fsvn-svn-subcommand-completion-alist
293466 'fsvn-svn-subcommand-arguments-alist
294467 (concat "svn-" fsvn-svn-version))
295- (list fsvn-svnadmin-command
468+ (list fsvn-svnadmin-command-internal
296469 'fsvn-svnadmin-subcommand-completion-alist
297470 'fsvn-svnadmin-subcommand-arguments-alist
298- (concat "svnadmin-" fsvn-svn-version)))) ;; version is guessed as `svn'
471+ ;; version is guessed as `svn'
472+ (concat "svnadmin-" fsvn-svn-version))))
299473 (setq fsvn-svnsync-command-internal
300474 (fsvn-svn-command-sibling-find "svnsync")))
301475
302-
303476 (defun fsvn-subcommand-argument-list (command subcommand)
304477 "Parse SUBCOMMAND help."
305478 (with-temp-buffer
306479 (fsvn-deps-process-environment
307- (call-process command nil t nil "help" subcommand))
480+ (process-file command nil t nil "help" subcommand))
308481 (goto-char (point-min))
309482 (let (ret)
310483 (while (re-search-forward "^ \\{2\\}\\(?:\\(--[^ ]+\\)\\|\\(-[^-]\\) +\\[\\(--[^ ]+\\)\\]\\) +\\([^ :]+\\)?" nil t)
@@ -355,7 +528,7 @@
355528 (defun fsvn-subcommand-alist-build (command)
356529 (with-temp-buffer
357530 (fsvn-deps-process-environment
358- (call-process command nil t nil "help"))
531+ (process-file command nil t nil "help"))
359532 (goto-char (point-min))
360533 (let (ret)
361534 (when (re-search-forward "^Available subcommands:")
@@ -606,7 +779,8 @@
606779 (let ((control (fsvn-expand-file (fsvn-meta-dir-name) file)))
607780 (and (fsvn-file-exact-directory-p control)
608781 control)))
609- ((string-match "/\\.svn\\($\\|/\\)" file) nil)
782+ ((string-match (format "/%s\\($\\|/\\)" (regexp-quote (fsvn-meta-dir-name))) file)
783+ nil)
610784 ((fsvn-magic-file-name-absolute-p file) nil)
611785 ;; TODO ignored status
612786 (t
@@ -627,23 +801,35 @@
627801
628802 ;; file: subversion/libsvn_wc/upgrade.c
629803 ;; function: version_string_from_format
804+;; ref: `fsvn-svn-command-alist'
630805 (defun fsvn-file-wc-svn-version (file)
631806 (let ((format (fsvn-file-wc-version file)))
632807 (cond
808+ ((null format)
809+ (error "Not a svn working copy"))
633810 ((eq format 4) "1.3")
634811 ((eq format 8) "1.4")
635812 ((eq format 9) "1.5")
636813 ((eq format 10) "1.6")
637- ((eq format 12) "1.7")
814+ ((and format (<= 12 format) (<= format 29))
815+ "1.7")
816+ ((and format (<= 30 format)) ;TODO FIXME
817+ "1.8")
638818 (t (error "Not a supported format")))))
639819
640820 (defun fsvn-file-wc-version (file)
641821 (let ((ctl (fsvn-file-control-directory file)))
642- (when ctl
822+ (cond
823+ ((null ctl) nil)
824+ ((file-exists-p (fsvn-expand-file "entries" ctl))
643825 (with-temp-buffer
644826 (insert-file-contents (fsvn-expand-file "entries" ctl) nil 0 16)
645827 (and (looking-at "^\\([0-9]+\\)$")
646- (string-to-number (match-string 1)))))))
828+ (string-to-number (match-string 1)))))
829+ ((and (and (require 'esqlite nil t) (esqlite-sqlite-installed-p))
830+ (file-exists-p (fsvn-expand-file "wc.db" ctl)))
831+ (fsvn-meta--get-database-format ctl))
832+ (t nil))))
647833
648834
649835
--- trunk/fsvn-popup.el (revision 308)
+++ trunk/fsvn-popup.el (revision 309)
@@ -165,7 +165,7 @@
165165 buffer))
166166
167167 (defun fsvn-popup-call-process-multi (command files &rest args)
168- "`call-process' accepts multiple files.
168+ "`process-file' accepts multiple files.
169169 subcommand must accept `--targets' argument.
170170
171171 Argument COMMAND svn subcommand.
--- trunk/AutoCheck.sh (revision 308)
+++ trunk/AutoCheck.sh (revision 309)
@@ -65,57 +65,47 @@
6565 }
6666
6767 # for Unix (Linux)
68-UNIX_SVN_1_4_BIN=~/src/subversion-dev/inst-1.4.x/bin
69-UNIX_SVN_1_5_BIN=~/src/subversion-dev/inst-1.5.x/bin
7068 UNIX_SVN_1_6_BIN=~/src/subversion-dev/inst-1.6.x/bin
7169 UNIX_SVN_1_7_BIN=~/src/subversion-dev/inst-1.7.x/bin
72-# EMACS_22_BIN=emacs-22.3
70+UNIX_SVN_1_8_BIN=~/src/subversion-dev/inst-1.8.x/bin
7371 EMACS_23_BIN=emacs-23.3
72+EMACS_24_BIN=emacs-24.3
7473 EMACS_CURRENT_BIN=emacs-current
7574 EMACS_BIN=emacs
7675
7776 # for Windows
78-# TODO not works
79-# WIN_SVN_1_4_BIN="c:/usr/local/subversion-dev/svn-win32-1.4.6/bin"
80-# WIN_SVN_1_5_BIN="c:/usr/local/subversion-dev/svn-win32-1.5.6/bin"
8177 WIN_SVN_1_6_BIN="c:/usr/local/subversion-dev/svn-win32-1.6.6/bin"
82-WIN_SVN_1_7_BIN="c:/usr/local/subversion-dev/svn-win32-1.7.1/bin"
83-MEADOW3_BIN="/cygdrive/c/usr/local/Meadow-dev/bin/Meadow.exe"
84-NTEMACS22_BIN="/cygdrive/c/usr/local/NTEmacs/22.2/bin/emacs.exe"
85-NTEMACS23_BIN="/cygdrive/c/usr/local/NTEmacs/23.1/bin/emacs.exe"
78+WIN_SVN_1_7_BIN="c:/usr/local/subversion-dev/svn-win32-1.7.14/bin"
79+WIN_SVN_1_8_BIN="c:/usr/local/subversion-dev/svn-win32-1.8.5/bin"
80+NTEMACS23_BIN="/cygdrive/c/usr/local/NTEmacs/23.3/bin/emacs.exe"
81+NTEMACS24_BIN="/cygdrive/c/usr/local/NTEmacs/24.2/bin/emacs.exe"
8682
8783 if ! uname | grep -q -i cygwin ; then
8884 check /usr/bin ${EMACS_BIN} Makefile
8985
90- check "${UNIX_SVN_1_5_BIN}" "${EMACS_22_BIN}" Makefile
91- check "${UNIX_SVN_1_5_BIN}" "${EMACS_23_BIN}" Makefile
92- check "${UNIX_SVN_1_5_BIN}" "${EMACS_CURRENT_BIN}" Makefile
93- check "${UNIX_SVN_1_6_BIN}" "${EMACS_22_BIN}" Makefile
9486 check "${UNIX_SVN_1_6_BIN}" "${EMACS_23_BIN}" Makefile
87+ check "${UNIX_SVN_1_6_BIN}" "${EMACS_24_BIN}" Makefile
9588 check "${UNIX_SVN_1_6_BIN}" "${EMACS_CURRENT_BIN}" Makefile
96- check "${UNIX_SVN_1_7_BIN}" "${EMACS_22_BIN}" Makefile
9789 check "${UNIX_SVN_1_7_BIN}" "${EMACS_23_BIN}" Makefile
90+ check "${UNIX_SVN_1_7_BIN}" "${EMACS_24_BIN}" Makefile
9891 check "${UNIX_SVN_1_7_BIN}" "${EMACS_CURRENT_BIN}" Makefile
92+ check "${UNIX_SVN_1_8_BIN}" "${EMACS_23_BIN}" Makefile
93+ check "${UNIX_SVN_1_8_BIN}" "${EMACS_24_BIN}" Makefile
94+ check "${UNIX_SVN_1_8_BIN}" "${EMACS_CURRENT_BIN}" Makefile
9995 else
100- check "${WIN_SVN_1_5_BIN}" "${MEADOW3_BIN}" Samples/Makefile.mw32
101- check "${WIN_SVN_1_5_BIN}" "${NTEMACS22_BIN}" Samples/Makefile.nt
102- check "${WIN_SVN_1_5_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23
103- check "${WIN_SVN_1_6_BIN}" "${MEADOW3_BIN}" Samples/Makefile.mw32
104- check "${WIN_SVN_1_6_BIN}" "${NTEMACS22_BIN}" Samples/Makefile.nt
10596 check "${WIN_SVN_1_6_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23
106- check "${WIN_SVN_1_7_BIN}" "${MEADOW3_BIN}" Samples/Makefile.mw32
107- check "${WIN_SVN_1_7_BIN}" "${NTEMACS22_BIN}" Samples/Makefile.nt
97+ check "${WIN_SVN_1_6_BIN}" "${NTEMACS24_BIN}" Samples/Makefile.nt
10898 check "${WIN_SVN_1_7_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23
99+ check "${WIN_SVN_1_7_BIN}" "${NTEMACS24_BIN}" Samples/Makefile.nt
100+ check "${WIN_SVN_1_8_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23
101+ check "${WIN_SVN_1_8_BIN}" "${NTEMACS24_BIN}" Samples/Makefile.nt
109102
110- check "${WIN_SVN_1_5_BIN}" "${MEADOW3_BIN}" Samples/Makefile.mw32 check-in-console
111- check "${WIN_SVN_1_5_BIN}" "${NTEMACS22_BIN}" Samples/Makefile.nt check-in-console
112- check "${WIN_SVN_1_5_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23 check-in-console
113- check "${WIN_SVN_1_6_BIN}" "${MEADOW3_BIN}" Samples/Makefile.mw32 check-in-console
114- check "${WIN_SVN_1_6_BIN}" "${NTEMACS22_BIN}" Samples/Makefile.nt check-in-console
115103 check "${WIN_SVN_1_6_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23 check-in-console
116- check "${WIN_SVN_1_7_BIN}" "${MEADOW3_BIN}" Samples/Makefile.mw32 check-in-console
117- check "${WIN_SVN_1_7_BIN}" "${NTEMACS22_BIN}" Samples/Makefile.nt check-in-console
104+ check "${WIN_SVN_1_6_BIN}" "${NTEMACS24_BIN}" Samples/Makefile.nt check-in-console
118105 check "${WIN_SVN_1_7_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23 check-in-console
106+ check "${WIN_SVN_1_7_BIN}" "${NTEMACS24_BIN}" Samples/Makefile.nt check-in-console
107+ check "${WIN_SVN_1_8_BIN}" "${NTEMACS23_BIN}" Samples/Makefile.nt23 check-in-console
108+ check "${WIN_SVN_1_8_BIN}" "${NTEMACS24_BIN}" Samples/Makefile.nt check-in-console
119109 fi
120110
121111 make clean -f ${makefile}
--- trunk/ChangeLog (revision 308)
+++ trunk/ChangeLog (revision 309)
@@ -1,3 +1,29 @@
1+2014-02-07 Masahiro Hayashi (林 雅博) <mhayashi1120@gmail.com>
2+
3+ * Add: `fsvn-add-command-location' function to support switching
4+ svn binary according of working copy format.
5+
6+ * Improve: Use `fsvn-svn*-internal' variable.
7+
8+2014-02-06 Masahiro Hayashi (林 雅博) <mhayashi1120@gmail.com>
9+
10+ * Add: direct read from meta directory through `esqlite'
11+
12+2014-01-29 Masahiro Hayashi (林 雅博) <mhayashi1120@gmail.com>
13+
14+ * Improve: some function prepare to works on tramp filename. (Not enough tested)
15+
16+2013-12-25 Masahiro Hayashi (林 雅博) <mhayashi1120@gmail.com>
17+
18+ * Change: remove 1.4.x, 1.5.x test
19+ * Change: Unsupport Meadow (Just remove test)
20+ * Change: Unsupport NTEmacs 22 (Just remove test)
21+ * Add: NTEmacs 24 test
22+
23+2013-12-22 Masahiro Hayashi (林 雅博) <mhayashi1120@gmail.com>
24+
25+ * Fix: Break iswitchb `iswitchb-toggle-ignore' mechanism.
26+
127 2013-12-21 Masahiro Hayashi (林 雅博) <mhayashi1120@gmail.com>
228
329 * Fix: wrong log chain when complicated rename.
--- trunk/fsvn-dev.el (revision 308)
+++ trunk/fsvn-dev.el (revision 309)
@@ -397,103 +397,6 @@
397397
398398
399399
400-(defvar fsvn-sqlite--connection-pool-size 3)
401-(defvar fsvn-sqlite--connection-pool nil)
402-
403-;;TODO when file is /hoge/.svn
404-(defun fsvn-meta--get-properties1.7 (file &optional propname)
405- ;; Must check esqlite.el is installed at invoker
406- (fsvn-let* ((root&atom (fsvn-meta--get-from-nodes "properties" file))
407- (atom (cadr root&atom))
408- ((stringp atom))
409- (props (fsvn-meta-parse-properties atom)))
410- (if propname
411- (cdr (assoc propname props))
412- props)))
413-
414-(defun fsvn-meta--get-from-nodes (column file)
415- (fsvn-let* ((metadir (fsvn-file-control-directory file))
416- (stream (fsvn-sqlite-connect file metadir))
417- (rootdir (file-name-directory metadir))
418- (relpath (fsvn-url-relative-name file rootdir))
419- (relpath (if (equal relpath ".") "" relpath))
420- (data (fsvn-sqlite-query
421- stream
422- ;;TODO local_relpath is not key.
423- (concat
424- (format "SELECT %s " column)
425- (format " FROM NODES ")
426- (format " WHERE local_relpath = '%s'"
427- (esqlite-escape-string relpath)))))
428- (top (car data))
429- (atom (nth 0 top)))
430- (list rootdir atom)))
431-
432-(defun fsvn-sqlite-query (stream query)
433- (let ((inhibit-redisplay t))
434- (esqlite-stream-read stream query)))
435-
436-;;TODO must invoke from wc top directory
437-(defun fsvn-sqlite-connect (file &optional metadir)
438- (setq metadir (or metadir (fsvn-file-control-directory file)))
439- (let ((wcdb (expand-file-name "wc.db" metadir)))
440- (catch 'found
441- (unless (file-exists-p wcdb)
442- (throw 'found nil))
443- (dolist (s fsvn-sqlite--connection-pool)
444- (cond
445- ((not (esqlite-stream-alive-p s))
446- (setq fsvn-sqlite--connection-pool
447- (delq s fsvn-sqlite--connection-pool)))
448- ((string= (esqlite-stream-filename s) wcdb)
449- ;; move top of list
450- (setq fsvn-sqlite--connection-pool
451- (cons s (delq s fsvn-sqlite--connection-pool)))
452- (throw 'found s))))
453- ;; Not found. Connect to file expiring old connection.
454- (when (> (length fsvn-sqlite--connection-pool)
455- (1- fsvn-sqlite--connection-pool-size))
456- (let ((rpool (reverse fsvn-sqlite--connection-pool)))
457- (esqlite-stream-close (car rpool))
458- (setq fsvn-sqlite--connection-pool
459- (reverse (cdr rpool)))))
460- (let ((stream (let ((inhibit-read-only t))
461- (esqlite-stream-open wcdb))))
462- (setq fsvn-sqlite--connection-pool
463- (cons stream fsvn-sqlite--connection-pool))
464- stream))))
465-
466-(defun fsvn-meta-parse-properties (text)
467- (unless (string-match "\\`(" text)
468- (error "Not a valid proeprties text"))
469- (unless (string-match "\\`()\\'" text)
470- (let ((start 1)
471- (len (length text))
472- res)
473- (while (< start len)
474- (let (key val)
475- (unless (string-match "\\([^ ]+\\) " text start)
476- (error "Not a valid property name %s" text))
477- (setq start (match-end 0))
478- (setq key (match-string 1 text))
479- (cond
480- ;;TODO check svn doc. or source.
481- ((eq (string-match "\\([0-9]+\\) " text start) start)
482- (setq start (match-end 0))
483- (let* ((size (string-to-number (match-string 1 text)))
484- (end (+ start size)))
485- (setq val (substring text start end))
486- (setq start (1+ end))))
487- ((eq (string-match "\\([^ ]+\\)\\(?: \\|\)\\'\\)" text start) start)
488- (setq start (match-end 0))
489- (setq val (match-string 1 text)))
490- (t (error "No matched to value %s" text)))
491- (setq res (cons (cons key val) res))))
492- (nreverse res))))
493-
494-;;TODO check recursively with current implementation
495-;; (directory-files-recursively "/home/masa/.emacs.d/")
496-
497400
498401 ;; testing
499402
@@ -644,7 +547,7 @@
644547 (unless (and info (> (fsvn-xml-info->entry.revision info) 0))
645548 ;; No costed execute. sync process.
646549 (with-temp-buffer
647- (unless (= (call-process fsvn-svnsync-command-internal nil (current-buffer) nil "initialize" cached-url root) 0)
550+ (unless (= (process-file fsvn-svnsync-command-internal nil (current-buffer) nil "initialize" cached-url root) 0)
648551 (signal 'fsvn-command-error (cons (buffer-string) nil)))))
649552 cached-url))
650553
@@ -653,7 +556,7 @@
653556 (buffer (fsvn-make-temp-buffer))
654557 proc)
655558 (fsvn-process-environment
656- (setq proc (start-process "fsvn" buffer fsvn-svnsync-command-internal "synchronize" cached-url)))
559+ (setq proc (start-file-process "fsvn" buffer fsvn-svnsync-command-internal "synchronize" cached-url)))
657560 (set-process-sentinel proc
658561 (lambda (p e)
659562 (fsvn-process-exit-handler p e
--- trunk/fsvn-pub.el (revision 308)
+++ trunk/fsvn-pub.el (revision 309)
@@ -27,6 +27,7 @@
2727
2828
2929 (defvar iswitchb-buffer-ignore)
30+(defvar iswitchb-buffer-ignore-orig)
3031 (defvar auto-mode-alist)
3132 (defvar current-prefix-arg)
3233 (defvar find-directory-functions)
@@ -372,8 +373,6 @@
372373 (list
373374 (concat "^" (regexp-quote fsvn-log-sibling-buffer-name) "$")
374375 (concat "^" (regexp-quote fsvn-log-message-buffer-name) "$")))
375- (unless (boundp 'iswitchb-buffer-ignore)
376- (setq iswitchb-buffer-ignore nil))
377376 (cond
378377 (feature
379378 ;; for ediff
@@ -391,10 +390,15 @@
391390 ;; advice
392391 (add-hook 'after-change-major-mode-hook 'fsvn-ui-fancy-redraw)
393392 ;; iswitchb ignore buffers
394- (mapc
395- (lambda (regexp)
396- (add-to-list 'iswitchb-buffer-ignore regexp))
397- ignore-buffers))
393+ (eval-after-load 'iswitchb
394+ `(let ((ignore-var (if iswitchb-buffer-ignore
395+ 'iswitchb-buffer-ignore
396+ ;; this case after call `iswitchb-toggle-ignore'
397+ 'iswitchb-buffer-ignore-orig)))
398+ (mapc
399+ (lambda (regexp)
400+ (add-to-list ignore-var regexp))
401+ ',ignore-buffers))))
398402 (t
399403 (setq auto-mode-alist (delete auto-mode auto-mode-alist))
400404 (remove-hook 'after-save-hook 'fsvn-after-save-hook)
@@ -402,10 +406,13 @@
402406 (setq file-name-handler-alist (delq file-handler file-name-handler-alist))
403407 (remove-hook 'pre-command-hook 'fsvn-magic-clear-cache-if-toplevel)
404408 (remove-hook 'after-change-major-mode-hook 'fsvn-ui-fancy-redraw)
405- (mapc
406- (lambda (regexp)
407- (setq iswitchb-buffer-ignore (delete regexp iswitchb-buffer-ignore)))
408- ignore-buffers)))
409+ (when (boundp 'iswitchb-buffer-ignore-orig)
410+ (mapc
411+ (lambda (regexp)
412+ (setq iswitchb-buffer-ignore-orig
413+ (delete regexp iswitchb-buffer-ignore-orig))
414+ (setq iswitchb-buffer-ignore (delete regexp iswitchb-buffer-ignore)))
415+ ignore-buffers))))
409416 (unless no-msg
410417 (message "Now fsvn feature `%s'" (if feature "ON" "OFF")))))
411418
--- trunk/fsvn-dired.el (revision 308)
+++ trunk/fsvn-dired.el (revision 309)
@@ -312,7 +312,7 @@
312312 "Act like `dired-show-file-type'. But not equals of this."
313313 (interactive (list (fsvn-current-filename)))
314314 (with-temp-buffer
315- (call-process "file" nil t t "--" file)
315+ (process-file "file" nil t t "--" file)
316316 (when (bolp)
317317 (backward-delete-char 1))
318318 (message "%s" (buffer-string))))
--- trunk/fsvn-admin.el (revision 308)
+++ trunk/fsvn-admin.el (revision 309)
@@ -31,7 +31,7 @@
3131 (fsvn-process-environment
3232 (let ((real-args (fsvn-command-args-canonicalize args)))
3333 (fsvn-debug real-args)
34- (apply 'start-process "fsvn admin" buffer fsvn-svnadmin-command-internal subcommand real-args))))
34+ (apply 'start-file-process "fsvn admin" buffer fsvn-svnadmin-command-internal subcommand real-args))))
3535
3636 (defun fsvn-admin-call-command (subcommand buffer &rest args)
3737 (fsvn-process-environment
@@ -38,7 +38,7 @@
3838 (let ((real-args (fsvn-command-args-canonicalize args)))
3939 (fsvn-debug real-args)
4040 (prog1
41- (apply 'call-process fsvn-svnadmin-command-internal nil buffer nil subcommand real-args)
41+ (apply 'process-file fsvn-svnadmin-command-internal nil buffer nil subcommand real-args)
4242 (fsvn-debug buffer)))))
4343
4444 (defun fsvn-admin-call-command-discard (subcommand buffer &rest args)
--- trunk/fsvn.el (revision 308)
+++ trunk/fsvn.el (revision 309)
@@ -25,7 +25,7 @@
2525
2626 ;; fsvn supports
2727 ;; * GNU Emacs 23.x or later.
28-;; * Subversion from 1.6.x to 1.7.x. (1.8.x is testing)
28+;; * Subversion from 1.6.x to 1.7.x. (1.8.x, 1.9.x is testing)
2929
3030 ;; fsvn has TortoiseSVN like user interface by using `svn' command.
3131 ;; Have following advantages of other Emacs svn client.
--- trunk/fsvn-cmd.el (revision 308)
+++ trunk/fsvn-cmd.el (revision 309)
@@ -701,7 +701,7 @@
701701 (insert (funcall (or fsvn-targets-file-converter 'identity) file) "\n")))
702702 files)
703703 (write-region (point-min) (point-max) tmpfile nil 'no-msg)))
704- tmpfile))
704+ (propertize tmpfile 'fsvn-target-files files)))
705705
706706 (defun fsvn-get-prop-temp-file (propname value)
707707 (let ((tmpfile (fsvn-make-temp-file))
--- trunk/fsvn-proc.el (revision 308)
+++ trunk/fsvn-proc.el (revision 309)
@@ -39,9 +39,10 @@
3939 (defun fsvn-start-process (buffer &rest args)
4040 (fsvn-process-environment
4141 (let* ((real-args (fsvn-command-args-canonicalize args))
42- (coding-system-for-read (fsvn-process-coding-system real-args)))
42+ (coding-system-for-read (fsvn-process-coding-system real-args))
43+ (command (fsvn-svn-proper-command real-args)))
4344 (fsvn-debug real-args)
44- (apply 'start-process "fsvn" buffer fsvn-svn-command-internal real-args))))
45+ (apply 'start-file-process "fsvn" buffer command real-args))))
4546
4647 (defun fsvn-start-command (subcommand buffer &rest args)
4748 (apply 'fsvn-start-process buffer subcommand args))
@@ -54,19 +55,20 @@
5455 proc))
5556
5657 (defun fsvn-call-process (buffer &rest args)
57- "Execute `call-process' with variable `fsvn-svn-command-internal'.
58+ "Execute `process-file' with variable `fsvn-svn-command-internal'.
5859 This is synchronous call, so cannot handle password prompt. Append --non-interactive arg
5960 explicitly in calling function.
6061 "
6162 (fsvn-process-environment
6263 (let* ((real-args (fsvn-command-args-canonicalize args))
63- (coding-system-for-read (fsvn-process-coding-system real-args)))
64+ (coding-system-for-read (fsvn-process-coding-system real-args))
65+ (command (fsvn-svn-proper-command real-args)))
6466 (when (and (bufferp buffer) (> (buffer-size buffer) 0))
6567 (with-current-buffer buffer
6668 (goto-char (point-max))))
6769 (fsvn-debug real-args)
6870 (prog1
69- (apply 'call-process fsvn-svn-command-internal nil buffer nil real-args)
71+ (apply 'process-file command nil buffer nil real-args)
7072 (fsvn-debug buffer)))))
7173
7274 (defun fsvn-call-command (subcommand buffer &rest args)
@@ -73,7 +75,7 @@
7375 (apply 'fsvn-call-process buffer subcommand (fsvn-command-append-argument subcommand args)))
7476
7577 (defun fsvn-call-command-display (subcommand buffer &rest args)
76- "`call-process' and insert executed command line top of buffer."
78+ "`process-file' and insert executed command line top of buffer."
7779 (let ((commandline (concat (fsvn-build-command-string
7880 subcommand
7981 (fsvn-command-append-argument subcommand args)) "\n\n")))
@@ -81,7 +83,7 @@
8183 (apply 'fsvn-call-command subcommand buffer args)))
8284
8385 (defun fsvn-call-command-discard (subcommand &rest args)
84- "`call-process' and discard executed command output.
86+ "`process-file' and discard executed command output.
8587 If error occur in process (exit status with non zero value) then raise error."
8688 (with-temp-buffer
8789 (unless (= (apply 'fsvn-call-command subcommand t args) 0)
@@ -308,13 +310,15 @@
308310 (nreverse ret)))
309311
310312 (defun fsvn-build-command-string (subcommand &rest args)
311- (let ((real-args (fsvn-command-args-canonicalize args)))
313+ (let* ((real-subcmd-args (fsvn-command-args-canonicalize args))
314+ (real-args (cons subcommand real-subcmd-args))
315+ (command (fsvn-svn-proper-command real-args)))
312316 (mapconcat
313317 (lambda (x)
314318 (if (or (string= "" x) (string-match " " x))
315319 (concat "\"" x "\"")
316320 x))
317- (append (list fsvn-svn-command-internal subcommand) real-args)
321+ `(,command ,subcommand ,@real-subcmd-args)
318322 " ")))
319323
320324 (defun fsvn-guess-file-contents-coding-system (flatten-args)
--- trunk/fsvn-svk.el (revision 308)
+++ trunk/fsvn-svk.el (revision 309)
@@ -206,7 +206,7 @@
206206 internal-args (append (list fsvn-svk-perl-command subcommand)
207207 real-args)))
208208 (fsvn-debug internal-args)
209- (apply 'call-process command nil buffer nil internal-args))))
209+ (apply 'process-file command nil buffer nil internal-args))))
210210
211211 (defun fsvn-svk-start-command (subcommand buffer &rest args)
212212 (fsvn-svk-process-environment
@@ -219,7 +219,7 @@
219219 (list fsvn-svk-perl-command script)))
220220 (setq internal-args (append internal-args (cons subcommand real-args)))
221221 (fsvn-debug internal-args)
222- (setq proc (apply 'start-process "fsvn svk" buffer internal-args))
222+ (setq proc (apply 'start-file-process "fsvn svk" buffer internal-args))
223223 (set-process-sentinel proc 'fsvn-svk-process-sentinel)
224224 (set-process-filter proc 'fsvn-popup-process-filter-in-buffer)
225225 (with-current-buffer buffer
Show on old repository browser