comparison lisp/vc-svn.el @ 85139:8ba0e30716a5

Terminology cleanup.
author Eric S. Raymond <esr@snark.thyrsus.com>
date Wed, 10 Oct 2007 18:52:45 +0000
parents c2cc930bdd9e
children b16f7408cd3f
comparison
equal deleted inserted replaced
85138:9eb84ff59d9b 85139:8ba0e30716a5
158 ;; enough. Otherwise it might fail with remote repositories. 158 ;; enough. Otherwise it might fail with remote repositories.
159 (with-temp-buffer 159 (with-temp-buffer
160 (vc-svn-command t 0 nil "status" (if localp "-v" "-u")) 160 (vc-svn-command t 0 nil "status" (if localp "-v" "-u"))
161 (vc-svn-parse-status)))) 161 (vc-svn-parse-status))))
162 162
163 (defun vc-svn-workfile-version (file) 163 (defun vc-svn-working-revision (file)
164 "SVN-specific version of `vc-workfile-version'." 164 "SVN-specific version of `vc-working-revision'."
165 ;; There is no need to consult RCS headers under SVN, because we 165 ;; There is no need to consult RCS headers under SVN, because we
166 ;; get the workfile version for free when we recognize that a file 166 ;; get the workfile version for free when we recognize that a file
167 ;; is registered in SVN. 167 ;; is registered in SVN.
168 (vc-svn-registered file) 168 (vc-svn-registered file)
169 (vc-file-getprop file 'vc-workfile-version)) 169 (vc-file-getprop file 'vc-working-revision))
170 170
171 (defun vc-svn-checkout-model (file) 171 (defun vc-svn-checkout-model (file)
172 "SVN-specific version of `vc-checkout-model'." 172 "SVN-specific version of `vc-checkout-model'."
173 ;; It looks like Subversion has no equivalent of CVSREAD. 173 ;; It looks like Subversion has no equivalent of CVSREAD.
174 'implicit) 174 'implicit)
178 178
179 (defun vc-svn-dired-state-info (file) 179 (defun vc-svn-dired-state-info (file)
180 "SVN-specific version of `vc-dired-state-info'." 180 "SVN-specific version of `vc-dired-state-info'."
181 (let ((svn-state (vc-state file))) 181 (let ((svn-state (vc-state file)))
182 (cond ((eq svn-state 'edited) 182 (cond ((eq svn-state 'edited)
183 (if (equal (vc-workfile-version file) "0") 183 (if (equal (vc-working-revision file) "0")
184 "(added)" "(modified)")) 184 "(added)" "(modified)"))
185 ((eq svn-state 'needs-patch) "(patch)") 185 ((eq svn-state 'needs-patch) "(patch)")
186 ((eq svn-state 'needs-merge) "(merge)")))) 186 ((eq svn-state 'needs-merge) "(merge)"))))
187 187
188 (defun vc-svn-previous-version (file rev) 188 (defun vc-svn-previous-version (file rev)
196 ;; we use it as the upper bound until a better idea comes along. If the 196 ;; we use it as the upper bound until a better idea comes along. If the
197 ;; workfile version W coincides with the tree's latest revision R, then 197 ;; workfile version W coincides with the tree's latest revision R, then
198 ;; this check prevents a "no such revision: R+1" error. Otherwise, it 198 ;; this check prevents a "no such revision: R+1" error. Otherwise, it
199 ;; inhibits showing of W+1 through R, which could be considered anywhere 199 ;; inhibits showing of W+1 through R, which could be considered anywhere
200 ;; from gracious to impolite. 200 ;; from gracious to impolite.
201 (unless (< (string-to-number (vc-file-getprop file 'vc-workfile-version)) 201 (unless (< (string-to-number (vc-file-getprop file 'vc-working-revision))
202 newrev) 202 newrev)
203 (number-to-string newrev)))) 203 (number-to-string newrev))))
204 204
205 205
206 ;;; 206 ;;;
254 (goto-char (point-min)) 254 (goto-char (point-min))
255 (shrink-window-if-larger-than-buffer) 255 (shrink-window-if-larger-than-buffer)
256 (error "Check-in failed")))) 256 (error "Check-in failed"))))
257 ;; Update file properties 257 ;; Update file properties
258 ;; (vc-file-setprop 258 ;; (vc-file-setprop
259 ;; file 'vc-workfile-version 259 ;; file 'vc-working-revision
260 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) 260 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
261 )) 261 ))
262 262
263 (defun vc-svn-find-version (file rev buffer) 263 (defun vc-svn-find-revision (file rev buffer)
264 "SVN-specific retrieval of a specified version into a buffer." 264 "SVN-specific retrieval of a specified version into a buffer."
265 (apply 'vc-svn-command 265 (apply 'vc-svn-command
266 buffer 0 file 266 buffer 0 file
267 "cat" 267 "cat"
268 (and rev (not (string= rev "")) 268 (and rev (not (string= rev ""))
279 (defun vc-svn-update (file editable rev switches) 279 (defun vc-svn-update (file editable rev switches)
280 (if (and (file-exists-p file) (not rev)) 280 (if (and (file-exists-p file) (not rev))
281 ;; If no revision was specified, there's nothing to do. 281 ;; If no revision was specified, there's nothing to do.
282 nil 282 nil
283 ;; Check out a particular version (or recreate the file). 283 ;; Check out a particular version (or recreate the file).
284 (vc-file-setprop file 'vc-workfile-version nil) 284 (vc-file-setprop file 'vc-working-revision nil)
285 (apply 'vc-svn-command nil 0 file 285 (apply 'vc-svn-command nil 0 file
286 "update" 286 "update"
287 ;; default for verbose checkout: clear the sticky tag so 287 ;; default for verbose checkout: clear the sticky tag so
288 ;; that the actual update will get the head of the trunk 288 ;; that the actual update will get the head of the trunk
289 (cond 289 (cond
319 0))) ; signal success 319 0))) ; signal success
320 320
321 (defun vc-svn-merge-news (file) 321 (defun vc-svn-merge-news (file)
322 "Merge in any new changes made to FILE." 322 "Merge in any new changes made to FILE."
323 (message "Merging changes into %s..." file) 323 (message "Merging changes into %s..." file)
324 ;; (vc-file-setprop file 'vc-workfile-version nil) 324 ;; (vc-file-setprop file 'vc-working-revision nil)
325 (vc-file-setprop file 'vc-checkout-time 0) 325 (vc-file-setprop file 'vc-checkout-time 0)
326 (vc-svn-command nil 0 file "update") 326 (vc-svn-command nil 0 file "update")
327 ;; Analyze the merge result reported by SVN, and set 327 ;; Analyze the merge result reported by SVN, and set
328 ;; file properties accordingly. 328 ;; file properties accordingly.
329 (with-current-buffer (get-buffer "*vc*") 329 (with-current-buffer (get-buffer "*vc*")
330 (goto-char (point-min)) 330 (goto-char (point-min))
331 ;; get new workfile version 331 ;; get new workfile version
332 (if (re-search-forward 332 (if (re-search-forward
333 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t) 333 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t)
334 (vc-file-setprop file 'vc-workfile-version (match-string 2)) 334 (vc-file-setprop file 'vc-working-revision (match-string 2))
335 (vc-file-setprop file 'vc-workfile-version nil)) 335 (vc-file-setprop file 'vc-working-revision nil))
336 ;; get file status 336 ;; get file status
337 (goto-char (point-min)) 337 (goto-char (point-min))
338 (prog1 338 (prog1
339 (if (looking-at "At revision") 339 (if (looking-at "At revision")
340 0 ;; there were no news; indicate success 340 0 ;; there were no news; indicate success
406 (defun vc-svn-diff (files &optional oldvers newvers buffer) 406 (defun vc-svn-diff (files &optional oldvers newvers buffer)
407 "Get a difference report using SVN between two versions of fileset FILES." 407 "Get a difference report using SVN between two versions of fileset FILES."
408 (and oldvers 408 (and oldvers
409 (catch 'no 409 (catch 'no
410 (dolist (f files) 410 (dolist (f files)
411 (or (equal oldvers (vc-workfile-version f)) 411 (or (equal oldvers (vc-working-revision f))
412 (throw 'no nil))) 412 (throw 'no nil)))
413 t) 413 t)
414 ;; Use nil rather than the current revision because svn handles 414 ;; Use nil rather than the current revision because svn handles
415 ;; it better (i.e. locally). Note that if _any_ of the files 415 ;; it better (i.e. locally). Note that if _any_ of the files
416 ;; has a different revision, we fetch the lot, which is 416 ;; has a different revision, we fetch the lot, which is
564 ;; `vc-BACKEND-registered' must not set vc-backend, 564 ;; `vc-BACKEND-registered' must not set vc-backend,
565 ;; which is instead set in vc-registered. 565 ;; which is instead set in vc-registered.
566 (unless filename (vc-file-setprop file 'vc-backend 'SVN)) 566 (unless filename (vc-file-setprop file 'vc-backend 'SVN))
567 ;; Use the last-modified revision, so that searching in vc-print-log 567 ;; Use the last-modified revision, so that searching in vc-print-log
568 ;; output works. 568 ;; output works.
569 (vc-file-setprop file 'vc-workfile-version (match-string 3)) 569 (vc-file-setprop file 'vc-working-revision (match-string 3))
570 ;; Remember Svn's own status. 570 ;; Remember Svn's own status.
571 (vc-file-setprop file 'vc-svn-status status) 571 (vc-file-setprop file 'vc-svn-status status)
572 (vc-file-setprop 572 (vc-file-setprop
573 file 'vc-state 573 file 'vc-state
574 (cond 574 (cond
578 (vc-file-setprop file 'vc-checkout-time 578 (vc-file-setprop file 'vc-checkout-time
579 (nth 5 (file-attributes file))) 579 (nth 5 (file-attributes file)))
580 'up-to-date)) 580 'up-to-date))
581 ((eq status ?A) 581 ((eq status ?A)
582 ;; If the file was actually copied, (match-string 2) is "-". 582 ;; If the file was actually copied, (match-string 2) is "-".
583 (vc-file-setprop file 'vc-workfile-version "0") 583 (vc-file-setprop file 'vc-working-revision "0")
584 (vc-file-setprop file 'vc-checkout-time 0) 584 (vc-file-setprop file 'vc-checkout-time 0)
585 'edited) 585 'edited)
586 ((memq status '(?M ?C)) 586 ((memq status '(?M ?C))
587 (if (eq (char-after (match-beginning 1)) ?*) 587 (if (eq (char-after (match-beginning 1)) ?*)
588 'needs-merge 588 'needs-merge