Mercurial > emacs
comparison lisp/vc-svn.el @ 91048:d38543a1c0f9
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 880-885)
- Remove RCS keywords from doc/misc/cc-mode.texi
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-264
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 13 Oct 2007 05:53:03 +0000 |
parents | 14c4a6aac623 b16f7408cd3f |
children | 4b09bb044f38 |
comparison
equal
deleted
inserted
replaced
91047:1cf8ecbaa1dc | 91048:d38543a1c0f9 |
---|---|
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-revision (file rev) |
189 (let ((newrev (1- (string-to-number rev)))) | 189 (let ((newrev (1- (string-to-number rev)))) |
190 (when (< 0 newrev) | 190 (when (< 0 newrev) |
191 (number-to-string newrev)))) | 191 (number-to-string newrev)))) |
192 | 192 |
193 (defun vc-svn-next-version (file rev) | 193 (defun vc-svn-next-revision (file rev) |
194 (let ((newrev (1+ (string-to-number rev)))) | 194 (let ((newrev (1+ (string-to-number rev)))) |
195 ;; The "workfile version" is an uneasy conceptual fit under Subversion; | 195 ;; The "working revision" is an uneasy conceptual fit under Subversion; |
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 working revision |
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 |
391 (vc-delistify (mapcar 'file-relative-name files)) "\n")) | 391 (vc-delistify (mapcar 'file-relative-name files)) "\n")) |
392 (vc-svn-command | 392 (vc-svn-command |
393 buffer | 393 buffer |
394 (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0) | 394 (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0) |
395 files "log" | 395 files "log" |
396 ;; By default Subversion only shows the log upto the working version, | 396 ;; By default Subversion only shows the log upto the working revision, |
397 ;; whereas we also want the log of the subsequent commits. At least | 397 ;; whereas we also want the log of the subsequent commits. At least |
398 ;; that's what the vc-cvs.el code does. | 398 ;; that's what the vc-cvs.el code does. |
399 "-rHEAD:0"))) | 399 "-rHEAD:0"))) |
400 | 400 |
401 (defun vc-svn-wash-log () | 401 (defun vc-svn-wash-log () |
402 "Remove all non-comment information from log output." | 402 "Remove all non-comment information from log output." |
403 ;; FIXME: not implemented for SVN | 403 ;; FIXME: not implemented for SVN |
404 nil) | 404 nil) |
405 | 405 |
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 revisions 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 |
444 ;;; | 444 ;;; |
445 ;;; Snapshot system | 445 ;;; Snapshot system |
446 ;;; | 446 ;;; |
447 | 447 |
448 (defun vc-svn-create-snapshot (dir name branchp) | 448 (defun vc-svn-create-snapshot (dir name branchp) |
449 "Assign to DIR's current version a given NAME. | 449 "Assign to DIR's current revision a given NAME. |
450 If BRANCHP is non-nil, the name is created as a branch (and the current | 450 If BRANCHP is non-nil, the name is created as a branch (and the current |
451 workspace is immediately moved to that new branch). | 451 workspace is immediately moved to that new branch). |
452 NAME is assumed to be a URL." | 452 NAME is assumed to be a URL." |
453 (vc-svn-command nil 0 dir "copy" name) | 453 (vc-svn-command nil 0 dir "copy" name) |
454 (when branchp (vc-svn-retrieve-snapshot dir name nil))) | 454 (when branchp (vc-svn-retrieve-snapshot dir name nil))) |
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 |
600 ;; an uppercase or lowercase letter and can contain uppercase and | 600 ;; an uppercase or lowercase letter and can contain uppercase and |
601 ;; lowercase letters, digits, `-', and `_'. | 601 ;; lowercase letters, digits, `-', and `_'. |
602 (and (string-match "^[a-zA-Z]" tag) | 602 (and (string-match "^[a-zA-Z]" tag) |
603 (not (string-match "[^a-z0-9A-Z-_]" tag)))) | 603 (not (string-match "[^a-z0-9A-Z-_]" tag)))) |
604 | 604 |
605 (defun vc-svn-valid-version-number-p (tag) | 605 (defun vc-svn-valid-revision-number-p (tag) |
606 "Return non-nil if TAG is a valid version number." | 606 "Return non-nil if TAG is a valid revision number." |
607 (and (string-match "^[0-9]" tag) | 607 (and (string-match "^[0-9]" tag) |
608 (not (string-match "[^0-9]" tag)))) | 608 (not (string-match "[^0-9]" tag)))) |
609 | 609 |
610 ;; Support for `svn annotate' | 610 ;; Support for `svn annotate' |
611 | 611 |