Mercurial > emacs
comparison lisp/vc-mcvs.el @ 90988:492971a3f31f unicode-xft-base
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 816-823)
- Update from CVS
- Merge from emacs--rel--22
* emacs--rel--22 (patch 59-69)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 237-238)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-235
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 24 Jul 2007 01:23:55 +0000 |
parents | 95d0cdf160ea 09a639d5f43e |
children | f55f9811f5d7 |
comparison
equal
deleted
inserted
replaced
90987:b2d8a283f27e | 90988:492971a3f31f |
---|---|
107 \(i.e. if you have $CVSREAD set)." | 107 \(i.e. if you have $CVSREAD set)." |
108 :type 'boolean | 108 :type 'boolean |
109 :version "22.1" | 109 :version "22.1" |
110 :group 'vc) | 110 :group 'vc) |
111 | 111 |
112 ;;; Properties of the backend | |
113 | |
114 (defun vc-mcvs-revision-granularity () | |
115 'file) | |
116 | |
112 ;;; | 117 ;;; |
113 ;;; State-querying functions | 118 ;;; State-querying functions |
114 ;;; | 119 ;;; |
115 | 120 |
116 ;;;###autoload (defun vc-mcvs-registered (file) | 121 ;;;###autoload (defun vc-mcvs-registered (file) |
200 | 205 |
201 ;;; | 206 ;;; |
202 ;;; State-changing functions | 207 ;;; State-changing functions |
203 ;;; | 208 ;;; |
204 | 209 |
205 (defun vc-mcvs-register (file &optional rev comment) | 210 (defun vc-mcvs-register (files &optional rev comment) |
206 "Register FILE into the Meta-CVS version-control system. | 211 "Register FILES into the Meta-CVS version-control system. |
207 COMMENT can be used to provide an initial description of FILE. | 212 COMMENT can be used to provide an initial description of FILE. |
208 | 213 |
209 `vc-register-switches' and `vc-mcvs-register-switches' are passed to | 214 `vc-register-switches' and `vc-mcvs-register-switches' are passed to |
210 the Meta-CVS command (in that order)." | 215 the Meta-CVS command (in that order)." |
211 (let* ((filename (file-name-nondirectory file)) | 216 ;; FIXME: multiple-file case should be made to work |
217 (if (> (length files) 1) (error "Registering filesets is not yet supported.")) | |
218 (let* ((file (car files)) | |
219 (filename (file-name-nondirectory file)) | |
212 (extpos (string-match "\\." filename)) | 220 (extpos (string-match "\\." filename)) |
213 (ext (if extpos (substring filename (1+ extpos)))) | 221 (ext (if extpos (substring filename (1+ extpos)))) |
214 (root (vc-mcvs-root file)) | 222 (root (vc-mcvs-root file)) |
215 (types-file (expand-file-name "MCVS/TYPES" root)) | 223 (types-file (expand-file-name "MCVS/TYPES" root)) |
216 (map-file (expand-file-name "MCVS/MAP" root)) | 224 (map-file (expand-file-name "MCVS/MAP" root)) |
255 | 263 |
256 (defalias 'vc-cvs-could-register 'vc-cvs-responsible-p | 264 (defalias 'vc-cvs-could-register 'vc-cvs-responsible-p |
257 "Return non-nil if FILE could be registered in Meta-CVS. | 265 "Return non-nil if FILE could be registered in Meta-CVS. |
258 This is only possible if Meta-CVS is responsible for FILE's directory.") | 266 This is only possible if Meta-CVS is responsible for FILE's directory.") |
259 | 267 |
260 (defun vc-mcvs-checkin (file rev comment) | 268 (defun vc-mcvs-checkin (files rev comment) |
261 "Meta-CVS-specific version of `vc-backend-checkin'." | 269 "Meta-CVS-specific version of `vc-backend-checkin'." |
262 (unless (or (not rev) (vc-mcvs-valid-version-number-p rev)) | 270 (unless (or (not rev) (vc-mcvs-valid-version-number-p rev)) |
263 (if (not (vc-mcvs-valid-symbolic-tag-name-p rev)) | 271 (if (not (vc-mcvs-valid-symbolic-tag-name-p rev)) |
264 (error "%s is not a valid symbolic tag name" rev) | 272 (error "%s is not a valid symbolic tag name" rev) |
265 ;; If the input revision is a valid symbolic tag name, we create it | 273 ;; If the input revision is a valid symbolic tag name, we create it |
266 ;; as a branch, commit and switch to it. | 274 ;; as a branch, commit and switch to it. |
267 ;; This file-specific form of branching is deprecated. | 275 ;; This file-specific form of branching is deprecated. |
268 ;; We can't use `mcvs branch' and `mcvs switch' because they cannot | 276 ;; We can't use `mcvs branch' and `mcvs switch' because they cannot |
269 ;; be applied just to this one file. | 277 ;; be applied just to this one file. |
270 (apply 'vc-mcvs-command nil 0 file "tag" "-b" (list rev)) | 278 (apply 'vc-mcvs-command nil 0 files "tag" "-b" (list rev)) |
271 (apply 'vc-mcvs-command nil 0 file "update" "-r" (list rev)) | 279 (apply 'vc-mcvs-command nil 0 files "update" "-r" (list rev)) |
272 (vc-file-setprop file 'vc-mcvs-sticky-tag rev) | 280 (mapcar (lambda (file) (vc-file-setprop file 'vc-mcvs-sticky-tag rev)) |
281 files) | |
273 (setq rev nil))) | 282 (setq rev nil))) |
274 ;; This commit might cvs-commit several files (e.g. MAP and TYPES) | 283 ;; This commit might cvs-commit several files (e.g. MAP and TYPES) |
275 ;; so using numbered revs here is dangerous and somewhat meaningless. | 284 ;; so using numbered revs here is dangerous and somewhat meaningless. |
276 (when rev (error "Cannot commit to a specific revision number")) | 285 (when rev (error "Cannot commit to a specific revision number")) |
277 (let ((status (apply 'vc-mcvs-command nil 1 file | 286 (let ((status (apply 'vc-mcvs-command nil 1 files |
278 "ci" "-m" comment | 287 "ci" "-m" comment |
279 (vc-switches 'MCVS 'checkin)))) | 288 (vc-switches 'MCVS 'checkin)))) |
280 (set-buffer "*vc*") | 289 (set-buffer "*vc*") |
281 (goto-char (point-min)) | 290 (goto-char (point-min)) |
282 (when (not (zerop status)) | 291 (when (not (zerop status)) |
283 ;; Check checkin problem. | 292 ;; Check checkin problem. |
284 (cond | 293 (cond |
285 ((re-search-forward "Up-to-date check failed" nil t) | 294 ((re-search-forward "Up-to-date check failed" nil t) |
286 (vc-file-setprop file 'vc-state 'needs-merge) | 295 (mapcar (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge)) |
296 files) | |
287 (error (substitute-command-keys | 297 (error (substitute-command-keys |
288 (concat "Up-to-date check failed: " | 298 (concat "Up-to-date check failed: " |
289 "type \\[vc-next-action] to merge in changes")))) | 299 "type \\[vc-next-action] to merge in changes")))) |
290 (t | 300 (t |
291 (pop-to-buffer (current-buffer)) | 301 (pop-to-buffer (current-buffer)) |
292 (goto-char (point-min)) | 302 (goto-char (point-min)) |
293 (shrink-window-if-larger-than-buffer) | 303 (shrink-window-if-larger-than-buffer) |
294 (error "Check-in failed")))) | 304 (error "Check-in failed")))) |
295 ;; Update file properties | 305 ;; Single-file commit? Then update the version by parsing the buffer. |
296 (vc-file-setprop | 306 ;; Otherwise we can't necessarily tell what goes with what; clear |
297 file 'vc-workfile-version | 307 ;; its properties so they have to be refetched. |
298 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) | 308 (if (= (length files) 1) |
299 ;; Forget the checkout model of the file, because we might have | 309 (vc-file-setprop |
310 (car files) 'vc-workfile-version | |
311 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) | |
312 (mapc (lambda (file) (vc-file-clearprops file)) files)) | |
313 ;; Anyway, forget the checkout model of the file, because we might have | |
300 ;; guessed wrong when we found the file. After commit, we can | 314 ;; guessed wrong when we found the file. After commit, we can |
301 ;; tell it from the permissions of the file (see | 315 ;; tell it from the permissions of the file (see |
302 ;; vc-mcvs-checkout-model). | 316 ;; vc-mcvs-checkout-model). |
303 (vc-file-setprop file 'vc-checkout-model nil) | 317 (mapc (lambda (file) (vc-file-setprop file 'vc-checkout-model nil)) |
318 files) | |
304 | 319 |
305 ;; if this was an explicit check-in (does not include creation of | 320 ;; if this was an explicit check-in (does not include creation of |
306 ;; a branch), remove the sticky tag. | 321 ;; a branch), remove the sticky tag. |
307 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev))) | 322 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev))) |
308 (vc-mcvs-command nil 0 file "update" "-A")))) | 323 (vc-mcvs-command nil 0 files "update" "-A")))) |
309 | 324 |
310 (defun vc-mcvs-find-version (file rev buffer) | 325 (defun vc-mcvs-find-version (file rev buffer) |
311 (apply 'vc-mcvs-command | 326 (apply 'vc-mcvs-command |
312 buffer 0 file | 327 buffer 0 file |
313 "-Q" ; suppress diagnostic output | 328 "-Q" ; suppress diagnostic output |
419 | 434 |
420 ;;; | 435 ;;; |
421 ;;; History functions | 436 ;;; History functions |
422 ;;; | 437 ;;; |
423 | 438 |
424 (defun vc-mcvs-print-log (file &optional buffer) | 439 (defun vc-mcvs-print-log (files &optional buffer) |
425 "Get change log associated with FILE." | 440 "Get change log associated with FILES." |
426 (let ((default-directory (vc-mcvs-root file))) | 441 (let ((default-directory (vc-mcvs-root (car files)))) |
427 ;; Run the command from the root dir so that `mcvs filt' returns | 442 ;; Run the command from the root dir so that `mcvs filt' returns |
428 ;; valid relative names. | 443 ;; valid relative names. |
429 (vc-mcvs-command | 444 (vc-mcvs-command |
430 buffer | 445 buffer |
431 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) | 446 (if (and (vc-stay-local-p files) (fboundp 'start-process)) 'async 0) |
432 file "log"))) | 447 files "log"))) |
433 | 448 |
434 (defun vc-mcvs-diff (file &optional oldvers newvers buffer) | 449 (defun vc-mcvs-diff (files &optional oldvers newvers buffer) |
435 "Get a difference report using Meta-CVS between two versions of FILE." | 450 "Get a difference report using Meta-CVS between two versions of FILES." |
436 (if (string= (vc-workfile-version file) "0") | |
437 ;; This file is added but not yet committed; there is no master file. | |
438 (if (or oldvers newvers) | |
439 (error "No revisions of %s exist" file) | |
440 ;; We regard this as "changed". | |
441 ;; Diff it against /dev/null. | |
442 ;; Note: this is NOT a "mcvs diff". | |
443 (apply 'vc-do-command (or buffer "*vc-diff*") | |
444 1 "diff" file | |
445 (append (vc-switches nil 'diff) '("/dev/null"))) | |
446 ;; Even if it's empty, it's locally modified. | |
447 1) | |
448 (let* ((async (and (not vc-disable-async-diff) | 451 (let* ((async (and (not vc-disable-async-diff) |
449 (vc-stay-local-p file) | 452 (vc-stay-local-p files) |
450 (fboundp 'start-process))) | 453 (fboundp 'start-process))) |
451 ;; Run the command from the root dir so that `mcvs filt' returns | 454 ;; Run the command from the root dir so that `mcvs filt' returns |
452 ;; valid relative names. | 455 ;; valid relative names. |
453 (default-directory (vc-mcvs-root file)) | 456 (default-directory (vc-mcvs-root (car files))) |
454 (status | 457 (status |
455 (apply 'vc-mcvs-command (or buffer "*vc-diff*") | 458 (apply 'vc-mcvs-command (or buffer "*vc-diff*") |
456 (if async 'async 1) | 459 (if async 'async 1) |
457 file "diff" | 460 files "diff" |
458 (and oldvers (concat "-r" oldvers)) | 461 (and oldvers (concat "-r" oldvers)) |
459 (and newvers (concat "-r" newvers)) | 462 (and newvers (concat "-r" newvers)) |
460 (vc-switches 'MCVS 'diff)))) | 463 (vc-switches 'MCVS 'diff)))) |
461 (if async 1 status)))) ; async diff, pessimistic assumption. | 464 (if async 1 status))) ; async diff, pessimistic assumption. |
462 | 465 |
463 (defun vc-mcvs-diff-tree (dir &optional rev1 rev2) | 466 (defun vc-mcvs-diff-tree (dir &optional rev1 rev2) |
464 "Diff all files at and below DIR." | 467 "Diff all files at and below DIR." |
465 (with-current-buffer "*vc-diff*" | 468 (with-current-buffer "*vc-diff*" |
466 ;; Run the command from the root dir so that `mcvs filt' returns | 469 ;; Run the command from the root dir so that `mcvs filt' returns |