Mercurial > emacs
comparison lisp/vc-rcs.el @ 49597:e88404e8f2cf
Trailing whitespace deleted.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 04 Feb 2003 12:29:42 +0000 |
parents | da6da3a685c2 |
children | c03b80e1bacd d7ddb3e565de |
comparison
equal
deleted
inserted
replaced
49596:b06535145619 | 49597:e88404e8f2cf |
---|---|
3 ;; Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992,93,94,95,96,97,98,99,2000,2001 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: FSF (see vc.el for full credits) | 5 ;; Author: FSF (see vc.el for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
7 | 7 |
8 ;; $Id: vc-rcs.el,v 1.34 2003/01/03 15:27:35 spiegel Exp $ | 8 ;; $Id: vc-rcs.el,v 1.35 2003/01/07 08:28:15 spiegel Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
141 (if (and (eq state 'up-to-date) | 141 (if (and (eq state 'up-to-date) |
142 (not (vc-mistrust-permissions file))) | 142 (not (vc-mistrust-permissions file))) |
143 (cond | 143 (cond |
144 ((string-match ".rw..-..-." (nth 8 (file-attributes file))) | 144 ((string-match ".rw..-..-." (nth 8 (file-attributes file))) |
145 (vc-file-setprop file 'vc-checkout-model 'implicit) | 145 (vc-file-setprop file 'vc-checkout-model 'implicit) |
146 (setq state | 146 (setq state |
147 (if (vc-rcs-workfile-is-newer file) | 147 (if (vc-rcs-workfile-is-newer file) |
148 'edited | 148 'edited |
149 'up-to-date))) | 149 'up-to-date))) |
150 ((string-match ".r-..-..-." (nth 8 (file-attributes file))) | 150 ((string-match ".r-..-..-." (nth 8 (file-attributes file))) |
151 (vc-file-setprop file 'vc-checkout-model 'locking)))) | 151 (vc-file-setprop file 'vc-checkout-model 'locking)))) |
152 state) | 152 state) |
153 (if (not (vc-mistrust-permissions file)) | 153 (if (not (vc-mistrust-permissions file)) |
160 ((string-match ".rw..-..-." permissions) | 160 ((string-match ".rw..-..-." permissions) |
161 (if (eq (vc-checkout-model file) 'locking) | 161 (if (eq (vc-checkout-model file) 'locking) |
162 (if (file-ownership-preserved-p file) | 162 (if (file-ownership-preserved-p file) |
163 'edited | 163 'edited |
164 (vc-user-login-name owner-uid)) | 164 (vc-user-login-name owner-uid)) |
165 (if (vc-rcs-workfile-is-newer file) | 165 (if (vc-rcs-workfile-is-newer file) |
166 'edited | 166 'edited |
167 'up-to-date))) | 167 'up-to-date))) |
168 (t | 168 (t |
169 ;; Strange permissions. Fall through to | 169 ;; Strange permissions. Fall through to |
170 ;; expensive state computation. | 170 ;; expensive state computation. |
241 (list vc-register-switches) | 241 (list vc-register-switches) |
242 vc-register-switches) | 242 vc-register-switches) |
243 (if (stringp vc-rcs-register-switches) | 243 (if (stringp vc-rcs-register-switches) |
244 (list vc-rcs-register-switches) | 244 (list vc-rcs-register-switches) |
245 vc-rcs-register-switches)))) | 245 vc-rcs-register-switches)))) |
246 | 246 |
247 (and (not (file-exists-p subdir)) | 247 (and (not (file-exists-p subdir)) |
248 (not (directory-files (file-name-directory file) | 248 (not (directory-files (file-name-directory file) |
249 nil ".*,v$" t)) | 249 nil ".*,v$" t)) |
250 (yes-or-no-p "Create RCS subdirectory? ") | 250 (yes-or-no-p "Create RCS subdirectory? ") |
251 (make-directory subdir)) | 251 (make-directory subdir)) |
303 (rename-file master (car backup-info) 'ok-if-already-exists) | 303 (rename-file master (car backup-info) 'ok-if-already-exists) |
304 (dolist (f (cdr backup-info)) (ignore-errors (delete-file f)))) | 304 (dolist (f (cdr backup-info)) (ignore-errors (delete-file f)))) |
305 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS") | 305 (and (string= (file-name-nondirectory (directory-file-name dir)) "RCS") |
306 ;; check whether RCS dir is empty, i.e. it does not | 306 ;; check whether RCS dir is empty, i.e. it does not |
307 ;; contain any files except "." and ".." | 307 ;; contain any files except "." and ".." |
308 (not (directory-files dir nil | 308 (not (directory-files dir nil |
309 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*")) | 309 "^\\([^.]\\|\\.[^.]\\|\\.\\.[^.]\\).*")) |
310 (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) | 310 (yes-or-no-p (format "Directory %s is empty; remove it? " dir)) |
311 (delete-directory dir)))) | 311 (delete-directory dir)))) |
312 | 312 |
313 (defun vc-rcs-checkin (file rev comment) | 313 (defun vc-rcs-checkin (file rev comment) |
315 (let ((switches (if (stringp vc-checkin-switches) | 315 (let ((switches (if (stringp vc-checkin-switches) |
316 (list vc-checkin-switches) | 316 (list vc-checkin-switches) |
317 vc-checkin-switches))) | 317 vc-checkin-switches))) |
318 (let ((old-version (vc-workfile-version file)) new-version | 318 (let ((old-version (vc-workfile-version file)) new-version |
319 (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) | 319 (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) |
320 ;; Force branch creation if an appropriate | 320 ;; Force branch creation if an appropriate |
321 ;; default branch has been set. | 321 ;; default branch has been set. |
322 (and (not rev) | 322 (and (not rev) |
323 default-branch | 323 default-branch |
324 (string-match (concat "^" (regexp-quote old-version) "\\.") | 324 (string-match (concat "^" (regexp-quote old-version) "\\.") |
325 default-branch) | 325 default-branch) |
349 ;; branch accordingly | 349 ;; branch accordingly |
350 (cond | 350 (cond |
351 ((and old-version new-version | 351 ((and old-version new-version |
352 (not (string= (vc-branch-part old-version) | 352 (not (string= (vc-branch-part old-version) |
353 (vc-branch-part new-version)))) | 353 (vc-branch-part new-version)))) |
354 (vc-rcs-set-default-branch file | 354 (vc-rcs-set-default-branch file |
355 (if (vc-trunk-p new-version) nil | 355 (if (vc-trunk-p new-version) nil |
356 (vc-branch-part new-version))) | 356 (vc-branch-part new-version))) |
357 ;; If this is an old RCS release, we might have | 357 ;; If this is an old RCS release, we might have |
358 ;; to remove a remaining lock. | 358 ;; to remove a remaining lock. |
359 (if (not (vc-rcs-release-p "5.6.2")) | 359 (if (not (vc-rcs-release-p "5.6.2")) |
405 (if (stringp rev) | 405 (if (stringp rev) |
406 ;; a literal revision was specified | 406 ;; a literal revision was specified |
407 (concat "-r" rev) | 407 (concat "-r" rev) |
408 (let ((workrev (vc-workfile-version file))) | 408 (let ((workrev (vc-workfile-version file))) |
409 (if workrev | 409 (if workrev |
410 (concat "-r" | 410 (concat "-r" |
411 (if (not rev) | 411 (if (not rev) |
412 ;; no revision specified: | 412 ;; no revision specified: |
413 ;; use current workfile version | 413 ;; use current workfile version |
414 workrev | 414 workrev |
415 ;; REV is t ... | 415 ;; REV is t ... |
426 (setq new-version | 426 (setq new-version |
427 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1))) | 427 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1))) |
428 (vc-file-setprop file 'vc-workfile-version new-version) | 428 (vc-file-setprop file 'vc-workfile-version new-version) |
429 ;; if necessary, adjust the default branch | 429 ;; if necessary, adjust the default branch |
430 (and rev (not (string= rev "")) | 430 (and rev (not (string= rev "")) |
431 (vc-rcs-set-default-branch | 431 (vc-rcs-set-default-branch |
432 file | 432 file |
433 (if (vc-rcs-latest-on-branch-p file new-version) | 433 (if (vc-rcs-latest-on-branch-p file new-version) |
434 (if (vc-trunk-p new-version) nil | 434 (if (vc-trunk-p new-version) nil |
435 (vc-branch-part new-version)) | 435 (vc-branch-part new-version)) |
436 new-version))))) | 436 new-version))))) |
437 (message "Checking out %s...done" file))))) | 437 (message "Checking out %s...done" file))))) |
438 | 438 |
439 (defun vc-rcs-revert (file &optional contents-done) | 439 (defun vc-rcs-revert (file &optional contents-done) |
440 "Revert FILE to the version it was based on." | 440 "Revert FILE to the version it was based on." |
441 (vc-do-command nil 0 "co" (vc-name file) "-f" | 441 (vc-do-command nil 0 "co" (vc-name file) "-f" |
442 (concat (if (eq (vc-state file) 'edited) "-u" "-r") | 442 (concat (if (eq (vc-state file) 'edited) "-u" "-r") |
443 (vc-workfile-version file)))) | 443 (vc-workfile-version file)))) |
444 | 444 |
445 (defun vc-rcs-cancel-version (file editable) | 445 (defun vc-rcs-cancel-version (file editable) |
446 "Undo the most recent checkin of FILE. | 446 "Undo the most recent checkin of FILE. |
447 EDITABLE non-nil means previous version should be locked." | 447 EDITABLE non-nil means previous version should be locked." |
481 | 481 |
482 (defun vc-rcs-steal-lock (file &optional rev) | 482 (defun vc-rcs-steal-lock (file &optional rev) |
483 "Steal the lock on the current workfile for FILE and revision REV. | 483 "Steal the lock on the current workfile for FILE and revision REV. |
484 Needs RCS 5.6.2 or later for -M." | 484 Needs RCS 5.6.2 or later for -M." |
485 (vc-do-command nil 0 "rcs" (vc-name file) "-M" (concat "-u" rev)) | 485 (vc-do-command nil 0 "rcs" (vc-name file) "-M" (concat "-u" rev)) |
486 ;; Do a real checkout after stealing the lock, so that we see | 486 ;; Do a real checkout after stealing the lock, so that we see |
487 ;; expanded headers. | 487 ;; expanded headers. |
488 (vc-do-command nil 0 "co" (vc-name file) "-f" (concat "-l" rev))) | 488 (vc-do-command nil 0 "co" (vc-name file) "-f" (concat "-l" rev))) |
489 | 489 |
490 | 490 |
491 | 491 |