Commit 099bd78a authored by Stefan Monnier's avatar Stefan Monnier

2000-09-05 Stefan Monnier <monnier@cs.yale.edu>

	* vc.el: (toplevel): Don't require `dired' at run-time.
	(vc-dired-resynch-file): Remove autoload cookie.

2000-09-05  Andre Spiegel  <spiegel@gnu.org>

	* vc.el: Made several backend functions optional.
	(vc-default-responsible-p): New function.
	(vc-merge): Use RET for first version to trigger merge-news, not
	prefix arg.
	(vc-annotate): Handle backends that do not support annotation.
	(vc-default-merge-news): Removed.  The existence of a merge-news
	implementation is now checked on caller sites.

	* vc-hooks.el (vc-default-mode-line-string): Removed CVS special
	case.

	* vc-cvs.el (vc-cvs-mode-line-string): New function, handles the
	special case that has been removed from the default in vc-hooks.el.

2000-09-05  Stefan Monnier  <monnier@cs.yale.edu>

	* vc.el (vc-log-edit): Properly handle the case where FILE is nil.

2000-09-05  Andre Spiegel  <spiegel@gnu.org>

	* vc-hooks.el: Require vc during compilation.
	(vc-file-setprop): Use `vc-touched-properties' if bound by the new
	macro `with-vc-properties' in vc.el.
	(vc-file-getprop): Doc fix.
	(vc-after-save): Call `vc-dired-resynch-file' only if vc is loaded.

	* vc.el: Require dired-aux during compilation.
	(vc-name-assoc-file): Moved to vc-sccs.el.
	(with-vc-properties): New macro.
	(vc-checkin, vc-checkout, vc-revert, vc-cancel-version,
	vc-finish-steal): Use it.
	(vc-cancel-version): Moved RCS-specific code to vc-rcs.el.  The call
	to the backend-specific function is now supposed to do the checkout,
	too.
	(vc-log-edit): Handle FILE being nil and added a FIXME for log-edit.

	* vc-cvs.el (vc-cvs-checkin, vc-cvs-checkout): Don't bother to
	set file properties; that gets done in the generic code now.

	* vc-rcs.el (vc-rcs-uncheck): Renamed to `vc-rcs-cancel-version'.
	Changed parameter list, added code from vc.el that does the
	checkout, possibly with a double-take.

	* vc-sccs.el (vc-sccs-name-assoc-file): Moved here from vc.el.
	(vc-sccs-add-triple, vc-sccs-rename-file, vc-sccs-lookup-triple): Use
	the above under the new name.
	(vc-sccs-uncheck): Renamed to `vc-sccs-cancel-version'.  Changed
	parameter list, added checkout command.
	(vc-sccs-checkin, vc-sccs-checkout): Don't bother to set file
	properties; that gets done in the generic code now.

2000-09-05  Stefan Monnier  <monnier@cs.yale.edu>

	* vc.el: Docstring fixes (courtesy of checkdoc).

2000-09-05  Stefan Monnier  <monnier@cs.yale.edu>

	* vc.el (vc-checkout-writable-buffer-hook)
	(vc-checkout-writable-buffer): Remove.
	(vc-start-entry): Always call vc-log-edit, never vc-log-mode.
	(vc-log-mode): Make it into a clean derived major mode.
	(vc-log-edit): Mark buffer unmodified (as vc-log-mode did) and use
	vc-log-mode if log-edit is not available.
	(vc-dired-mode-map): Don't set-keymap-parent yet.
	(vc-dired-mode): Do set-keymap-parent here.
	(vc-dired-buffers-for-dir): Nop if dired is not loaded.
parent 0772f3a3
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el: (toplevel): Don't require `dired' at run-time.
(vc-dired-resynch-file): Remove autoload cookie.
2000-09-05 Andre Spiegel <spiegel@gnu.org>
* vc.el: Made several backend functions optional.
(vc-default-responsible-p): New function.
(vc-merge): Use RET for first version to trigger merge-news, not
prefix arg.
(vc-annotate): Handle backends that do not support annotation.
(vc-default-merge-news): Removed. The existence of a merge-news
implementation is now checked on caller sites.
* vc-hooks.el (vc-default-mode-line-string): Removed CVS special
case.
* vc-cvs.el (vc-cvs-mode-line-string): New function, handles the
special case that has been removed from the default in vc-hooks.el.
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el (vc-log-edit): Properly handle the case where FILE is nil.
2000-09-05 Andre Spiegel <spiegel@gnu.org>
* vc-hooks.el: Require vc during compilation.
(vc-file-setprop): Use `vc-touched-properties' if bound by the new
macro `with-vc-properties' in vc.el.
(vc-file-getprop): Doc fix.
(vc-after-save): Call `vc-dired-resynch-file' only if vc is loaded.
* vc.el: Require dired-aux during compilation.
(vc-name-assoc-file): Moved to vc-sccs.el.
(with-vc-properties): New macro.
(vc-checkin, vc-checkout, vc-revert, vc-cancel-version,
vc-finish-steal): Use it.
(vc-cancel-version): Moved RCS-specific code to vc-rcs.el. The call
to the backend-specific function is now supposed to do the checkout,
too.
(vc-log-edit): Handle FILE being nil and added a FIXME for log-edit.
* vc-cvs.el (vc-cvs-checkin, vc-cvs-checkout): Don't bother to
set file properties; that gets done in the generic code now.
* vc-rcs.el (vc-rcs-uncheck): Renamed to `vc-rcs-cancel-version'.
Changed parameter list, added code from vc.el that does the
checkout, possibly with a double-take.
* vc-sccs.el (vc-sccs-name-assoc-file): Moved here from vc.el.
(vc-sccs-add-triple, vc-sccs-rename-file, vc-sccs-lookup-triple): Use
the above under the new name.
(vc-sccs-uncheck): Renamed to `vc-sccs-cancel-version'. Changed
parameter list, added checkout command.
(vc-sccs-checkin, vc-sccs-checkout): Don't bother to set file
properties; that gets done in the generic code now.
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el: Docstring fixes (courtesy of checkdoc).
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el (vc-checkout-writable-buffer-hook)
(vc-checkout-writable-buffer): Remove.
(vc-start-entry): Always call vc-log-edit, never vc-log-mode.
(vc-log-mode): Make it into a clean derived major mode.
(vc-log-edit): Mark buffer unmodified (as vc-log-mode did) and use
vc-log-mode if log-edit is not available.
(vc-dired-mode-map): Don't set-keymap-parent yet.
(vc-dired-mode): Do set-keymap-parent here.
(vc-dired-buffers-for-dir): Nop if dired is not loaded.
2000-09-05 Gerd Moellmann <gerd@gnu.org>
* faces.el (set-face-attribute, face-spec-reset-face)
......@@ -46,14 +120,12 @@
latest version instead of `merge-news'.
(vc-next-action-dired): Don't mess with default-directory here; it
breaks other parts of dired. It is the job of the
backend-specific functions to adjust it temporarily if they need
it.
backend-specific functions to adjust it temporarily if they need it.
(vc-next-action): Remove a special CVS case.
(vc-clear-headers): New optional arg FILE.
(vc-checkin, vc-checkout): Set properties vc-state and
vc-checkout-time properly.
(vc-finish-steal): Call steal-lock, not steal, which doesn't
exist.
(vc-finish-steal): Call steal-lock, not steal, which doesn't exist.
(vc-print-log): Use new backend function `show-log-entry'.
(vc-cancel-version): Do the checks in a different order. Added a
FIXME concerning RCS-only code.
......
......@@ -5,7 +5,7 @@
;; Author: FSF (see vc.el for full credits)
;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;; $Id: vc-cvs.el,v 1.58 2000/08/12 18:47:41 spiegel Exp $
;; $Id: vc-cvs.el,v 1.1 2000/09/04 19:48:04 gerd Exp $
;; This file is part of GNU Emacs.
......@@ -204,6 +204,26 @@ essential information."
'up-to-date
'edited)))
(defun vc-cvs-mode-line-string (file)
"Return string for placement into the modeline for FILE.
Compared to the default implementation, this function handles the
special case of a CVS file that is added but not yet comitted."
(let ((state (vc-state file))
(rev (vc-workfile-version file)))
(cond ((string= rev "0")
;; A file that is added but not yet comitted.
"CVS @@")
((or (eq state 'up-to-date)
(eq state 'needs-patch))
(concat "CVS-" rev))
((stringp state)
(concat "CVS:" state ":" rev))
(t
;; Not just for the 'edited state, but also a fallback
;; for all other states. Think about different symbols
;; for 'needs-patch and 'needs-merge.
(concat "CVS:" rev)))))
(defun vc-cvs-dir-state (dir)
"Find the CVS state of all files in DIR."
(if (vc-cvs-stay-local-p dir)
......@@ -513,8 +533,6 @@ its branch."
;; tell it from the permissions of the file (see
;; vc-cvs-checkout-model).
(vc-file-setprop file 'vc-checkout-model nil)
(vc-file-setprop file 'vc-state 'up-to-date)
(vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file)))
;; if this was an explicit check-in, remove the sticky tag
(if rev (vc-do-command t 0 "cvs" file "update" "-A"))))
......@@ -612,10 +630,7 @@ REV is the revision to check out into WORKFILE."
(if (or (not rev) (string= rev ""))
"-A"
(concat "-r" rev))
switches))
(when writable (vc-file-setprop file 'vc-state 'edited))
(vc-file-setprop file
'vc-checkout-time (nth 5 (file-attributes file)))))
switches))))
(vc-mode-line file)
(message "Checking out %s...done" filename)))))
......
......@@ -5,7 +5,7 @@
;; Author: FSF (see vc.el for full credits)
;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;; $Id: vc-hooks.el,v 1.53 2000/08/13 11:36:46 spiegel Exp $
;; $Id: vc-hooks.el,v 1.116 2000/09/04 19:47:25 gerd Exp $
;; This file is part of GNU Emacs.
......@@ -33,6 +33,9 @@
;;; Code:
(eval-when-compile
(require 'vc))
;; Customization Variables (the rest is in vc.el)
(defvar vc-ignore-vc-files nil "Obsolete -- use `vc-handled-backends'.")
......@@ -47,7 +50,7 @@ Removing an entry from the list prevents VC from being activated
when visiting a file managed by that backend.
An empty list disables VC altogether."
:type '(repeat symbol)
:version "20.5"
:version "21.1"
:group 'vc)
(defcustom vc-path
......@@ -117,24 +120,30 @@ See also variable `vc-consult-headers'."
(make-variable-buffer-local 'vc-mode)
(put 'vc-mode 'permanent-local t)
(defmacro vc-error-occurred (&rest body)
(list 'condition-case nil (cons 'progn (append body '(nil))) '(error t)))
;; We need a notion of per-file properties because the version
;; control state of a file is expensive to derive --- we compute
;; them when the file is initially found, keep them up to date
;; during any subsequent VC operations, and forget them when
;; the buffer is killed.
(defmacro vc-error-occurred (&rest body)
(list 'condition-case nil (cons 'progn (append body '(nil))) '(error t)))
(defvar vc-file-prop-obarray (make-vector 16 0)
"Obarray for per-file properties.")
(defvar vc-touched-properties nil)
(defun vc-file-setprop (file property value)
"Set per-file VC PROPERTY for FILE to VALUE."
(if (and vc-touched-properties
(not (memq property vc-touched-properties)))
(setq vc-touched-properties (append (list property)
vc-touched-properties)))
(put (intern file vc-file-prop-obarray) property value))
(defun vc-file-getprop (file property)
"get per-file VC PROPERTY for FILE."
"Get per-file VC PROPERTY for FILE."
(get (intern file vc-file-prop-obarray) property))
(defun vc-file-clearprops (file)
......@@ -462,7 +471,10 @@ to do that, use this command a second time with no argument."
(eq (vc-checkout-model file) 'implicit)
(vc-file-setprop file 'vc-state 'edited)
(vc-mode-line file)
(vc-dired-resynch-file file))))
(if (featurep 'vc)
;; If VC is not loaded, then there can't be
;; any VC Dired buffer to synchronize.
(vc-dired-resynch-file file)))))
(defun vc-mode-line (file)
"Set `vc-mode' to display type of version control for FILE.
......@@ -470,10 +482,9 @@ The value is set in the current buffer, which should be the buffer
visiting FILE."
(interactive (list buffer-file-name nil))
(unless (not (vc-backend file))
(setq vc-mode (concat " "
(if vc-display-status
(vc-call mode-line-string file)
(symbol-name (vc-backend file)))))
(setq vc-mode (concat " " (if vc-display-status
(vc-call mode-line-string file)
(symbol-name (vc-backend file)))))
;; If the file is locked by some other user, make
;; the buffer read-only. Like this, even root
;; cannot modify a file that someone else has locked.
......@@ -499,16 +510,12 @@ Format:
\"BACKEND-REV\" if the file is up-to-date
\"BACKEND:REV\" if the file is edited (or locked by the calling user)
\"BACKEND:LOCKER:REV\" if the file is locked by somebody else
\"BACKEND @@\" for a CVS file that is added, but not yet committed
This function assumes that the file is registered."
(setq backend (symbol-name backend))
(let ((state (vc-state file))
(rev (vc-workfile-version file)))
(cond ((string= "0" rev)
;; CVS special case; should go into a CVS-specific implementation
(concat backend " @@"))
((or (eq state 'up-to-date)
(cond ((or (eq state 'up-to-date)
(eq state 'needs-patch))
(concat backend "-" rev))
((stringp state)
......
......@@ -5,7 +5,7 @@
;; Author: FSF (see vc.el for full credits)
;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;; $Id: vc-rcs.el,v 1.36 2000/08/12 18:51:30 spiegel Exp $
;; $Id: vc-rcs.el,v 1.1 2000/09/04 19:47:43 gerd Exp $
;; This file is part of GNU Emacs.
......@@ -476,9 +476,35 @@ Needs RCS 5.6.2 or later for -M."
(vc-do-command nil 0 "rcs" (vc-name file) "-M"
(concat "-u" rev) (concat "-l" rev)))
(defun vc-rcs-uncheck (file target)
"Undo the checkin of FILE's revision TARGET."
(vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target)))
(defun vc-rcs-cancel-version (file writable)
"Undo the most recent checkin of FILE.
WRITABLE non-nil means previous version should be locked."
(let* ((target (vc-workfile-version file))
(previous (if (vc-trunk-p target) "" (vc-branch-part target)))
(config (current-window-configuration))
(done nil))
(vc-do-command nil 0 "rcs" (vc-name file) (concat "-o" target))
;; Check out the most recent remaining version. If it fails, because
;; the whole branch got deleted, do a double-take and check out the
;; version where the branch started.
(while (not done)
(condition-case err
(progn
(vc-do-command nil 0 "co" (vc-name file) "-f"
(concat (if writable "-l" "-u") previous))
(setq done t))
(error (set-buffer "*vc*")
(goto-char (point-min))
(if (search-forward "no side branches present for" nil t)
(progn (setq previous (vc-branch-part previous))
(vc-do-command nil 0 "rcs" (vc-name file)
(concat "-b" previous))
;; vc-do-command popped up a window with
;; the error message. Get rid of it, by
;; restoring the old window configuration.
(set-window-configuration config))
;; No, it was some other error: re-signal it.
(signal (car err) (cdr err))))))))
(defun vc-rcs-revert (file)
"Revert FILE to the version it was based on."
......@@ -526,9 +552,6 @@ CVS releases are handled reasonably, too \(1.3 < 1.4* < 1.5\)."
(defun vc-rcs-checkin (file rev comment)
"RCS-specific version of `vc-backend-checkin'."
;; Adaptation for RCS branch support: if this is an explicit checkin,
;; or if the checkin creates a new branch, set the master file branch
;; accordingly.
(let ((switches (if (stringp vc-checkin-switches)
(list vc-checkin-switches)
vc-checkin-switches)))
......
......@@ -5,7 +5,7 @@
;; Author: FSF (see vc.el for full credits)
;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;; $Id: vc-sccs.el,v 1.35 2000/08/13 11:52:19 spiegel Exp $
;; $Id: vc-sccs.el,v 1.1 2000/09/04 19:48:23 gerd Exp $
;; This file is part of GNU Emacs.
......@@ -57,6 +57,8 @@ For a description of possible values, see `vc-check-master-templates'."
:version "20.5"
:group 'vc)
(defconst vc-sccs-name-assoc-file "VC-names")
;;;###autoload
(progn (defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)))
......@@ -172,7 +174,7 @@ The result is a list of the form ((VERSION . USER) (VERSION . USER) ...)."
(defun vc-sccs-add-triple (name file rev)
(with-current-buffer
(find-file-noselect
(expand-file-name vc-name-assoc-file
(expand-file-name vc-sccs-name-assoc-file
(file-name-directory (vc-name file))))
(goto-char (point-max))
(insert name "\t:\t" file "\t" rev "\n")
......@@ -185,7 +187,7 @@ The result is a list of the form ((VERSION . USER) (VERSION . USER) ...)."
;; Update the snapshot file.
(with-current-buffer
(find-file-noselect
(expand-file-name vc-name-assoc-file
(expand-file-name vc-sccs-name-assoc-file
(file-name-directory (vc-name old))))
(goto-char (point-min))
;; (replace-regexp (concat ":" (regexp-quote old) "$") (concat ":" new))
......@@ -203,7 +205,7 @@ If NAME is nil or a version number string it's just passed through."
name
(with-temp-buffer
(vc-insert-file
(expand-file-name vc-name-assoc-file
(expand-file-name vc-sccs-name-assoc-file
(file-name-directory (vc-name file))))
(vc-parse-buffer (concat name "\t:\t" file "\t\\(.+\\)") 1))))
......@@ -221,9 +223,15 @@ If NAME is nil or a version number string it's just passed through."
(vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev)))
(vc-do-command nil 0 "get" (vc-name file) "-g" (if rev (concat "-r" rev))))
(defun vc-sccs-uncheck (file target)
"Undo the checkin of FILE's revision TARGET."
(vc-do-command nil 0 "rmdel" (vc-name file) (concat "-r" target)))
(defun vc-sccs-cancel-version (file writable)
"Undo the most recent checkin of FILE.
WRITABLE non-nil means previous version should be locked."
(vc-do-command nil 0 "rmdel"
(vc-name file)
(concat "-r" (vc-workfile-version file)))
(vc-do-command nil 0 "get"
(vc-name file)
(if writable "-e")))
(defun vc-sccs-revert (file)
"Revert FILE to the version it was based on."
......@@ -243,8 +251,6 @@ If NAME is nil or a version number string it's just passed through."
(if rev (concat "-r" rev))
(concat "-y" comment)
switches)
(vc-file-setprop file 'vc-state 'up-to-date)
(vc-file-setprop file 'vc-workfile-version nil)
(if vc-keep-workfiles
(vc-do-command nil 0 "get" (vc-name file)))))
......@@ -371,14 +377,8 @@ REV is the revision to check out into WORKFILE."
(apply 'vc-do-command nil 0 "get" (vc-name file)
(if writable "-e")
(and rev (concat "-r" (vc-sccs-lookup-triple file rev)))
switches)
(vc-file-setprop file 'vc-workfile-version nil))
(unless workfile
(if writable
(vc-file-setprop file 'vc-state 'edited))
(vc-file-setprop file
'vc-checkout-time (nth 5 (file-attributes file))))
(message "Checking out %s...done" filename))))))
switches)))))
(message "Checking out %s...done" filename)))
(defun vc-sccs-update-changelog (files)
(error "Sorry, generating ChangeLog entries is not implemented for SCCS."))
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment