]> code.delx.au - gnu-emacs/blobdiff - lisp/vc-mtn.el
Comment (python-mode is now separate from Python).
[gnu-emacs] / lisp / vc-mtn.el
index d4d1b1ff8e38f8cf3060f0bbf15a82c70247799a..e051477818dd8bbf03970c2a280c1b99f4ed6495 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-mtn.el --- VC backend for Monotone
 
-;; Copyright (C) 2007, 2008  Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2008, 2009  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: 
 
 ;; 
 
+;;; TODO:
+
+;; - The `previous-version' VC method needs to be supported, 'D' in
+;;   log-view-mode uses it.
+
 ;;; Code:
 
 (eval-when-compile (require 'cl) (require 'vc))
 
+(defcustom vc-mtn-diff-switches t
+  "String or list of strings specifying switches for monotone diff under VC.
+If nil, use the value of `vc-diff-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 "23.1"
+  :group 'vc)
+
+(define-obsolete-variable-alias 'vc-mtn-command 'vc-mtn-program "23.1")
+(defcustom vc-mtn-program "mtn"
+  "Name of the monotone executable."
+  :type 'string
+  :group 'vc)
+
 ;; Clear up the cache to force vc-call to check again and discover
 ;; new functions when we reload this file.
 (put 'Mtn 'vc-functions nil)
 
-(defvar vc-mtn-command "mtn")
-(unless (executable-find vc-mtn-command)
+(unless (executable-find vc-mtn-program)
   ;; vc-mtn.el is 100% non-functional without the `mtn' executable.
   (setq vc-handled-backends (delq 'Mtn vc-handled-backends)))
 
@@ -70,7 +90,8 @@
   (let ((process-environment
          ;; Avoid localization of messages so we can parse the output.
          (cons "LC_MESSAGES=C" process-environment)))
-    (apply 'vc-do-command buffer okstatus vc-mtn-command files flags)))
+    (apply 'vc-do-command (or buffer "*vc*") okstatus vc-mtn-program
+           files flags)))
 
 (defun vc-mtn-state (file)
   ;; If `mtn' fails or returns status>0, or if the search files, just
 (defvar log-view-message-re)
 (defvar log-view-file-re)
 (defvar log-view-font-lock-keywords)
+(defvar log-view-per-file-logs)
 
 (define-derived-mode vc-mtn-log-view-mode log-view-mode "Mtn-Log-View"
-  ;; TODO: Not sure what to do about file markers for now.
-  (set (make-local-variable 'log-view-file-re) "\\'\\`")
+  ;; Don't match anything.
+  (set (make-local-variable 'log-view-file-re) "\\`a\\`")
+  (set (make-local-variable 'log-view-per-file-logs) nil)
   ;; TODO: Use a more precise regexp than "[ |/]+" to avoid false positives
   ;; in the ChangeLog text.
   (set (make-local-variable 'log-view-message-re)
 ;;   )
 
 (defun vc-mtn-diff (files &optional rev1 rev2 buffer)
+  "Get a difference report using monotone between two revisions of FILES."
   (apply 'vc-mtn-command (or buffer "*vc-diff*") 1 files "diff"
-         (append (if rev1 (list "-r" rev1)) (if rev2 (list "-r" rev2)))))
+         (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 0 file "annotate"
          (if rev (list "-r" rev))))
 
+(declare-function vc-annotate-convert-time "vc-annotate" (time))
+
 (defconst vc-mtn-annotate-full-re
   "^ *\\([0-9a-f]+\\)\\.* by [^ ]+ \\([0-9]+\\)-\\([0-9]+\\)-\\([0-9]+\\): ")
 (defconst vc-mtn-annotate-any-re