Use vc-switches on vc-*-annotate-command

This also removes switch "-C -C" from vc-git-annotate-command.

Fixes: debbugs:17945

* vc/vc.el (vc-annotate-switches): New defcustom.
* vc/vc-bzr.el (vc-bzr-annotate-switches): New defcustom.
(vc-bzr-annotate-command): Use it.
* vc/vc-cvs.el (vc-cvs-annotate-switches): New defcustom.
(vc-cvs-annotate-command): Use it.
* vc/vc-git.el (vc-git-annotate-switches): New defcustom.
(vc-git-annotate-command): Use it.
* vc/vc-hg.el (vc-hg-annotate-switches): New defcustom.
(vc-hg-annotate-command): Use it.
* vc/vc-mtn.el (vc-mtn-annotate-switches): New defcustom.
(vc-mtn-annotate-command): Use it.
* vc/vc-svn.el (vc-svn-annotate-switches): New defcustom.
(vc-svn-annotate-command): Use it.
This commit is contained in:
Oscar Fuentes 2015-02-26 15:46:12 +01:00
parent d8e9122115
commit b5a0603eb4
8 changed files with 120 additions and 12 deletions

View file

@ -1,3 +1,19 @@
2015-02-26 Oscar Fuentes <ofv@wanadoo.es>
* vc/vc.el (vc-annotate-switches): New defcustom.
* vc/vc-bzr.el (vc-bzr-annotate-switches): New defcustom.
(vc-bzr-annotate-command): Use it.
* vc/vc-cvs.el (vc-cvs-annotate-switches): New defcustom.
(vc-cvs-annotate-command): Use it.
* vc/vc-git.el (vc-git-annotate-switches): New defcustom.
(vc-git-annotate-command): Use it.
* vc/vc-hg.el (vc-hg-annotate-switches): New defcustom.
(vc-hg-annotate-command): Use it.
* vc/vc-mtn.el (vc-mtn-annotate-switches): New defcustom.
(vc-mtn-annotate-command): Use it.
* vc/vc-svn.el (vc-svn-annotate-switches): New defcustom.
(vc-svn-annotate-command): Use it.
2015-02-26 Alan Mackenzie <acm@muc.de>
Handle "#" operator properly inside macro. Fix coding bug.

View file

