1 ;;; vc-svn.el --- non-resident support for Subversion version-control
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5 ;; Author: FSF (see vc.el for full credits)
6 ;; Maintainer: Stefan Monnier <monnier@gnu.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 ;; Boston, MA 02110-1301, USA.
27 ;; Sync'd with Subversion's vc-svn.el as of revision 5801. but this version
28 ;; has been extensively modified since to handle filesets.
36 ;;; Customization options
39 (defcustom vc-svn-global-switches nil
40 "*Global switches to pass to any SVN command."
41 :type
'(choice (const :tag
"None" nil
)
42 (string :tag
"Argument String")
43 (repeat :tag
"Argument List"
49 (defcustom vc-svn-register-switches nil
50 "*Extra switches for registering a file into SVN.
51 A string or list of strings passed to the checkin program by
53 :type
'(choice (const :tag
"None" nil
)
54 (string :tag
"Argument String")
55 (repeat :tag
"Argument List"
61 (defcustom vc-svn-diff-switches
62 t
;`svn' doesn't support common args like -c or -b.
63 "String or list of strings specifying extra switches for svn diff under VC.
64 If nil, use the value of `vc-diff-switches'.
65 If you want to force an empty list of arguments, use t."
66 :type
'(choice (const :tag
"Unspecified" nil
)
68 (string :tag
"Argument String")
69 (repeat :tag
"Argument List"
75 (defcustom vc-svn-header
(or (cdr (assoc 'SVN vc-header-alist
)) '("\$Id\$"))
76 "*Header keywords to be inserted by `vc-insert-headers'."
78 :type
'(repeat string
)
81 ;; We want to autoload it for use by the autoloaded version of
82 ;; vc-svn-registered, but we want the value to be compiled at startup, not
85 (defconst vc-svn-admin-directory
86 (cond ((and (memq system-type
'(cygwin windows-nt ms-dos
))
87 (getenv "SVN_ASP_DOT_NET_HACK"))
90 "The name of the \".svn\" subdirectory or its equivalent.")
92 ;;; Properties of the backend
94 (defun vc-svn-revision-granularity ()
97 ;;; State-querying functions
100 ;;; vc-svn-admin-directory is generally not defined when the
101 ;;; autoloaded function is called.
103 ;;;###autoload (defun vc-svn-registered (f)
104 ;;;###autoload (let ((admin-dir (cond ((and (eq system-type 'windows-nt)
105 ;;;###autoload (getenv "SVN_ASP_DOT_NET_HACK"))
106 ;;;###autoload "_svn")
107 ;;;###autoload (t ".svn"))))
108 ;;;###autoload (when (file-readable-p (expand-file-name
109 ;;;###autoload (concat admin-dir "/entries")
110 ;;;###autoload (file-name-directory f)))
111 ;;;###autoload (load "vc-svn")
112 ;;;###autoload (vc-svn-registered f))))
115 (add-to-list 'completion-ignored-extensions
".svn/")
117 (defun vc-svn-registered (file)
118 "Check if FILE is SVN registered."
119 (when (file-readable-p (expand-file-name (concat vc-svn-admin-directory
121 (file-name-directory file
)))
123 (cd (file-name-directory file
))
126 ;; Ignore all errors.
127 (vc-svn-command t t file
"status" "-v")
128 ;; Some problem happened. E.g. We can't find an `svn'
129 ;; executable. We used to only catch `file-error' but when
130 ;; the process is run on a remote host via Tramp, the error
131 ;; is only reported via the exit status which is turned into
132 ;; an `error' by vc-do-command.
135 (let ((parsed (vc-svn-parse-status file
)))
136 (and parsed
(not (memq parsed
'(ignored unregistered
))))))))))
138 (defun vc-svn-state (file &optional localp
)
139 "SVN-specific version of `vc-state'."
140 (setq localp
(or localp
(vc-stay-local-p file
)))
142 (cd (file-name-directory file
))
143 (vc-svn-command t
0 file
"status" (if localp
"-v" "-u"))
144 (vc-svn-parse-status file
)))
146 (defun vc-svn-state-heuristic (file)
147 "SVN-specific state heuristic."
148 (vc-svn-state file
'local
))
150 (defun vc-svn-dir-state (dir &optional localp
)
151 "Find the SVN state of all files in DIR and its subdirectories."
152 (setq localp
(or localp
(vc-stay-local-p dir
)))
153 (let ((default-directory dir
))
154 ;; Don't specify DIR in this command, the default-directory is
155 ;; enough. Otherwise it might fail with remote repositories.
157 (buffer-disable-undo) ;; Because these buffers can get huge
158 (vc-svn-command t
0 nil
"status" (if localp
"-v" "-u"))
159 (vc-svn-parse-status))))
161 (defun vc-svn-after-dir-status (callback buffer
)
162 (let ((state-map '((?A . added
)
169 ;; This is what vc-svn-parse-status does.
172 (goto-char (point-min))
173 (while (re-search-forward "^\\(.\\)..... \\(.*\\)$" nil t
)
174 (let ((state (cdr (assq (aref (match-string 1) 0) state-map
)))
175 (filename (match-string 2)))
177 (setq result
(cons (cons filename state
) result
)))))
178 (kill-buffer (current-buffer))
179 (funcall callback result buffer
)))
181 (defun vc-svn-dir-status (dir callback buffer
)
182 "Run 'svn status' for DIR and update BUFFER via CALLBACK.
183 CALLBACK is called as (CALLBACK RESULT BUFFER), where
184 RESULT is a list of conses (FILE . STATE) for directory DIR."
185 (with-current-buffer (get-buffer-create
186 (generate-new-buffer-name " *vc svn status*"))
187 (vc-svn-command (current-buffer) 'async nil
"status")
189 `(vc-svn-after-dir-status (quote ,callback
) ,buffer
))
192 (defun vc-svn-working-revision (file)
193 "SVN-specific version of `vc-working-revision'."
194 ;; There is no need to consult RCS headers under SVN, because we
195 ;; get the workfile version for free when we recognize that a file
196 ;; is registered in SVN.
197 (vc-svn-registered file
)
198 (vc-file-getprop file
'vc-working-revision
))
200 (defun vc-svn-checkout-model (file)
201 "SVN-specific version of `vc-checkout-model'."
202 ;; It looks like Subversion has no equivalent of CVSREAD.
205 ;; vc-svn-mode-line-string doesn't exist because the default implementation
208 (defun vc-svn-dired-state-info (file)
209 "SVN-specific version of `vc-dired-state-info'."
210 (let ((svn-state (vc-state file
)))
211 (cond ((eq svn-state
'edited
)
212 (if (equal (vc-working-revision file
) "0")
213 "(added)" "(modified)"))
215 ;; fall back to the default VC representation
216 (vc-default-dired-state-info 'SVN file
)))))
219 (defun vc-svn-previous-revision (file rev
)
220 (let ((newrev (1- (string-to-number rev
))))
222 (number-to-string newrev
))))
224 (defun vc-svn-next-revision (file rev
)
225 (let ((newrev (1+ (string-to-number rev
))))
226 ;; The "working revision" is an uneasy conceptual fit under Subversion;
227 ;; we use it as the upper bound until a better idea comes along. If the
228 ;; workfile version W coincides with the tree's latest revision R, then
229 ;; this check prevents a "no such revision: R+1" error. Otherwise, it
230 ;; inhibits showing of W+1 through R, which could be considered anywhere
231 ;; from gracious to impolite.
232 (unless (< (string-to-number (vc-file-getprop file
'vc-working-revision
))
234 (number-to-string newrev
))))
238 ;;; State-changing functions
241 (defun vc-svn-create-repo ()
242 "Create a new SVN repository."
243 (vc-do-command nil
0 "svnadmin" '("create" "SVN"))
244 (vc-do-command nil
0 "svn" '(".")
245 "checkout" (concat "file://" default-directory
"SVN")))
247 (defun vc-svn-register (files &optional rev comment
)
248 "Register FILES into the SVN version-control system.
249 The COMMENT argument is ignored This does an add but not a commit.
251 `vc-register-switches' and `vc-svn-register-switches' are passed to
252 the SVN command (in that order)."
253 (apply 'vc-svn-command nil
0 files
"add" (vc-switches 'SVN
'register
)))
255 (defun vc-svn-responsible-p (file)
256 "Return non-nil if SVN thinks it is responsible for FILE."
257 (file-directory-p (expand-file-name vc-svn-admin-directory
258 (if (file-directory-p file
)
260 (file-name-directory file
)))))
262 (defalias 'vc-svn-could-register
'vc-svn-responsible-p
263 "Return non-nil if FILE could be registered in SVN.
264 This is only possible if SVN is responsible for FILE's directory.")
266 (defun vc-svn-checkin (files rev comment
)
267 "SVN-specific version of `vc-backend-checkin'."
268 (if rev
(error "Committing to a specific revision is unsupported in SVN"))
270 'vc-svn-command nil
1 files
"ci"
271 (nconc (list "-m" comment
) (vc-switches 'SVN
'checkin
)))))
273 (goto-char (point-min))
274 (unless (equal status
0)
275 ;; Check checkin problem.
277 ((search-forward "Transaction is out of date" nil t
)
278 (mapc (lambda (file) (vc-file-setprop file
'vc-state
'needs-merge
))
280 (error (substitute-command-keys
281 (concat "Up-to-date check failed: "
282 "type \\[vc-next-action] to merge in changes"))))
284 (pop-to-buffer (current-buffer))
285 (goto-char (point-min))
286 (shrink-window-if-larger-than-buffer)
287 (error "Check-in failed"))))
288 ;; Update file properties
290 ;; file 'vc-working-revision
291 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
294 (defun vc-svn-find-revision (file rev buffer
)
295 "SVN-specific retrieval of a specified version into a buffer."
296 (apply 'vc-svn-command
299 (and rev
(not (string= rev
""))
301 (vc-switches 'SVN
'checkout
)))
303 (defun vc-svn-checkout (file &optional editable rev
)
304 (message "Checking out %s..." file
)
305 (with-current-buffer (or (get-file-buffer file
) (current-buffer))
306 (vc-call update file editable rev
(vc-switches 'SVN
'checkout
)))
308 (message "Checking out %s...done" file
))
310 (defun vc-svn-update (file editable rev switches
)
311 (if (and (file-exists-p file
) (not rev
))
312 ;; If no revision was specified, there's nothing to do.
314 ;; Check out a particular version (or recreate the file).
315 (vc-file-setprop file
'vc-working-revision nil
)
316 (apply 'vc-svn-command nil
0 file
318 ;; default for verbose checkout: clear the sticky tag so
319 ;; that the actual update will get the head of the trunk
321 ((null rev
) "-rBASE")
322 ((or (eq rev t
) (equal rev
"")) nil
)
323 (t (concat "-r" rev
)))
326 (defun vc-svn-delete-file (file)
327 (vc-svn-command nil
0 file
"remove"))
329 (defun vc-svn-rename-file (old new
)
330 (vc-svn-command nil
0 new
"move" (file-relative-name old
)))
332 (defun vc-svn-revert (file &optional contents-done
)
333 "Revert FILE to the version it was based on."
334 (unless contents-done
335 (vc-svn-command nil
0 file
"revert")))
337 (defun vc-svn-merge (file first-version
&optional second-version
)
338 "Merge changes into current working copy of FILE.
339 The changes are between FIRST-VERSION and SECOND-VERSION."
340 (vc-svn-command nil
0 file
342 "-r" (if second-version
343 (concat first-version
":" second-version
)
345 (vc-file-setprop file
'vc-state
'edited
)
346 (with-current-buffer (get-buffer "*vc*")
347 (goto-char (point-min))
348 (if (looking-at "C ")
350 0))) ; signal success
352 (defun vc-svn-merge-news (file)
353 "Merge in any new changes made to FILE."
354 (message "Merging changes into %s..." file
)
355 ;; (vc-file-setprop file 'vc-working-revision nil)
356 (vc-file-setprop file
'vc-checkout-time
0)
357 (vc-svn-command nil
0 file
"update")
358 ;; Analyze the merge result reported by SVN, and set
359 ;; file properties accordingly.
360 (with-current-buffer (get-buffer "*vc*")
361 (goto-char (point-min))
362 ;; get new working revision
363 (if (re-search-forward
364 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t
)
365 (vc-file-setprop file
'vc-working-revision
(match-string 2))
366 (vc-file-setprop file
'vc-working-revision nil
))
368 (goto-char (point-min))
370 (if (looking-at "At revision")
371 0 ;; there were no news; indicate success
372 (if (re-search-forward
373 ;; Newer SVN clients have 3 columns of chars (one for the
374 ;; file's contents, then second for its properties, and the
375 ;; third for lock-grabbing info), before the 2 spaces.
376 ;; We also used to match the filename in column 0 without any
377 ;; meta-info before it, but I believe this can never happen.
378 (concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)? \\)"
379 (regexp-quote (file-name-nondirectory file
)))
382 ;; Merge successful, we are in sync with repository now
383 ((string= (match-string 2) "U")
384 (vc-file-setprop file
'vc-state
'up-to-date
)
385 (vc-file-setprop file
'vc-checkout-time
386 (nth 5 (file-attributes file
)))
387 0);; indicate success to the caller
388 ;; Merge successful, but our own changes are still in the file
389 ((string= (match-string 2) "G")
390 (vc-file-setprop file
'vc-state
'edited
)
391 0);; indicate success to the caller
392 ;; Conflicts detected!
394 (vc-file-setprop file
'vc-state
'edited
)
395 1);; signal the error to the caller
397 (pop-to-buffer "*vc*")
398 (error "Couldn't analyze svn update result")))
399 (message "Merging changes into %s...done" file
))))
401 (defun vc-svn-modify-change-comment (files rev comment
)
402 "Modify the change comments for a specified REV.
403 You must have ssh access to the repository host, and the directory Emacs
404 uses locally for temp files must also be writeable by you on that host."
405 (vc-do-command nil
0 "svn" nil
"info")
407 (goto-char (point-min))
408 (unless (re-search-forward "Repository Root: svn\\+ssh://\\([^/]+\\)\\(/.*\\)" nil t
)
409 (error "Repository information is unavailable."))
410 (let* ((tempfile (make-temp-file user-mail-address
))
411 (host (match-string 1))
412 (directory (match-string 2))
413 (remotefile (concat host
":" tempfile
)))
416 (write-region (point-min) (point-max) tempfile
))
417 (unless (vc-do-command nil
0 "scp" nil
"-q" tempfile remotefile
)
418 (error "Copy of comment to %s failed" remotefile
))
419 (unless (vc-do-command nil
0 "ssh" nil
421 (format "svnadmin setlog --bypass-hooks %s -r %s %s; rm %s"
422 directory rev tempfile tempfile
))
423 (error "Log edit failed"))
427 ;;; History functions
430 (defun vc-svn-print-log (files &optional buffer
)
431 "Get change log(s) associated with FILES."
433 (vc-setup-buffer buffer
)
434 (let ((inhibit-read-only t
))
435 (goto-char (point-min))
438 (insert "Working file: " file
"\n")
442 ;; (if (and (= (length files) 1) (vc-stay-local-p file)) 'async 0)
445 ;; By default Subversion only shows the log up to the
446 ;; working revision, whereas we also want the log of the
447 ;; subsequent commits. At least that's what the
448 ;; vc-cvs.el code does.
450 ;; Dump log for the entire directory.
451 (vc-svn-command buffer
0 nil
"log" "-rHEAD:0")))))
453 (defun vc-svn-wash-log ()
454 "Remove all non-comment information from log output."
455 ;; FIXME: not implemented for SVN
458 (defun vc-svn-diff (files &optional oldvers newvers buffer
)
459 "Get a difference report using SVN between two revisions of fileset FILES."
463 (or (equal oldvers
(vc-working-revision f
))
466 ;; Use nil rather than the current revision because svn handles
467 ;; it better (i.e. locally). Note that if _any_ of the files
468 ;; has a different revision, we fetch the lot, which is
469 ;; obviously sub-optimal.
472 (if vc-svn-diff-switches
473 (vc-switches 'SVN
'diff
)
474 (list "-x" (mapconcat 'identity
(vc-switches nil
'diff
) " "))))
475 (async (and (not vc-disable-async-diff
)
476 (vc-stay-local-p files
)
477 (or oldvers newvers
)))) ; Svn diffs those locally.
478 (apply 'vc-svn-command buffer
484 (list "-r" (if newvers
(concat oldvers
":" newvers
)
486 (if async
1 ; async diff => pessimistic assumption
487 ;; For some reason `svn diff' does not return a useful
488 ;; status w.r.t whether the diff was empty or not.
489 (buffer-size (get-buffer buffer
)))))
495 (defun vc-svn-create-snapshot (dir name branchp
)
496 "Assign to DIR's current revision a given NAME.
497 If BRANCHP is non-nil, the name is created as a branch (and the current
498 workspace is immediately moved to that new branch).
499 NAME is assumed to be a URL."
500 (vc-svn-command nil
0 dir
"copy" name
)
501 (when branchp
(vc-svn-retrieve-snapshot dir name nil
)))
503 (defun vc-svn-retrieve-snapshot (dir name update
)
504 "Retrieve a snapshot at and below DIR.
505 NAME is the name of the snapshot; if it is empty, do a `svn update'.
506 If UPDATE is non-nil, then update (resynch) any affected buffers.
507 NAME is assumed to be a URL."
508 (vc-svn-command nil
0 dir
"switch" name
)
509 ;; FIXME: parse the output and obey `update'.
516 ;; Subversion makes backups for us, so don't bother.
517 ;; (defalias 'vc-svn-make-version-backups-p 'vc-stay-local-p
518 ;; "Return non-nil if version backups should be made for FILE.")
520 (defun vc-svn-check-headers ()
521 "Check if the current file has any headers in it."
523 (goto-char (point-min))
524 (re-search-forward "\\$[A-Za-z\300-\326\330-\366\370-\377]+\
525 \\(: [\t -#%-\176\240-\377]*\\)?\\$" nil t
)))
529 ;;; Internal functions
532 (defcustom vc-svn-program
"svn"
533 "Name of the SVN executable."
537 (defun vc-svn-root (dir)
538 (vc-find-root dir vc-svn-admin-directory t
))
540 (defun vc-svn-command (buffer okstatus file-or-list
&rest flags
)
541 "A wrapper around `vc-do-command' for use in vc-svn.el.
542 The difference to vc-do-command is that this function always invokes `svn',
543 and that it passes `vc-svn-global-switches' to it before FLAGS."
544 (apply 'vc-do-command buffer okstatus vc-svn-program file-or-list
545 (if (stringp vc-svn-global-switches
)
546 (cons vc-svn-global-switches flags
)
547 (append vc-svn-global-switches
550 (defun vc-svn-repository-hostname (dirname)
552 (let ((coding-system-for-read
553 (or file-name-coding-system
554 default-file-name-coding-system
)))
555 (vc-insert-file (expand-file-name (concat vc-svn-admin-directory
558 (goto-char (point-min))
559 (when (re-search-forward
560 ;; Old `svn' used name="svn:this_dir", newer use just name="".
561 (concat "name=\"\\(?:svn:this_dir\\)?\"[\n\t ]*"
562 "\\(?:[-a-z]+=\"[^\"]*\"[\n\t ]*\\)*?"
563 "url=\"\\(?1:[^\"]+\\)\""
564 ;; Yet newer ones don't use XML any more.
565 "\\|^\ndir\n[0-9]+\n\\(?1:.*\\)") nil t
)
566 ;; This is not a hostname but a URL. This may actually be considered
567 ;; as a feature since it allows vc-svn-stay-local to specify different
568 ;; behavior for different modules on the same server.
571 (defun vc-svn-resolve-when-done ()
572 "Call \"svn resolved\" if the conflict markers have been removed."
574 (goto-char (point-min))
575 (unless (re-search-forward "^<<<<<<< " nil t
)
576 (vc-svn-command nil
0 buffer-file-name
"resolved")
577 ;; Remove the hook so that it is not called multiple times.
578 (remove-hook 'after-save-hook
'vc-svn-resolve-when-done t
))))
580 ;; Inspired by vc-arch-find-file-hook.
581 (defun vc-svn-find-file-hook ()
582 (when (eq ?C
(vc-file-getprop buffer-file-name
'vc-svn-status
))
583 ;; If the file is marked as "conflicted", then we should try and call
584 ;; "svn resolved" when applicable.
586 (goto-char (point-min))
587 (re-search-forward "^<<<<<<< " nil t
))
588 ;; There are conflict markers.
590 (smerge-start-session)
591 (add-hook 'after-save-hook
'vc-svn-resolve-when-done nil t
))
592 ;; There are no conflict markers. This is problematic: maybe it means
593 ;; the conflict has been resolved and we should immediately call "svn
594 ;; resolved", or it means that the file's type does not allow Svn to
595 ;; use conflict markers in which case we don't really know what to do.
596 ;; So let's just punt for now.
598 (message "There are unresolved conflicts in this file")))
600 (defun vc-svn-parse-status (&optional filename
)
601 "Parse output of \"svn status\" command in the current buffer.
602 Set file properties accordingly. Unless FILENAME is non-nil, parse only
603 information about FILENAME and return its status."
605 (goto-char (point-min))
606 (while (re-search-forward
607 ;; Ignore the files with status X.
608 "^\\(\\?\\|[ ACDGIMR!~][ MC][ L][ +][ S]..\\([ *]\\) +\\([-0-9]+\\) +\\([0-9?]+\\) +\\([^ ]+\\)\\) +" nil t
)
609 ;; If the username contains spaces, the output format is ambiguous,
610 ;; so don't trust the output's filename unless we have to.
611 (setq file
(or filename
613 (buffer-substring (point) (line-end-position)))))
614 (setq status
(char-after (line-beginning-position)))
616 (vc-file-setprop file
'vc-state
'unregistered
)
617 ;; `vc-BACKEND-registered' must not set vc-backend,
618 ;; which is instead set in vc-registered.
619 (unless filename
(vc-file-setprop file
'vc-backend
'SVN
))
620 ;; Use the last-modified revision, so that searching in vc-print-log
622 (vc-file-setprop file
'vc-working-revision
(match-string 3))
623 ;; Remember Svn's own status.
624 (vc-file-setprop file
'vc-svn-status status
)
629 (if (eq (char-after (match-beginning 1)) ?
*)
631 (vc-file-setprop file
'vc-checkout-time
632 (nth 5 (file-attributes file
)))
635 ;; If the file was actually copied, (match-string 2) is "-".
636 (vc-file-setprop file
'vc-working-revision
"0")
637 (vc-file-setprop file
'vc-checkout-time
0)
639 ((memq status
'(?M ?C
))
640 (if (eq (char-after (match-beginning 1)) ?
*)
644 (vc-file-setprop file
'vc-state
'ignored
))
646 (vc-file-setprop file
'vc-state
'removed
))
648 (if filename
(vc-file-getprop filename
'vc-state
))))
650 (defun vc-svn-dir-state-heuristic (dir)
651 "Find the SVN state of all files in DIR, using only local information."
652 (vc-svn-dir-state dir
'local
))
654 (defun vc-svn-valid-symbolic-tag-name-p (tag)
655 "Return non-nil if TAG is a valid symbolic tag name."
656 ;; According to the SVN manual, a valid symbolic tag must start with
657 ;; an uppercase or lowercase letter and can contain uppercase and
658 ;; lowercase letters, digits, `-', and `_'.
659 (and (string-match "^[a-zA-Z]" tag
)
660 (not (string-match "[^a-z0-9A-Z-_]" tag
))))
662 (defun vc-svn-valid-revision-number-p (tag)
663 "Return non-nil if TAG is a valid revision number."
664 (and (string-match "^[0-9]" tag
)
665 (not (string-match "[^0-9]" tag
))))
667 ;; Support for `svn annotate'
669 (defun vc-svn-annotate-command (file buf
&optional rev
)
670 (vc-svn-command buf
0 file
"annotate" (if rev
(concat "-r" rev
))))
672 (defun vc-svn-annotate-time-of-rev (rev)
673 ;; Arbitrarily assume 10 commmits per day.
674 (/ (string-to-number rev
) 10.0))
676 (defun vc-svn-annotate-current-time ()
677 (vc-svn-annotate-time-of-rev vc-annotate-parent-rev
))
679 (defconst vc-svn-annotate-re
"[ \t]*\\([0-9]+\\)[ \t]+[^\t ]+ ")
681 (defun vc-svn-annotate-time ()
682 (when (looking-at vc-svn-annotate-re
)
683 (goto-char (match-end 0))
684 (vc-svn-annotate-time-of-rev (match-string 1))))
686 (defun vc-svn-annotate-extract-revision-at-line ()
689 (if (looking-at vc-svn-annotate-re
) (match-string 1))))
693 ;; arch-tag: 02f10c68-2b4d-453a-90fc-1eee6cfb268d
694 ;;; vc-svn.el ends here