User: scop
Date: 05/12/26 11:50:28
Modified: packages/unsupported/scop/vc ChangeLog vc-mcvs.el vc-svn.el
vc.el
Log:
Sync vc with upstream.
Revision Changes Path
1.52 +1 -1 XEmacs/packages/unsupported/scop/STATUS
Index: STATUS
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/STATUS,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -p -r1.51 -r1.52
--- STATUS 2005/12/05 10:37:53 1.51
+++ STATUS 2005/12/26 10:50:23 1.52
@@ -17,5 +17,5 @@ generic-modes: generic.el and generic-x.
- Compiles, seems to work, auto-mode-alist and autoloads may need spanking.
vc: vc*.el and a few other related files from GNU Emacs
-- Up to date with GNU Emacs CVS HEAD as of 2005-12-05.
+- Up to date with GNU Emacs CVS HEAD as of 2005-12-26.
- Compiles, something even works.
1.39 +4 -0 XEmacs/packages/unsupported/scop/vc/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/ChangeLog,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -p -r1.38 -r1.39
--- ChangeLog 2005/12/05 11:26:28 1.38
+++ ChangeLog 2005/12/26 10:50:26 1.39
@@ -1,3 +1,7 @@
+2005-12-26 Ville Skyttä <scop(a)xemacs.org>
+
+ * vc.el, vc-mcvs.el, vc-svn.el: Sync with upstream.
+
2005-12-05 Ville Skyttä <scop(a)xemacs.org>
* log-edit.el: Sync with upstream.
1.10 +1 -1 XEmacs/packages/unsupported/scop/vc/vc-mcvs.el
Index: vc-mcvs.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/vc-mcvs.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- vc-mcvs.el 2005/10/08 13:35:00 1.9
+++ vc-mcvs.el 2005/12/26 10:50:26 1.10
@@ -354,7 +354,7 @@ the Meta-CVS command (in that order)."
(defun vc-mcvs-revert (file &optional contents-done)
"Revert FILE to the version it was based on."
- (vc-default-revert file contents-done)
+ (vc-default-revert 'MCVS file contents-done)
(unless (eq (vc-checkout-model file) 'implicit)
(if vc-mcvs-use-edit
(vc-mcvs-command nil 0 file "unedit")
1.13 +13 -9 XEmacs/packages/unsupported/scop/vc/vc-svn.el
Index: vc-svn.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/vc-svn.el,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -p -r1.12 -r1.13
--- vc-svn.el 2005/11/14 22:32:27 1.12
+++ vc-svn.el 2005/12/26 10:50:26 1.13
@@ -115,15 +115,19 @@ This is only meaningful if you don't use
(file-name-directory file)))
(with-temp-buffer
(cd (file-name-directory file))
- (condition-case nil
- (vc-svn-command t 0 file "status" "-v")
- ;; Some problem happened. E.g. We can't find an `svn' executable.
- ;; We used to only catch `file-error' but when the process is run on
- ;; a remote host via Tramp, the error is only reported via the
- ;; exit status which is turned into an `error' by vc-do-command.
- (error nil))
- (vc-svn-parse-status t)
- (eq 'SVN (vc-file-getprop file 'vc-backend)))))
+ (let ((status
+ (condition-case nil
+ ;; Ignore all errors.
+ (vc-svn-command t t file "status" "-v")
+ ;; Some problem happened. E.g. We can't find an `svn'
+ ;; executable. We used to only catch `file-error' but when
+ ;; the process is run on a remote host via Tramp, the error
+ ;; is only reported via the exit status which is turned into
+ ;; an `error' by vc-do-command.
+ (error nil))))
+ (when (eq 0 status)
+ (vc-svn-parse-status t)
+ (eq 'SVN (vc-file-getprop file 'vc-backend)))))))
(defun vc-svn-state (file &optional localp)
"SVN-specific version of `vc-state'."
1.21 +166 -182 XEmacs/packages/unsupported/scop/vc/vc.el
Index: vc.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/unsupported/scop/vc/vc.el,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -p -r1.20 -r1.21
--- vc.el 2005/11/02 19:03:11 1.20
+++ vc.el 2005/12/26 10:50:26 1.21
@@ -473,12 +473,12 @@
:group 'tools)
(defcustom vc-suppress-confirm nil
- "*If non-nil, treat user as expert; suppress yes-no prompts on some things."
+ "If non-nil, treat user as expert; suppress yes-no prompts on some things."
:type 'boolean
:group 'vc)
(defcustom vc-delete-logbuf-window t
- "*If non-nil, delete the *VC-log* buffer and window after each logical action.
+ "If non-nil, delete the *VC-log* buffer and window after each logical action.
If nil, bury that buffer instead.
This is most useful if you have multiple windows on a frame and would like to
preserve the setting."
@@ -486,12 +486,12 @@ preserve the setting."
:group 'vc)
(defcustom vc-initial-comment nil
- "*If non-nil, prompt for initial comment when a file is registered."
+ "If non-nil, prompt for initial comment when a file is registered."
:type 'boolean
:group 'vc)
(defcustom vc-default-init-version "1.1"
- "*A string used as the default version number when a new file is registered.
+ "A string used as the default version number when a new file is registered.
This can be overridden by giving a prefix argument to \\[vc-register]. This
can also be overridden by a particular VC backend."
:type 'string
@@ -499,12 +499,12 @@ can also be overridden by a particular V
:version "20.3")
(defcustom vc-command-messages nil
- "*If non-nil, display run messages from back-end commands."
+ "If non-nil, display run messages from back-end commands."
:type 'boolean
:group 'vc)
(defcustom vc-checkin-switches nil
- "*A string or list of strings specifying extra switches for checkin.
+ "A string or list of strings specifying extra switches for checkin.
These are passed to the checkin program by \\[vc-checkin]."
:type '(choice (const :tag "None" nil)
(string :tag "Argument String")
@@ -514,7 +514,7 @@ These are passed to the checkin program
:group 'vc)
(defcustom vc-checkout-switches nil
- "*A string or list of strings specifying extra switches for checkout.
+ "A string or list of strings specifying extra switches for checkout.
These are passed to the checkout program by \\[vc-checkout]."
:type '(choice (const :tag "None" nil)
(string :tag "Argument String")
@@ -524,7 +524,7 @@ These are passed to the checkout program
:group 'vc)
(defcustom vc-register-switches nil
- "*A string or list of strings; extra switches for registering a file.
+ "A string or list of strings; extra switches for registering a file.
These are passed to the checkin program by \\[vc-register]."
:type '(choice (const :tag "None" nil)
(string :tag "Argument String")
@@ -534,30 +534,30 @@ These are passed to the checkin program
:group 'vc)
(defcustom vc-dired-listing-switches "-al"
- "*Switches passed to `ls' for vc-dired. MUST contain the `l' option."
+ "Switches passed to `ls' for vc-dired. MUST contain the `l' option."
:type 'string
:group 'vc
:version "21.1")
(defcustom vc-dired-recurse t
- "*If non-nil, show directory trees recursively in VC Dired."
+ "If non-nil, show directory trees recursively in VC Dired."
:type 'boolean
:group 'vc
:version "20.3")
(defcustom vc-dired-terse-display t
- "*If non-nil, show only locked files in VC Dired."
+ "If non-nil, show only locked files in VC Dired."
:type 'boolean
:group 'vc
:version "20.3")
(defcustom vc-directory-exclusion-list '("SCCS" "RCS" "CVS" "MCVS" ".svn" "{arch}")
- "*List of directory names to be ignored when walking directory trees."
+ "List of directory names to be ignored when walking directory trees."
:type '(repeat string)
:group 'vc)
(defcustom vc-diff-switches nil
- "*A string or list of strings specifying switches for diff under VC.
+ "A string or list of strings specifying switches for diff under VC.
When running diff under a given BACKEND, VC concatenates the values of
`diff-switches', `vc-diff-switches', and `vc-BACKEND-diff-switches' to
get the switches for that command. Thus, `vc-diff-switches' should
@@ -572,7 +572,7 @@ specific to any particular backend."
:version "21.1")
(defcustom vc-allow-async-revert nil
- "*Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
+ "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
Enabling this option means that you can confirm a revert operation even
if the local changes in the file have not been found and displayed yet."
:type '(choice (const :tag "No" nil)
@@ -582,7 +582,7 @@ if the local changes in the file have no
;;;###autoload
(defcustom vc-checkout-hook nil
- "*Normal hook (list of functions) run after checking out a file.
+ "Normal hook (list of functions) run after checking out a file.
See `run-hooks'."
:type 'hook
:group 'vc
@@ -599,7 +599,7 @@ See `run-hooks'."
;;;###autoload
(defcustom vc-checkin-hook nil
- "*Normal hook (list of functions) run after a checkin is done.
+ "Normal hook (list of functions) run after a checkin is done.
See also `log-edit-done-hook'."
:type 'hook
:options '(log-edit-comment-to-change-log)
@@ -607,13 +607,13 @@ See also `log-edit-done-hook'."
;;;###autoload
(defcustom vc-before-checkin-hook nil
- "*Normal hook (list of functions) run before a file is checked in.
+ "Normal hook (list of functions) run before a file is checked in.
See `run-hooks'."
:type 'hook
:group 'vc)
(defcustom vc-logentry-check-hook nil
- "*Normal hook run by `vc-backend-logentry-check'.
+ "Normal hook run by `vc-backend-logentry-check'.
Use this to impose your own rules on the entry in addition to any the
version control backend imposes itself."
:type 'hook
@@ -638,25 +638,25 @@ version control backend imposes itself."
(300. . "#00CCFF")
(320. . "#00CC99")
(340. . "#0099FF"))
- "*Association list of age versus color, for \\[vc-annotate].
+ "Association list of age versus color, for \\[vc-annotate].
Ages are given in units of fractional days. Default is eighteen steps
using a twenty day increment."
:type 'alist
:group 'vc)
(defcustom vc-annotate-very-old-color "#0046FF"
- "*Color for lines older than the current color range in \\[vc-annotate]]."
+ "Color for lines older than the current color range in \\[vc-annotate]]."
:type 'string
:group 'vc)
(defcustom vc-annotate-background "black"
- "*Background color for \\[vc-annotate].
+ "Background color for \\[vc-annotate].
Default color is used if nil."
:type 'string
:group 'vc)
(defcustom vc-annotate-menu-elements '(2 0.5 0.1 0.01)
- "*Menu elements for the mode-specific menu of VC-Annotate mode.
+ "Menu elements for the mode-specific menu of VC-Annotate mode.
List of factors, used to expand/compress the time scale. See `vc-annotate'."
:type '(repeat number)
:group 'vc)
@@ -664,24 +664,23 @@ List of factors, used to expand/compress
(defvar vc-annotate-mode-map
(let ((m (make-sparse-keymap)))
(define-key m [menu-bar] (make-sparse-keymap "VC-Annotate"))
+ (define-key m "A" 'vc-annotate-revision-previous-to-line)
+ (define-key m "D" 'vc-annotate-show-diff-revision-at-line)
+ (define-key m "J" 'vc-annotate-revision-at-line)
+ (define-key m "L" 'vc-annotate-show-log-revision-at-line)
+ (define-key m "N" 'vc-annotate-next-version)
+ (define-key m "P" 'vc-annotate-prev-version)
+ (define-key m "W" 'vc-annotate-workfile-version)
m)
"Local keymap used for VC-Annotate mode.")
-(define-key vc-annotate-mode-map "A" 'vc-annotate-revision-previous-to-line)
-(define-key vc-annotate-mode-map "D" 'vc-annotate-show-diff-revision-at-line)
-(define-key vc-annotate-mode-map "J" 'vc-annotate-revision-at-line)
-(define-key vc-annotate-mode-map "L" 'vc-annotate-show-log-revision-at-line)
-(define-key vc-annotate-mode-map "N" 'vc-annotate-next-version)
-(define-key vc-annotate-mode-map "P" 'vc-annotate-prev-version)
-(define-key vc-annotate-mode-map "W" 'vc-annotate-workfile-version)
-
(defvar vc-annotate-mode-menu nil
"Local keymap used for VC-Annotate mode's menu bar menu.")
;; Header-insertion hair
(defcustom vc-static-header-alist
- '(("\\.c$" .
+ '(("\\.c\\'" .
"\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n#endif /* lint */\n"))
"*Associate static header string templates with file types.
A \%s in the template is replaced with the first string associated with
@@ -717,9 +716,7 @@ and that its contents match what the mas
;; Variables the user doesn't need to know about.
(defvar vc-log-operation nil)
(defvar vc-log-after-operation-hook nil)
-(defvar vc-annotate-buffers nil
- "Alist of current \"Annotate\" buffers and their corresponding backends.
-The keys are \(BUFFER . BACKEND\). See also `vc-annotate-get-backend'.")
+
;; In a log entry buffer, this is a local variable
;; that points to the buffer for which it was made
;; (either a file, or a VC dired buffer).
@@ -766,7 +763,7 @@ in their implementation of vc-BACKEND-di
(defun vc-default-previous-version (backend file rev)
"Return the version number immediately preceding REV for FILE,
or nil if there is no previous version. This default
-implementation works for <major>.<minor>-style version numbers as
+implementation works for MAJOR.MINOR-style version numbers as
used by RCS and CVS."
(let ((branch (vc-branch-part rev))
(minor-num (string-to-number (vc-minor-part rev))))
@@ -785,7 +782,7 @@ used by RCS and CVS."
(defun vc-default-next-version (backend file rev)
"Return the version number immediately following REV for FILE,
or nil if there is no next version. This default implementation
-works for <major>.<minor>-style version numbers as used by RCS
+works for MAJOR.MINOR-style version numbers as used by RCS
and CVS."
(when (not (string= rev (vc-workfile-version file)))
(let ((branch (vc-branch-part rev))
@@ -934,8 +931,9 @@ Output from COMMAND goes to BUFFER, or *
current buffer if BUFFER is t. If the destination buffer is not
already current, set it up properly and erase it. The command is
considered successful if its exit status does not exceed OKSTATUS (if
-OKSTATUS is nil, that means to ignore errors, if it is 'async, that
-means not to wait for termination of the subprocess). FILE is the
+OKSTATUS is nil, that means to ignore error status, if it is `async', that
+means not to wait for termination of the subprocess; if it is t it means to
+ignore all execution errors). FILE is the
name of the working file (may also be nil, to execute commands that
don't expect a file name). If an optional list of FLAGS is present,
that is inserted into the command line before the filename."
@@ -981,7 +979,9 @@ that is inserted into the command line b
(message "Running %s in the background... done" ',command))))
;; XEmacs: we don't have process-file, use call-process instead.
(setq status (apply 'call-process command nil t nil squeezed))
- (when (or (not (integerp status)) (and okstatus (< okstatus status)))
+ (when (and (not (eq t okstatus))
+ (or (not (integerp status))
+ (and okstatus (< okstatus status))))
(pop-to-buffer (current-buffer))
(goto-char (point-min))
(shrink-window-if-larger-than-buffer)
@@ -1375,6 +1375,8 @@ merge in the changes into your working c
;; These functions help the vc-next-action entry point
+(defun vc-default-init-version (backend) vc-default-init-version)
+
;;;###autoload
(defun vc-register (&optional set-version comment)
"Register the current file into a version control system.
@@ -1406,10 +1408,8 @@ first backend that could register the fi
(if set-version
(read-string (format "Initial version level for %s: "
(buffer-name)))
- (let ((backend (vc-responsible-backend buffer-file-name)))
- (if (vc-find-backend-function backend 'init-version)
- (vc-call-backend backend 'init-version)
- vc-default-init-version)))
+ (vc-call-backend (vc-responsible-backend buffer-file-name)
+ 'init-version))
(or comment (not vc-initial-comment))
nil
"Enter initial comment."
@@ -1949,24 +1949,19 @@ the variable `vc-BACKEND-header'."
(widen)
(if (or (not (vc-check-headers))
(y-or-n-p "Version headers already exist. Insert another set? "))
- (progn
- (let* ((delims (cdr (assq major-mode vc-comment-alist)))
- (comment-start-vc (or (car delims) comment-start "#"))
- (comment-end-vc (or (car (cdr delims)) comment-end ""))
- (hdsym (vc-make-backend-sym (vc-backend buffer-file-name)
- 'header))
- (hdstrings (and (boundp hdsym) (symbol-value hdsym))))
- (mapcar (lambda (s)
- (insert comment-start-vc "\t" s "\t"
- comment-end-vc "\n"))
- hdstrings)
- (if vc-static-header-alist
- (mapcar (lambda (f)
- (if (string-match (car f) buffer-file-name)
- (insert (format (cdr f) (car hdstrings)))))
- vc-static-header-alist))
- )
- )))))
+ (let* ((delims (cdr (assq major-mode vc-comment-alist)))
+ (comment-start-vc (or (car delims) comment-start "#"))
+ (comment-end-vc (or (car (cdr delims)) comment-end ""))
+ (hdsym (vc-make-backend-sym (vc-backend buffer-file-name)
+ 'header))
+ (hdstrings (and (boundp hdsym) (symbol-value hdsym))))
+ (dolist (s hdstrings)
+ (insert comment-start-vc "\t" s "\t"
+ comment-end-vc "\n"))
+ (if vc-static-header-alist
+ (dolist (f vc-static-header-alist)
+ (if (string-match (car f) buffer-file-name)
+ (insert (format (cdr f) (car hdstrings)))))))))))
(defun vc-clear-headers (&optional file)
"Clear all version headers in the current buffer (or FILE).
@@ -2543,6 +2538,33 @@ return its name; otherwise return nil."
(if (file-exists-p backup-file)
backup-file)))))
+(defun vc-default-revert (backend file contents-done)
+ (unless contents-done
+ (let ((rev (vc-workfile-version file))
+ (file-buffer (or (get-file-buffer file) (current-buffer))))
+ (message "Checking out %s..." file)
+ (let ((failed t)
+ (backup-name (car (find-backup-file-name file))))
+ (when backup-name
+ (copy-file file backup-name 'ok-if-already-exists 'keep-date)
+ (unless (file-writable-p file)
+ (set-file-modes file (logior (file-modes file) 128))))
+ (unwind-protect
+ (let ((coding-system-for-read 'no-conversion)
+ (coding-system-for-write 'no-conversion))
+ (with-temp-file file
+ (let ((outbuf (current-buffer)))
+ ;; Change buffer to get local value of vc-checkout-switches.
+ (with-current-buffer file-buffer
+ (let ((default-directory (file-name-directory file)))
+ (vc-call find-version file rev outbuf)))))
+ (setq failed nil))
+ (when backup-name
+ (if failed
+ (rename-file backup-name file 'ok-if-already-exists)
+ (and (not vc-make-backup-files) (delete-file backup-name))))))
+ (message "Checking out %s...done" file))))
+
(defun vc-revert-file (file)
"Revert FILE back to the version it was based on."
(with-vc-properties
@@ -2884,8 +2906,7 @@ Uses `rcs2log' which only works for RCS
(concat odefault f))))
files)))
"done"
- (pop-to-buffer
- (set-buffer (get-buffer-create "*vc*")))
+ (pop-to-buffer (get-buffer-create "*vc*"))
(erase-buffer)
(insert-file-contents tempfile)
"failed"))
@@ -2900,9 +2921,9 @@ Uses `rcs2log' which only works for RCS
;; annotate-mode, which replaces it with the more sensible "span-to
;; days", along with autoscaling support.
(defvar vc-annotate-ratio nil "Global variable.")
-(defvar vc-annotate-backend nil "Global variable.")
;; internal buffer-local variables
+(defvar vc-annotate-backend nil)
(defvar vc-annotate-parent-file nil)
(defvar vc-annotate-parent-rev nil)
(defvar vc-annotate-parent-display-mode nil)
@@ -2911,12 +2932,6 @@ Uses `rcs2log' which only works for RCS
;; The fontification is done by vc-annotate-lines instead of font-lock.
'((vc-annotate-lines)))
-(defun vc-annotate-get-backend (buffer)
- "Return the backend matching \"Annotate\" buffer BUFFER.
-Return nil if no match made. Associations are made based on
-`vc-annotate-buffers'."
- (cdr (assoc buffer vc-annotate-buffers)))
-
(define-derived-mode vc-annotate-mode fundamental-mode "Annotate"
"Major mode for output buffers of the `vc-annotate' command.
@@ -2926,8 +2941,7 @@ menu items."
(set (make-local-variable 'truncate-lines) t)
(set (make-local-variable 'font-lock-defaults)
'(vc-annotate-font-lock-keywords t))
- (view-mode 1)
- (vc-annotate-add-menu))
+ (view-mode 1))
(defun vc-annotate-display-default (&optional ratio)
"Display the output of \\[vc-annotate] using the default color range.
@@ -2939,6 +2953,10 @@ if present. The current time is used as
(if ratio (vc-annotate-time-span vc-annotate-color-map ratio)))
(message "Redisplaying annotation...done"))
+(defun vc-annotate-car-last-cons (a-list)
+ "Return car of last cons in association list A-LIST."
+ (caar (last a-list)))
+
(defun vc-annotate-display-autoscale (&optional full)
"Highlight the output of \\[vc-annotate] using an autoscaled color map.
Autoscaling means that the map is scaled from the current time to the
@@ -2974,70 +2992,48 @@ cover the range from the oldest annotati
(format "Spanned to %.1f days old" (- current oldest))))))
;; Menu -- Using easymenu.el
-(defun vc-annotate-add-menu ()
- "Add the menu 'Annotate' to the menu bar in VC-Annotate mode."
- (let ((menu-elements vc-annotate-menu-elements)
- (menu-def
- '("VC-Annotate"
- ["Default" (unless (null vc-annotate-display-mode)
- (setq vc-annotate-display-mode nil)
- (vc-annotate-display-select))
- :style toggle :selected (null vc-annotate-display-mode)]))
- (oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map)))
- (while menu-elements
- (let* ((element (car menu-elements))
- (days (* element oldest-in-map)))
- (setq menu-elements (cdr menu-elements))
- (setq menu-def
- (append menu-def
- `([,(format "Span %.1f days" days)
- (unless (and (numberp vc-annotate-display-mode)
- (= vc-annotate-display-mode ,days))
- (vc-annotate-display-select nil ,days))
- :style toggle :selected
- (and (numberp vc-annotate-display-mode)
- (= vc-annotate-display-mode ,days)) ])))))
- (setq menu-def
- (append menu-def
- (list
- ["Span ..."
- (let ((days
- (float (string-to-number
- (read-string "Span how many days? ")))))
- (vc-annotate-display-select nil days)) t])
- (list "--")
- (list
- ["Span to Oldest"
- (unless (eq vc-annotate-display-mode 'scale)
- (vc-annotate-display-select nil 'scale))
- :style toggle :selected
- (eq vc-annotate-display-mode 'scale)])
- (list
- ["Span Oldest->Newest"
- (unless (eq vc-annotate-display-mode 'fullscale)
- (vc-annotate-display-select nil 'fullscale))
- :style toggle :selected
- (eq vc-annotate-display-mode 'fullscale)])
- (list "--")
- (list ["Annotate previous revision"
- (call-interactively 'vc-annotate-prev-version)])
- (list ["Annotate next revision"
- (call-interactively 'vc-annotate-next-version)])
- (list ["Annotate revision at line"
- (vc-annotate-revision-at-line)])
- (list ["Annotate revision previous to line"
- (vc-annotate-revision-previous-to-line)])
- (list ["Annotate latest revision"
- (vc-annotate-workfile-version)])
- (list ["Show log of revision at line"
- (vc-annotate-show-log-revision-at-line)])
- (list ["Show diff of revision at line"
- (vc-annotate-show-diff-revision-at-line)])))
-
- ;; Define the menu
- (if (or (featurep 'easymenu) (load "easymenu" t))
- (easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
- "VC Annotate Display Menu" menu-def))))
+(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
+ "VC Annotate Display Menu"
+ `("VC-Annotate"
+ ["Default" (unless (null vc-annotate-display-mode)
+ (setq vc-annotate-display-mode nil)
+ (vc-annotate-display-select))
+:style toggle :selected (null vc-annotate-display-mode)]
+ ,@(let ((oldest-in-map (vc-annotate-car-last-cons vc-annotate-color-map)))
+ (mapcar (lambda (element)
+ (let ((days (* element oldest-in-map)))
+ `([,(format "Span %.1f days" days)
+ (unless (and (numberp vc-annotate-display-mode)
+ (= vc-annotate-display-mode ,days))
+ (vc-annotate-display-select nil ,days))
+:style toggle :selected
+ (and (numberp vc-annotate-display-mode)
+ (= vc-annotate-display-mode ,days)) ])))
+ vc-annotate-menu-elements))
+ ["Span ..."
+ (let ((days
+ (float (string-to-number
+ (read-string "Span how many days? ")))))
+ (vc-annotate-display-select nil days)) t]
+ "--"
+ ["Span to Oldest"
+ (unless (eq vc-annotate-display-mode 'scale)
+ (vc-annotate-display-select nil 'scale))
+:style toggle :selected
+ (eq vc-annotate-display-mode 'scale)]
+ ["Span Oldest->Newest"
+ (unless (eq vc-annotate-display-mode 'fullscale)
+ (vc-annotate-display-select nil 'fullscale))
+:style toggle :selected
+ (eq vc-annotate-display-mode 'fullscale)]
+ "--"
+ ["Annotate previous revision" vc-annotate-prev-version]
+ ["Annotate next revision" vc-annotate-next-version]
+ ["Annotate revision at line" vc-annotate-revision-at-line]
+ ["Annotate revision previous to line" vc-annotate-revision-previous-to-line]
+ ["Annotate latest revision" vc-annotate-workfile-version]
+ ["Show log of revision at line" vc-annotate-show-log-revision-at-line]
+ ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line]))
(defun vc-annotate-display-select (&optional buffer mode)
"Highlight the output of \\[vc-annotate].
@@ -3070,7 +3066,7 @@ use; you may override this using the sec
;;;; the contents in BUFFER.
;;;###autoload
-(defun vc-annotate (prefix &optional revision display-mode)
+(defun vc-annotate (file rev &optional display-mode buf)
"Display the edit history of the current file using colors.
This command creates a buffer that shows, for each line of the current
@@ -3095,48 +3091,44 @@ Customization variables:
mode-specific menu. `vc-annotate-color-map' and
`vc-annotate-very-old-color' defines the mapping of time to
colors. `vc-annotate-background' specifies the background color."
- (interactive "P")
+ (interactive
+ (save-current-buffer
+ (vc-ensure-vc-buffer)
+ (list buffer-file-name
+ (let ((def (vc-workfile-version buffer-file-name)))
+ (if (null current-prefix-arg) def
+ (read-string
+ (format "Annotate from version (default %s): " def)
+ nil nil def)))
+ (if (null current-prefix-arg)
+ vc-annotate-display-mode
+ (float (string-to-number
+ (read-string "Annotate span days (default 20): "
+ nil nil "20")))))))
(vc-ensure-vc-buffer)
- (let* ((temp-buffer-name nil)
- (temp-buffer-show-function 'vc-annotate-display-select)
- (rev (or revision (vc-workfile-version buffer-file-name)))
- (bfn buffer-file-name)
- (vc-annotate-version
- (if prefix (read-string
- (format "Annotate from version (default %s): " rev)
- nil nil rev)
- rev)))
- (if display-mode
- (setq vc-annotate-display-mode display-mode)
- (if prefix
- (setq vc-annotate-display-mode
- (float (string-to-number
- (read-string "Annotate span days (default 20): "
- nil nil "20"))))))
- (setq temp-buffer-name (format "*Annotate %s (rev %s)*"
- (buffer-name) vc-annotate-version))
- (setq vc-annotate-backend (vc-backend buffer-file-name))
+ (setq vc-annotate-display-mode display-mode) ;Not sure why. --Stef
+ (let* ((temp-buffer-name (format "*Annotate %s (rev %s)*" (buffer-name) rev))
+ (temp-buffer-show-function 'vc-annotate-display-select))
(message "Annotating...")
+ ;; If BUF is specified it tells in which buffer we should put the
+ ;; annotations. This is used when switching annotations to another
+ ;; revision, so we should update the buffer's name.
+ (if buf (with-current-buffer buf
+ (rename-buffer temp-buffer-name t)
+ ;; In case it had to be uniquified.
+ (setq temp-buffer-name (buffer-name))))
(if (not (vc-find-backend-function vc-annotate-backend 'annotate-command))
(error "Sorry, annotating is not implemented for %s"
vc-annotate-backend))
(with-output-to-temp-buffer temp-buffer-name
- (vc-call-backend vc-annotate-backend 'annotate-command
- buffer-file-name
- (get-buffer temp-buffer-name)
- vc-annotate-version))
- (save-excursion
- (set-buffer temp-buffer-name)
- (set (make-local-variable 'vc-annotate-parent-file) bfn)
- (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version)
+ (vc-call annotate-command file (get-buffer temp-buffer-name) rev))
+ (with-current-buffer temp-buffer-name
+ (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
+ (set (make-local-variable 'vc-annotate-parent-file) file)
+ (set (make-local-variable 'vc-annotate-parent-rev) rev)
(set (make-local-variable 'vc-annotate-parent-display-mode)
- vc-annotate-display-mode))
+ display-mode))
- ;; Don't use the temp-buffer-name until the buffer is created
- ;; (only after `with-output-to-temp-buffer'.)
- (setq vc-annotate-buffers
- (append vc-annotate-buffers
- (list (cons (get-buffer temp-buffer-name) vc-annotate-backend))))
(message "Annotating... done")))
(defun vc-annotate-prev-version (prefix)
@@ -3261,21 +3253,13 @@ revision."
((stringp revspec) (setq newrev revspec))
(t (error "Invalid argument to vc-annotate-warp-version")))
(when newrev
- (save-window-excursion
- (find-file vc-annotate-parent-file)
- (vc-annotate nil newrev vc-annotate-parent-display-mode))
- (kill-buffer (current-buffer)) ;; kill the buffer we started from
- (switch-to-buffer (car (car (last vc-annotate-buffers))))
+ (vc-annotate vc-annotate-parent-file newrev
+ vc-annotate-parent-display-mode
+ (current-buffer))
(goto-line (min oldline (progn (goto-char (point-max))
;; XEmacs: previous-line needs 1 arg
(previous-line 1)
(line-number-at-pos))))))))
-
-(defun vc-annotate-car-last-cons (a-list)
- "Return car of last cons in association list A-LIST."
- (if (not (eq nil (cdr a-list)))
- (vc-annotate-car-last-cons (cdr a-list))
- (car (car a-list))))
(defun vc-annotate-time-span (a-list span &optional quantize)
"Apply factor SPAN to the time-span of association list A-LIST.