X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/294127e7d59a5d23a32561716a1b192db410e12f..f82248004d0f5ef84bbe03d83467bb3c43afa765:/lisp/vc/vc-mtn.el diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index d783572678..6ce853f6ae 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el @@ -1,6 +1,6 @@ ;;; vc-mtn.el --- VC backend for Monotone -*- lexical-binding: t -*- -;; Copyright (C) 2007-2015 Free Software Foundation, Inc. +;; Copyright (C) 2007-2016 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: vc @@ -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." @@ -91,6 +102,10 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." "Return the administrative directory of FILE." (expand-file-name vc-mtn-admin-dir (vc-mtn-root file))) +(defun vc-mtn-find-ignore-file (file) + "Return the mtn ignore file that controls FILE." + (expand-file-name ".mtnignore" (vc-mtn-root file))) + (defun vc-mtn-registered (file) (let ((root (vc-mtn-root file))) (when root @@ -168,15 +183,18 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (defun vc-mtn-mode-line-string (file) "Return a string for `vc-mode-line' to put in the mode line for FILE." (let ((branch (vc-mtn-workfile-branch file))) - (dolist (rule vc-mtn-mode-line-rewrite) - (if (string-match (car rule) branch) - (setq branch (replace-match (cdr rule) t nil branch)))) - (format "Mtn%c%s" - (pcase (vc-state file) - ((or `up-to-date `needs-update) ?-) - (`added ?@) - (_ ?:)) - branch))) + (if branch + (progn + (dolist (rule vc-mtn-mode-line-rewrite) + (if (string-match (car rule) branch) + (setq branch (replace-match (cdr rule) t nil branch)))) + (format "Mtn%c%s" + (pcase (vc-state file) + ((or `up-to-date `needs-update) ?-) + (`added ?@) + (_ ?:)) + branch)) + ""))) (defun vc-mtn-register (files &optional _comment) (vc-mtn-command nil 0 files "add")) @@ -185,7 +203,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (declare-function log-edit-extract-headers "log-edit" (headers string)) -(defun vc-mtn-checkin (files comment) +(defun vc-mtn-checkin (files comment &optional _rev) (apply 'vc-mtn-command nil 0 files (nconc (list "commit" "-m") (log-edit-extract-headers '(("Author" . "--author") @@ -193,7 +211,10 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." comment)))) (defun vc-mtn-find-revision (file rev buffer) - (vc-mtn-command buffer 0 file "cat" "-r" rev)) + ;; null rev means latest revision + (if rev + (vc-mtn-command buffer 0 file "cat" "-r" rev) + (vc-mtn-command buffer 0 file "cat"))) ;; (defun vc-mtn-checkout (file &optional rev) ;; ) @@ -236,20 +257,21 @@ If LIMIT is non-nil, show no more than this many entries." (autoload 'vc-switches "vc") -(defun vc-mtn-diff (files &optional rev1 rev2 buffer async) +(defun vc-mtn-diff (files &optional rev1 rev2 buffer _async) "Get a difference report using monotone between two revisions of FILES." (apply 'vc-mtn-command (or buffer "*vc-diff*") - (if async 'async 1) + 1 ; bug#21969 files "diff" (append (vc-switches 'mtn 'diff) (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)) +(declare-function vc-annotate-convert-time "vc-annotate" (&optional time)) (defconst vc-mtn-annotate-full-re "^ *\\([0-9a-f]+\\)\\.* by [^ ]+ \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\): ")