aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2003-07-04 22:21:45 +0000
committerStefan Monnier2003-07-04 22:21:45 +0000
commit5cc7cb96c8aac714a8fd2430f8d6f3a9a0ecff3b (patch)
treee777b3c81f64810b56e94d4c7f09df69f09906b6
parentbb1e1730ec66ea1398ebf3557be3c72b4dd59f77 (diff)
downloademacs-5cc7cb96c8aac714a8fd2430f8d6f3a9a0ecff3b.tar.gz
emacs-5cc7cb96c8aac714a8fd2430f8d6f3a9a0ecff3b.zip
(vc-svn-use-edit): Make it into a const.
(vc-svn-update): Fix the arguments to `svn'. (vc-svn-diff-tree): Just use `vc-svn-diff'. (vc-svn-create-snapshot, vc-svn-retrieve-snapshot): Simple implementations, assuming `name' is a URL.
-rw-r--r--lisp/vc-svn.el96
1 files changed, 24 insertions, 72 deletions
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el
index b5f2d7761ca..46d83685475 100644
--- a/lisp/vc-svn.el
+++ b/lisp/vc-svn.el
@@ -81,13 +81,15 @@ A string or list of strings passed to the checkin program by
81 :type '(repeat string) 81 :type '(repeat string)
82 :group 'vc) 82 :group 'vc)
83 83
84(defcustom vc-svn-use-edit nil 84(defconst vc-svn-use-edit nil
85 ;; Subversion does not provide this feature (yet).
85 "*Non-nil means to use `svn edit' to \"check out\" a file. 86 "*Non-nil means to use `svn edit' to \"check out\" a file.
86This is only meaningful if you don't use the implicit checkout model 87This is only meaningful if you don't use the implicit checkout model
87\(i.e. if you have $SVNREAD set)." 88\(i.e. if you have $SVNREAD set)."
88 :type 'boolean 89 ;; :type 'boolean
89 :version "21.4" 90 ;; :version "21.4"
90 :group 'vc) 91 ;; :group 'vc
92 )
91 93
92;;; 94;;;
93;;; State-querying functions 95;;; State-querying functions
@@ -151,6 +153,9 @@ This is only meaningful if you don't use the implicit checkout model
151 ;; It looks like Subversion has no equivalent of CVSREAD. 153 ;; It looks like Subversion has no equivalent of CVSREAD.
152 'implicit) 154 'implicit)
153 155
156;; vc-svn-mode-line-string doesn't exist because the default implementation
157;; works just fine.
158
154(defun vc-svn-dired-state-info (file) 159(defun vc-svn-dired-state-info (file)
155 "SVN-specific version of `vc-dired-state-info'." 160 "SVN-specific version of `vc-dired-state-info'."
156 (let ((svn-state (vc-state file))) 161 (let ((svn-state (vc-state file)))
@@ -171,11 +176,7 @@ COMMENT can be used to provide an initial description of FILE.
171 176
172`vc-register-switches' and `vc-svn-register-switches' are passed to 177`vc-register-switches' and `vc-svn-register-switches' are passed to
173the SVN command (in that order)." 178the SVN command (in that order)."
174 (apply 'vc-svn-command nil 0 file 179 (apply 'vc-svn-command nil 0 file "add" (vc-switches 'SVN 'register)))
175 "add"
176 ;; (and comment (string-match "[^\t\n ]" comment)
177 ;; (concat "-m" comment))
178 (vc-switches 'SVN 'register)))
179 180
180(defun vc-svn-responsible-p (file) 181(defun vc-svn-responsible-p (file)
181 "Return non-nil if SVN thinks it is responsible for FILE." 182 "Return non-nil if SVN thinks it is responsible for FILE."
@@ -240,13 +241,13 @@ This is only possible if SVN is responsible for FILE's directory.")
240 ;; Check out a particular version (or recreate the file). 241 ;; Check out a particular version (or recreate the file).
241 (vc-file-setprop file 'vc-workfile-version nil) 242 (vc-file-setprop file 'vc-workfile-version nil)
242 (apply 'vc-svn-command nil 0 file 243 (apply 'vc-svn-command nil 0 file
243 "-w"
244 "update" 244 "update"
245 ;; default for verbose checkout: clear the sticky tag so 245 ;; default for verbose checkout: clear the sticky tag so
246 ;; that the actual update will get the head of the trunk 246 ;; that the actual update will get the head of the trunk
247 (if (or (not rev) (string= rev "")) 247 (cond
248 "-A" 248 ((null rev) "-rBASE")
249 (concat "-r" rev)) 249 ((or (eq rev t) (equal rev "")) nil)
250 (t (concat "-r" rev)))
250 switches))) 251 switches)))
251 252
252(defun vc-svn-delete-file (file) 253(defun vc-svn-delete-file (file)
@@ -376,29 +377,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
376 377
377(defun vc-svn-diff-tree (dir &optional rev1 rev2) 378(defun vc-svn-diff-tree (dir &optional rev1 rev2)
378 "Diff all files at and below DIR." 379 "Diff all files at and below DIR."
379 (with-current-buffer "*vc-diff*" 380 (vc-svn-diff (file-name-as-directory dir) rev1 rev2))
380 (setq default-directory dir)
381 (if (vc-stay-local-p dir)
382 ;; local diff: do it filewise, and only for files that are modified
383 (vc-file-tree-walk
384 dir
385 (lambda (f)
386 (vc-exec-after
387 `(let ((coding-system-for-read (vc-coding-system-for-diff ',f)))
388 ;; possible optimization: fetch the state of all files
389 ;; in the tree via vc-svn-dir-state-heuristic
390 (unless (vc-up-to-date-p ',f)
391 (message "Looking at %s" ',f)
392 (vc-diff-internal ',f ',rev1 ',rev2))))))
393 ;; svn diff: use a single call for the entire tree
394 (let ((coding-system-for-read (or coding-system-for-read 'undecided))
395 (switches (vc-switches 'SVN 'diff)))
396 (apply 'vc-svn-command "*vc-diff*" 1 nil "diff"
397 (append
398 (when rev1
399 (list "-r" (if rev2 (concat rev1 ":" rev2) rev1)))
400 (when switches
401 (list "-x" (mapconcat 'identity switches " ")))))))))
402 381
403;;; 382;;;
404;;; Snapshot system 383;;; Snapshot system
@@ -407,46 +386,19 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
407(defun vc-svn-create-snapshot (dir name branchp) 386(defun vc-svn-create-snapshot (dir name branchp)
408 "Assign to DIR's current version a given NAME. 387 "Assign to DIR's current version a given NAME.
409If BRANCHP is non-nil, the name is created as a branch (and the current 388If BRANCHP is non-nil, the name is created as a branch (and the current
410workspace is immediately moved to that new branch)." 389workspace is immediately moved to that new branch).
411 (vc-svn-command nil 0 dir "tag" "-c" (if branchp "-b") name) 390NAME is assumed to be a URL."
412 (when branchp (vc-svn-command nil 0 dir "update" "-r" name))) 391 (vc-svn-command nil 0 dir "copy" name)
392 (when branchp (vc-svn-retrieve-snapshot dir name nil)))
413 393
414(defun vc-svn-retrieve-snapshot (dir name update) 394(defun vc-svn-retrieve-snapshot (dir name update)
415 "Retrieve a snapshot at and below DIR. 395 "Retrieve a snapshot at and below DIR.
416NAME is the name of the snapshot; if it is empty, do a `svn update'. 396NAME is the name of the snapshot; if it is empty, do a `svn update'.
417If UPDATE is non-nil, then update (resynch) any affected buffers." 397If UPDATE is non-nil, then update (resynch) any affected buffers.
418 (with-current-buffer (get-buffer-create "*vc*") 398NAME is assumed to be a URL."
419 (let ((default-directory dir) 399 (vc-svn-command nil 0 dir "switch" name)
420 (sticky-tag)) 400 ;; FIXME: parse the output and obey `update'.
421 (erase-buffer) 401 )
422 (if (or (not name) (string= name ""))
423 (vc-svn-command t 0 nil "update")
424 (vc-svn-command t 0 nil "update" "-r" name)
425 (setq sticky-tag name))
426 (when update
427 (goto-char (point-min))
428 (while (not (eobp))
429 (if (looking-at "\\([CMUP]\\) \\(.*\\)")
430 (let* ((file (expand-file-name (match-string 2) dir))
431 (state (match-string 1))
432 (buffer (find-buffer-visiting file)))
433 (when buffer
434 (cond
435 ((or (string= state "U")
436 (string= state "P"))
437 (vc-file-setprop file 'vc-state 'up-to-date)
438 (vc-file-setprop file 'vc-workfile-version nil)
439 (vc-file-setprop file 'vc-checkout-time
440 (nth 5 (file-attributes file))))
441 ((or (string= state "M")
442 (string= state "C"))
443 (vc-file-setprop file 'vc-state 'edited)
444 (vc-file-setprop file 'vc-workfile-version nil)
445 (vc-file-setprop file 'vc-checkout-time 0)))
446 (vc-file-setprop file 'vc-svn-sticky-tag sticky-tag)
447 (vc-resynch-buffer file t t))))
448 (forward-line 1))))))
449
450 402
451;;; 403;;;
452;;; Miscellaneous 404;;; Miscellaneous