Mercurial > emacs
comparison lisp/vc.el @ 108450:de8a1b891175
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Sun, 11 Apr 2010 10:53:01 +0000 |
parents | 9c5ceea9a88b |
children | 17d3324f96dd |
comparison
equal
deleted
inserted
replaced
108449:0346e41d1e53 | 108450:de8a1b891175 |
---|---|
61 ;; If your site uses the ChangeLog convention supported by Emacs, the | 61 ;; If your site uses the ChangeLog convention supported by Emacs, the |
62 ;; function `log-edit-comment-to-change-log' could prove a useful checkin hook, | 62 ;; function `log-edit-comment-to-change-log' could prove a useful checkin hook, |
63 ;; although you might prefer to use C-c C-a (i.e. `log-edit-insert-changelog') | 63 ;; although you might prefer to use C-c C-a (i.e. `log-edit-insert-changelog') |
64 ;; from the commit buffer instead or to set `log-edit-setup-invert'. | 64 ;; from the commit buffer instead or to set `log-edit-setup-invert'. |
65 ;; | 65 ;; |
66 ;; The vc code maintains some internal state in order to reduce expensive | 66 ;; When using SCCS, RCS, CVS: be careful not to do repo surgery, or |
67 ;; version-control operations to a minimum. Some names are only computed | 67 ;; operations like registrations and deletions and renames, outside VC |
68 ;; once. If you perform version control operations with the backend while | 68 ;; while VC is running. The support for these systems was designed |
69 ;; vc's back is turned, or move/rename master files while vc is running, | 69 ;; when disks were much slower, and the code maintains a lot of |
70 ;; vc may get seriously confused. Don't do these things! | 70 ;; internal state in order to reduce expensive operations to a |
71 ;; minimum. Thus, if you mess with the repo while VC's back is turned, | |
72 ;; VC may get seriously confused. | |
73 ;; | |
74 ;; When using Subversion or a later system, anything you do outside VC | |
75 ;; *through the VCS tools* should safely interlock with VC | |
76 ;; operations. Under these VC does little state caching, because local | |
77 ;; operations are assumed to be fast. The dividing line is | |
71 ;; | 78 ;; |
72 ;; ADDING SUPPORT FOR OTHER BACKENDS | 79 ;; ADDING SUPPORT FOR OTHER BACKENDS |
73 ;; | 80 ;; |
74 ;; VC can use arbitrary version control systems as a backend. To add | 81 ;; VC can use arbitrary version control systems as a backend. To add |
75 ;; support for a new backend named SYS, write a library vc-sys.el that | 82 ;; support for a new backend named SYS, write a library vc-sys.el that |
194 ;; | 201 ;; |
195 ;; - workfile-unchanged-p (file) | 202 ;; - workfile-unchanged-p (file) |
196 ;; | 203 ;; |
197 ;; Return non-nil if FILE is unchanged from the working revision. | 204 ;; Return non-nil if FILE is unchanged from the working revision. |
198 ;; This function should do a brief comparison of FILE's contents | 205 ;; This function should do a brief comparison of FILE's contents |
199 ;; with those of the repository master of the working revision. If | 206 ;; with those of the repository copy of the working revision. If |
200 ;; the backend does not have such a brief-comparison feature, the | 207 ;; the backend does not have such a brief-comparison feature, the |
201 ;; default implementation of this function can be used, which | 208 ;; default implementation of this function can be used, which |
202 ;; delegates to a full vc-BACKEND-diff. (Note that vc-BACKEND-diff | 209 ;; delegates to a full vc-BACKEND-diff. (Note that vc-BACKEND-diff |
203 ;; must not run asynchronously in this case, see variable | 210 ;; must not run asynchronously in this case, see variable |
204 ;; `vc-disable-async-diff'.) | 211 ;; `vc-disable-async-diff'.) |
782 :group 'vc) | 789 :group 'vc) |
783 | 790 |
784 (defcustom vc-checkout-carefully (= (user-uid) 0) | 791 (defcustom vc-checkout-carefully (= (user-uid) 0) |
785 "Non-nil means be extra-careful in checkout. | 792 "Non-nil means be extra-careful in checkout. |
786 Verify that the file really is not locked | 793 Verify that the file really is not locked |
787 and that its contents match what the master file says." | 794 and that its contents match what the repository version says." |
788 :type 'boolean | 795 :type 'boolean |
789 :group 'vc) | 796 :group 'vc) |
790 (make-obsolete-variable 'vc-checkout-carefully | 797 (make-obsolete-variable 'vc-checkout-carefully |
791 "the corresponding checks are always done now." | 798 "the corresponding checks are always done now." |
792 "21.1") | 799 "21.1") |
1516 (dolist (file files) | 1523 (dolist (file files) |
1517 (if (or (file-directory-p file) | 1524 (if (or (file-directory-p file) |
1518 (not (string= (vc-working-revision file) "0"))) | 1525 (not (string= (vc-working-revision file) "0"))) |
1519 (push file filtered) | 1526 (push file filtered) |
1520 ;; This file is added but not yet committed; | 1527 ;; This file is added but not yet committed; |
1521 ;; there is no master file to diff against. | 1528 ;; there is no repository version to diff against. |
1522 (if (or rev1 rev2) | 1529 (if (or rev1 rev2) |
1523 (error "No revisions of %s exist" file) | 1530 (error "No revisions of %s exist" file) |
1524 ;; We regard this as "changed". | 1531 ;; We regard this as "changed". |
1525 ;; Diff it against /dev/null. | 1532 ;; Diff it against /dev/null. |
1526 (apply 'vc-do-command "*vc-diff*" | 1533 (apply 'vc-do-command "*vc-diff*" |
2316 ;; here and not in vc-revert-file because we don't want to | 2323 ;; here and not in vc-revert-file because we don't want to |
2317 ;; delete that copy -- it is still useful for OLD-BACKEND. | 2324 ;; delete that copy -- it is still useful for OLD-BACKEND. |
2318 (if unmodified-file | 2325 (if unmodified-file |
2319 (copy-file unmodified-file file | 2326 (copy-file unmodified-file file |
2320 'ok-if-already-exists 'keep-date) | 2327 'ok-if-already-exists 'keep-date) |
2321 (when (y-or-n-p "Get base revision from master? ") | 2328 (when (y-or-n-p "Get base revision from repository? ") |
2322 (vc-revert-file file)))) | 2329 (vc-revert-file file)))) |
2323 (vc-call-backend new-backend 'receive-file file rev)) | 2330 (vc-call-backend new-backend 'receive-file file rev)) |
2324 (when modified-file | 2331 (when modified-file |
2325 (vc-switch-backend file new-backend) | 2332 (vc-switch-backend file new-backend) |
2326 (unless (eq (vc-checkout-model new-backend (list file)) 'implicit) | 2333 (unless (eq (vc-checkout-model new-backend (list file)) 'implicit) |
2403 ;; updated after this. | 2410 ;; updated after this. |
2404 (vc-resynch-buffer file nil t))) | 2411 (vc-resynch-buffer file nil t))) |
2405 | 2412 |
2406 ;;;###autoload | 2413 ;;;###autoload |
2407 (defun vc-rename-file (old new) | 2414 (defun vc-rename-file (old new) |
2408 "Rename file OLD to NEW, and rename its master file likewise." | 2415 "Rename file OLD to NEW in both work area and repository." |
2409 (interactive "fVC rename file: \nFRename to: ") | 2416 (interactive "fVC rename file: \nFRename to: ") |
2410 ;; in CL I would have said (setq new (merge-pathnames new old)) | 2417 ;; in CL I would have said (setq new (merge-pathnames new old)) |
2411 (let ((old-base (file-name-nondirectory old))) | 2418 (let ((old-base (file-name-nondirectory old))) |
2412 (when (and (not (string= "" old-base)) | 2419 (when (and (not (string= "" old-base)) |
2413 (string= "" (file-name-nondirectory new))) | 2420 (string= "" (file-name-nondirectory new))) |