diff options
Diffstat (limited to 'lisp/vc')
-rw-r--r-- | lisp/vc/emerge.el | 14 | ||||
-rw-r--r-- | lisp/vc/vc-hg.el | 52 | ||||
-rw-r--r-- | lisp/vc/vc-hooks.el | 13 | ||||
-rw-r--r-- | lisp/vc/vc.el | 15 |
4 files changed, 68 insertions, 26 deletions
diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el index d4638616dd7..b17d11d34a4 100644 --- a/lisp/vc/emerge.el +++ b/lisp/vc/emerge.el @@ -2883,17 +2883,11 @@ keymap. Leaves merge in fast mode." (setq vars (cdr vars)) (setq values (cdr values)))) -;; Make a temporary file that only we have access to. -;; PREFIX is appended to emerge-temp-file-prefix to make the filename prefix. +;; When the pointless option emerge-temp-file-prefix goes, +;; make this function obsolete too, and just use make-temp-file. (defun emerge-make-temp-file (prefix) - (let (f (old-modes (default-file-modes))) - (unwind-protect - (progn - ;; This has no effect, since make-temp-file sets umask = 700. - (set-default-file-modes emerge-temp-file-mode) - (setq f (make-temp-file (concat emerge-temp-file-prefix prefix)))) - (set-default-file-modes old-modes)) - f)) + "Make a private temporary file based on `emerge-temp-file-prefix'." + (make-temp-file (concat emerge-temp-file-prefix prefix))) ;;; Functions that query the user before he can write out the current buffer. diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index b800c64c869..df61006ad51 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -82,8 +82,8 @@ ;; - annotate-current-time () NOT NEEDED ;; - annotate-extract-revision-at-line () OK ;; TAG SYSTEM -;; - create-tag (dir name branchp) NEEDED -;; - retrieve-tag (dir name update) NEEDED +;; - create-tag (dir name branchp) OK +;; - retrieve-tag (dir name update) OK FIXME UPDATE BUFFERS ;; MISCELLANEOUS ;; - make-version-backups-p (file) ?? ;; - repository-hostname (dirname) ?? @@ -146,12 +146,19 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." :group 'vc-hg) (defcustom vc-hg-root-log-format - '("{rev}:{tags}: {author|person} {date|shortdate} {desc|firstline}\\n" - "^\\([0-9]+\\):\\([^:]*\\): \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)" + `(,(concat "{rev}:{ifeq(branch, 'default','', '{branch}')}" + ":{bookmarks}:{tags}:{author|person}" + " {date|shortdate} {desc|firstline}\\n") + ,(concat "^\\(?:[+@o x|-]*\\)" ;Graph data. + "\\([0-9]+\\):\\([^:]*\\)" + ":\\([^:]*\\):\\([^:]*\\):\\(.*?\\)" + "[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)") ((1 'log-view-message-face) - (2 'change-log-list) - (3 'change-log-name) - (4 'change-log-date))) + (2 'change-log-file) + (3 'change-log-list) + (4 'change-log-conditionals) + (5 'change-log-name) + (6 'change-log-date))) "Mercurial log template for `vc-hg-print-log' short format. This should be a list (TEMPLATE REGEXP KEYWORDS), where TEMPLATE is the \"--template\" argument string to pass to Mercurial, @@ -160,7 +167,7 @@ output, and KEYWORDS is a list of `font-lock-keywords' for highlighting the Log View buffer." :type '(list string string (repeat sexp)) :group 'vc-hg - :version "24.1") + :version "24.5") ;;; Properties of the backend @@ -244,6 +251,9 @@ highlighting the Log View buffer." (autoload 'vc-setup-buffer "vc-dispatcher") +(defvar vc-hg-log-graph nil + "If non-nil, use `--graph' in the short log output.") + (defun vc-hg-print-log (files buffer &optional shortlog start-revision limit) "Print commit log associated with FILES into specified BUFFER. If SHORTLOG is non-nil, use a short format based on `vc-hg-root-log-format'. @@ -261,7 +271,9 @@ If LIMIT is non-nil, show no more than this many entries." (nconc (when start-revision (list (format "-r%s:0" start-revision))) (when limit (list "-l" (format "%s" limit))) - (when shortlog (list "--template" (car vc-hg-root-log-format))) + (when shortlog `(,@(if vc-hg-log-graph '("--graph")) + "--template" + ,(car vc-hg-root-log-format))) vc-hg-log-switches))))) (defvar log-view-message-re) @@ -376,8 +388,26 @@ Optional arg REVISION is a revision to annotate from." (if (match-beginning 3) (match-string-no-properties 1) (cons (match-string-no-properties 1) - (expand-file-name (match-string-no-properties 4) - (vc-hg-root default-directory))))))) + (expand-file-name (match-string-no-properties 4) + (vc-hg-root default-directory))))))) + +;;; Tag system + +(defun vc-hg-create-tag (dir name branchp) + "Attach the tag NAME to the state of the working copy." + (let ((default-directory dir)) + (and (vc-hg-command nil 0 nil "status") + (vc-hg-command nil 0 nil (if branchp "bookmark" "tag") name)))) + +(defun vc-hg-retrieve-tag (dir name update) + "Retrieve the version tagged by NAME of all registered files at or below DIR." + (let ((default-directory dir)) + (vc-hg-command nil 0 nil "update" name) + ;; FIXME: update buffers if `update' is true + ;; TODO: update *vc-change-log* buffer so can see @ if --graph + )) + +;;; Miscellaneous (defun vc-hg-previous-revision (_file rev) (let ((newrev (1- (string-to-number rev)))) diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 1cd297ae43a..ce7f2c8f4ed 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -190,6 +190,11 @@ individually should stay local." (make-variable-buffer-local 'vc-mode) (put 'vc-mode 'permanent-local t) +;;; We signal this error when we try to do something a VC backend +;;; doesn't support. Two arguments: the method that's not supported +;;; and the backend +(define-error 'vc-not-supported "VC method not implemented for backend") + (defun vc-mode (&optional _arg) ;; Dummy function for C-h m "Version Control minor mode. @@ -268,10 +273,10 @@ It is usually called via the `vc-call' macro." (setq f (vc-find-backend-function backend function-name)) (push (cons function-name f) (get backend 'vc-functions))) (cond - ((null f) - (error "Sorry, %s is not implemented for %s" function-name backend)) - ((consp f) (apply (car f) (cdr f) args)) - (t (apply f args))))) + ((null f) + (signal 'vc-not-supported (list function-name backend))) + ((consp f) (apply (car f) (cdr f) args)) + (t (apply f args))))) (defmacro vc-call (fun file &rest args) "A convenience macro for calling VC backend functions. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 4a536900eb3..5491d67e700 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1879,6 +1879,19 @@ saving the buffer." (called-interactively-p 'interactive)))))) ;;;###autoload +(defun vc-root-dir () + "Return the root directory for the current VC tree. +Return nil if the root directory cannot be identified." + (let ((backend (vc-deduce-backend))) + (if backend + (condition-case err + (vc-call-backend backend 'root default-directory) + (vc-not-supported + (unless (eq (cadr err) 'root) + (signal (car err) (cdr err))) + nil))))) + +;;;###autoload (defun vc-revision-other-window (rev) "Visit revision REV of the current file in another window. If the current file is named `F', the revision is named `F.~REV~'. @@ -2450,7 +2463,7 @@ depending on the underlying version-control system." (error "Please revert all modified workfiles before rollback"))) ;; Accumulate changes associated with the fileset (vc-setup-buffer "*vc-diff*") - (not-modified) + (set-buffer-modified-p nil) (message "Finding changes...") (let* ((tip (vc-working-revision (car files))) ;; FIXME: `previous-revision' should take the fileset. |