aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorAndré Spiegel2000-10-03 11:33:59 +0000
committerAndré Spiegel2000-10-03 11:33:59 +0000
commita7e98271c7a22aeeca549758af22ef1659835c45 (patch)
tree3263760d96ad46c73748329d771152b5f7cd3f17 /lisp
parent045e1aa59e4e54967fe86f67dd927331edd6ed3c (diff)
downloademacs-a7e98271c7a22aeeca549758af22ef1659835c45.tar.gz
emacs-a7e98271c7a22aeeca549758af22ef1659835c45.zip
(vc-rcs-fetch-master-state): Parse and remember default branch
unconditionally. (vc-rcs-set-default-branch): New function. (vc-rcs-cancel-version, vc-rcs-checkin, vc-rcs-checkout): Use it. (vc-rcs-checkin): If an appropriate default branch has been set, force creation of that branch.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/vc-rcs.el88
1 files changed, 48 insertions, 40 deletions
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el
index 34dbb927c6a..3708ab23d6a 100644
--- a/lisp/vc-rcs.el
+++ b/lisp/vc-rcs.el
@@ -5,7 +5,7 @@
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.8 2000/10/01 11:17:42 spiegel Exp $ 8;; $Id: vc-rcs.el,v 1.9 2000/10/01 19:35:24 monnier Exp $
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
@@ -215,29 +215,30 @@ This function sets the properties `vc-workfile-version' and
215file." 215file."
216 (with-temp-buffer 216 (with-temp-buffer
217 (vc-insert-file (vc-name file) "^[0-9]") 217 (vc-insert-file (vc-name file) "^[0-9]")
218 (let ((workfile-is-latest nil)) 218 (let ((workfile-is-latest nil)
219 (default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1)))
220 (vc-file-setprop file 'vc-rcs-default-branch default-branch)
219 (unless workfile-version 221 (unless workfile-version
220 (let ((default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1))) 222 ;; Workfile version not known yet. Determine that first. It
221 ;; Workfile version not known yet. Determine that first. It 223 ;; is either the head of the trunk, the head of the default
222 ;; is either the head of the trunk, the head of the default 224 ;; branch, or the "default branch" itself, if that is a full
223 ;; branch, or the "default branch" itself, if that is a full 225 ;; revision number.
224 ;; revision number. 226 (cond
225 (cond 227 ;; no default branch
226 ;; no default branch 228 ((or (not default-branch) (string= "" default-branch))
227 ((or (not default-branch) (string= "" default-branch)) 229 (setq workfile-version
230 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1))
231 (setq workfile-is-latest t))
232 ;; default branch is actually a revision
233 ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$"
234 default-branch)
235 (setq workfile-version default-branch))
236 ;; else, search for the head of the default branch
237 (t (vc-insert-file (vc-name file) "^desc")
228 (setq workfile-version 238 (setq workfile-version
229 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) 239 (vc-rcs-find-most-recent-rev default-branch))
230 (setq workfile-is-latest t)) 240 (setq workfile-is-latest t)))
231 ;; default branch is actually a revision 241 (vc-file-setprop file 'vc-workfile-version workfile-version))
232 ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$"
233 default-branch)
234 (setq workfile-version default-branch))
235 ;; else, search for the head of the default branch
236 (t (vc-insert-file (vc-name file) "^desc")
237 (setq workfile-version
238 (vc-rcs-find-most-recent-rev default-branch))
239 (setq workfile-is-latest t)))
240 (vc-file-setprop file 'vc-workfile-version workfile-version)))
241 ;; Check strict locking 242 ;; Check strict locking
242 (goto-char (point-min)) 243 (goto-char (point-min))
243 (vc-file-setprop file 'vc-checkout-model 244 (vc-file-setprop file 'vc-checkout-model
@@ -528,8 +529,7 @@ WRITABLE non-nil means previous version should be locked."
528 (goto-char (point-min)) 529 (goto-char (point-min))
529 (if (search-forward "no side branches present for" nil t) 530 (if (search-forward "no side branches present for" nil t)
530 (progn (setq previous (vc-branch-part previous)) 531 (progn (setq previous (vc-branch-part previous))
531 (vc-do-command nil 0 "rcs" (vc-name file) 532 (vc-rcs-set-default-branch file previous)
532 (concat "-b" previous))
533 ;; vc-do-command popped up a window with 533 ;; vc-do-command popped up a window with
534 ;; the error message. Get rid of it, by 534 ;; the error message. Get rid of it, by
535 ;; restoring the old window configuration. 535 ;; restoring the old window configuration.
@@ -586,16 +586,21 @@ CVS releases are handled reasonably, too \(1.3 < 1.4* < 1.5\)."
586 (let ((switches (if (stringp vc-checkin-switches) 586 (let ((switches (if (stringp vc-checkin-switches)
587 (list vc-checkin-switches) 587 (list vc-checkin-switches)
588 vc-checkin-switches))) 588 vc-checkin-switches)))
589 (let ((old-version (vc-workfile-version file)) new-version) 589 (let ((old-version (vc-workfile-version file)) new-version
590 (default-branch (vc-file-getprop file 'vc-rcs-default-branch)))
591 ;; Force branch creation if an appropriate
592 ;; default branch has been set.
593 (and (not rev)
594 default-branch
595 (string-match (concat "^" (regexp-quote old-version) "\\.")
596 default-branch)
597 (setq rev default-branch)
598 (setq switches (cons "-f" switches)))
590 (apply 'vc-do-command nil 0 "ci" (vc-name file) 599 (apply 'vc-do-command nil 0 "ci" (vc-name file)
591 ;; if available, use the secure check-in option 600 ;; if available, use the secure check-in option
592 (and (vc-rcs-release-p "5.6.4") "-j") 601 (and (vc-rcs-release-p "5.6.4") "-j")
593 (concat (if vc-keep-workfiles "-u" "-r") rev) 602 (concat (if vc-keep-workfiles "-u" "-r") rev)
594 (concat "-m" comment) 603 (concat "-m" comment)
595 ;; allow creation of branches with no changes;
596 ;; this is used by vc-rcs-receive-file if the
597 ;; base version cannot be found
598 (if (and (stringp rev) (string-match ".1.1$" rev)) "-f")
599 switches) 604 switches)
600 (vc-file-setprop file 'vc-workfile-version nil) 605 (vc-file-setprop file 'vc-workfile-version nil)
601 606
@@ -615,9 +620,9 @@ CVS releases are handled reasonably, too \(1.3 < 1.4* < 1.5\)."
615 ((and old-version new-version 620 ((and old-version new-version
616 (not (string= (vc-rcs-branch-part old-version) 621 (not (string= (vc-rcs-branch-part old-version)
617 (vc-rcs-branch-part new-version)))) 622 (vc-rcs-branch-part new-version))))
618 (vc-do-command nil 0 "rcs" (vc-name file) 623 (vc-rcs-set-default-branch file
619 (if (vc-rcs-trunk-p new-version) "-b" 624 (if (vc-rcs-trunk-p new-version) nil
620 (concat "-b" (vc-rcs-branch-part new-version)))) 625 (vc-rcs-branch-part new-version)))
621 ;; If this is an old RCS release, we might have 626 ;; If this is an old RCS release, we might have
622 ;; to remove a remaining lock. 627 ;; to remove a remaining lock.
623 (if (not (vc-rcs-release-p "5.6.2")) 628 (if (not (vc-rcs-release-p "5.6.2"))
@@ -767,6 +772,10 @@ whether to remove it."
767 (vc-file-setprop file 'vc-checkout-model 'implicit) 772 (vc-file-setprop file 'vc-checkout-model 'implicit)
768 (set-file-modes file (logior (file-modes file) 128))) 773 (set-file-modes file (logior (file-modes file) 128)))
769 774
775(defun vc-rcs-set-default-branch (file branch)
776 (vc-do-command nil 0 "rcs" (vc-name file) (concat "-b" branch))
777 (vc-file-setprop file 'vc-rcs-default-branch branch))
778
770(defun vc-rcs-checkout (file &optional writable rev workfile) 779(defun vc-rcs-checkout (file &optional writable rev workfile)
771 "Retrieve a copy of a saved version of FILE into a workfile." 780 "Retrieve a copy of a saved version of FILE into a workfile."
772 (let ((filename (or workfile file)) 781 (let ((filename (or workfile file))
@@ -814,7 +823,7 @@ whether to remove it."
814 ;; if we should go to the head of the trunk, 823 ;; if we should go to the head of the trunk,
815 ;; clear the default branch first 824 ;; clear the default branch first
816 (and rev (string= rev "") 825 (and rev (string= rev "")
817 (vc-do-command nil 0 "rcs" (vc-name file) "-b")) 826 (vc-rcs-set-default-branch file nil))
818 ;; now do the checkout 827 ;; now do the checkout
819 (apply 'vc-do-command 828 (apply 'vc-do-command
820 nil 0 "co" (vc-name file) 829 nil 0 "co" (vc-name file)
@@ -836,13 +845,12 @@ whether to remove it."
836 (vc-file-setprop file 'vc-workfile-version new-version) 845 (vc-file-setprop file 'vc-workfile-version new-version)
837 ;; if necessary, adjust the default branch 846 ;; if necessary, adjust the default branch
838 (and rev (not (string= rev "")) 847 (and rev (not (string= rev ""))
839 (vc-do-command 848 (vc-rcs-set-default-branch
840 nil 0 "rcs" (vc-name file) 849 file
841 (concat "-b" 850 (if (vc-rcs-latest-on-branch-p file new-version)
842 (if (vc-rcs-latest-on-branch-p file new-version) 851 (if (vc-rcs-trunk-p new-version) nil
843 (if (vc-rcs-trunk-p new-version) nil 852 (vc-rcs-branch-part new-version))
844 (vc-rcs-branch-part new-version)) 853 new-version))))))
845 new-version)))))))
846 (message "Checking out %s...done" filename))))) 854 (message "Checking out %s...done" filename)))))
847 855
848(provide 'vc-rcs) 856(provide 'vc-rcs)