@ -73,6 +73,16 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(repeat :tag "Argument List" :value ("") string))
:group 'vc-bzr)
(defcustom vc-bzr-annotate-switches nil
"String or list of strings specifying switches for bzr annotate under VC.
If nil, use the value of `vc-annotate-switches'. If t, use no switches."
:type '(choice (const :tag "Unspecified" nil)
(const :tag "None" t)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "25.1"
:group 'vc-bzr)
(defcustom vc-bzr-log-switches nil
"String or list of strings specifying switches for bzr log under VC."
:type '(choice (const :tag "None" nil)
@ -826,7 +836,8 @@ If LIMIT is non-nil, show no more than this many entries."
Each line is tagged with the revision number, which has a `help-echo'
property containing author and date information."
(apply #'vc-bzr-command "annotate" buffer 'async file "--long" "--all"
(if revision (list "-r" revision)))
(append (vc-switches 'bzr 'annotate)
(if revision (list "-r" revision))))
(let ((table (make-hash-table :test 'equal)))
(set-process-filter
(get-buffer-process buffer)

View file

@ -96,6 +96,17 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
:version "21.1"
:group 'vc-cvs)
(defcustom vc-cvs-annotate-switches nil
"String or list of strings specifying switches for cvs annotate under VC.
If nil, use the value of `vc-annotate-switches'. If t, use no
switches."
:type '(choice (const :tag "Unspecified" nil)
(const :tag "None" t)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "25.1"
:group 'vc-cvs)
(defcustom vc-cvs-header '("\$Id\$")
"Header keywords to be inserted by `vc-insert-headers'."
:version "24.1" ; no longer consult the obsolete vc-header-alist
@ -623,11 +634,12 @@ Remaining arguments are ignored."
(defun vc-cvs-annotate-command (file buffer &optional revision)
"Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER.
Optional arg REVISION is a revision to annotate from."
(vc-cvs-command buffer
(if (vc-cvs-stay-local-p file)
'async 0)
file "annotate"
(if revision (concat "-r" revision)))
(apply #'vc-cvs-command buffer
(if (vc-cvs-stay-local-p file)
'async 0)
file "annotate"
(append (vc-switches 'cvs 'annotate)
(if revision (list (concat "-r" revision)))))
;; Strip the leading few lines.
(let ((proc (get-buffer-process buffer)))
(if proc

View file

@ -120,6 +120,16 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
:version "23.1"
:group 'vc-git)
(defcustom vc-git-annotate-switches nil
"String or list of strings specifying switches for Git blame under VC.
If nil, use the value of `vc-annotate-switches'. If t, use no switches."
:type '(choice (const :tag "Unspecified" nil)
(const :tag "None" t)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "25.1"
:group 'vc-git)
(defcustom vc-git-program "git"
"Name of the Git executable (excluding any arguments)."
:version "24.1"
@ -1013,7 +1023,9 @@ or BRANCH^ (where \"^\" can be repeated)."
(defun vc-git-annotate-command (file buf &optional rev)
(let ((name (file-relative-name file)))
(vc-git-command buf 'async nil "blame" "--date=iso" "-C" "-C" rev "--" name)))
(apply #'vc-git-command buf 'async nil "blame" "--date=iso"
(append (vc-switches 'git 'annotate)
(list rev "--" name)))))
(declare-function vc-annotate-convert-time "vc-annotate" (time))

View file

@ -131,6 +131,17 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
:version "23.1"
:group 'vc-hg)
(defcustom vc-hg-annotate-switches nil
"String or list of strings specifying switches for hg annotate under VC.
If nil, use the value of `vc-annotate-switches'. If t, use no
switches."
:type '(choice (const :tag "Unspecified" nil)
(const :tag "None" t)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "25.1"
:group 'vc-hg)
(defcustom vc-hg-program "hg"
"Name of the Mercurial executable (excluding any arguments)."
:type 'string
@ -358,8 +369,9 @@ If LIMIT is non-nil, show no more than this many entries."
(defun vc-hg-annotate-command (file buffer &optional revision)
"Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
Optional arg REVISION is a revision to annotate from."
(vc-hg-command buffer 0 file "annotate" "-d" "-n" "--follow"
(when revision (concat "-r" revision))))
(apply #'vc-hg-command buffer 0 file "annotate" "-d" "-n" "--follow"
(append (vc-switches 'hg 'annotate)
(if revision (list (concat "-r" revision))))))
(declare-function vc-annotate-convert-time "vc-annotate" (time))

View file

@ -49,6 +49,17 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
:version "23.1"
:group 'vc-mtn)
(defcustom vc-mtn-annotate-switches nil
"String or list of strings specifying switches for mtn annotate under VC.
If nil, use the value of `vc-annotate-switches'. If t, use no
switches."
:type '(choice (const :tag "Unspecified" nil)
(const :tag "None" t)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "25.1"
:group 'vc-mtn)
(define-obsolete-variable-alias 'vc-mtn-command 'vc-mtn-program "23.1")
(defcustom vc-mtn-program "mtn"
"Name of the monotone executable."
@ -246,8 +257,9 @@ If LIMIT is non-nil, show no more than this many entries."
(if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
(defun vc-mtn-annotate-command (file buf &optional rev)
(apply 'vc-mtn-command buf 'async file "annotate"
(if rev (list "-r" rev))))
(apply #'vc-mtn-command buf 'async file "annotate"
(append (vc-switches 'mtn 'annotate)
(if rev (list "-r" rev)))))
(declare-function vc-annotate-convert-time "vc-annotate" (time))

View file

@ -95,6 +95,17 @@ If you want to force an empty list of arguments, use t."
:version "22.1"
:group 'vc-svn)
(defcustom vc-svn-annotate-switches nil
"String or list of strings specifying switches for svn annotate under VC.
If nil, use the value of `vc-annotate-switches'. If t, use no
switches."
:type '(choice (const :tag "Unspecified" nil)
(const :tag "None" t)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "25.1"
:group 'vc-svn)
(defcustom vc-svn-header '("\$Id\$")
"Header keywords to be inserted by `vc-insert-headers'."
:version "24.1" ; no longer consult the obsolete vc-header-alist
@ -736,7 +747,9 @@ Set file properties accordingly. If FILENAME is non-nil, return its status."
;; Support for `svn annotate'
(defun vc-svn-annotate-command (file buf &optional rev)
(vc-svn-command buf 'async file "annotate" (if rev (concat "-r" rev))))
(apply #'vc-svn-command buf 'async file "annotate"
(append (vc-switches 'svn 'annotate)
(if rev (list (concat "-r" rev))))))
(defun vc-svn-annotate-time-of-rev (rev)
;; Arbitrarily assume 10 commits per day.

View file

@ -780,6 +780,26 @@ not specific to any particular backend."
:group 'vc
:version "21.1")
(defcustom vc-annotate-switches nil
"A string or list of strings specifying switches for annotate under VC.
When running annotate under a given BACKEND, VC uses the first
non-nil value of `vc-BACKEND-annotate-switches', `vc-annotate-switches',
and `annotate-switches', in that order. Since nil means to check the
next variable in the sequence, either of the first two may use
the value t to mean no switches at all. `vc-annotate-switches'
should contain switches that are specific to version control, but
not specific to any particular backend.
As very few switches (if any) are used across different VC tools,
please consider using the specific `vc-BACKEND-annotate-switches'
for the backend you use."
:type '(choice (const :tag "Unspecified" nil)
(const :tag "None" t)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:group 'vc
:version "25.1")
(defcustom vc-log-show-limit 2000
"Limit the number of items shown by the VC log commands.
Zero means unlimited.