Mercurial > emacs
changeset 104647:ef4820f099a1
(vc-read-revision): New function.
(vc-version-diff, vc-merge): Use it.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 27 Aug 2009 16:53:04 +0000 |
parents | 17ba24e6c4d0 |
children | a9e9aa0de2e5 |
files | lisp/ChangeLog lisp/vc.el |
diffstat | 2 files changed, 37 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Aug 27 16:18:26 2009 +0000 +++ b/lisp/ChangeLog Thu Aug 27 16:53:04 2009 +0000 @@ -1,3 +1,8 @@ +2009-08-27 Stefan Monnier <monnier@iro.umontreal.ca> + + * vc.el (vc-read-revision): New function. + (vc-version-diff, vc-merge): Use it. + 2009-08-27 Sam Steingold <sds@gnu.org> * simple.el (kill-do-not-save-duplicates): New user option. @@ -9,8 +14,8 @@ * net/tramp.el (tramp-handle-process-file): Do not flush all caches when `process-file-side-effects' is set. (tramp-handle-vc-registered): Use `tramp-get-file-exists-command' - instead of `tramp-find-file-exists-command'. Unset - `process-file-side-effects'. + instead of `tramp-find-file-exists-command'. + Unset `process-file-side-effects'. 2009-08-27 Michael Albinus <michael.albinus@gmx.de> @@ -30,8 +35,7 @@ (tramp-get-ls-command, tramp-get-test-command) (tramp-get-file-exists-command, tramp-get-remote-ln) (tramp-get-remote-perl, tramp-get-remote-stat) - (tramp-get-remote-id): Remove - superfluous `with-current-buffer'. + (tramp-get-remote-id): Remove superfluous `with-current-buffer'. * net/tramp-cache.el (top): Autoload `tramp-time-less-p'. (tramp-cache-inhibit-cache): Extend doc string. It allows also
--- a/lisp/vc.el Thu Aug 27 16:18:26 2009 +0000 +++ b/lisp/vc.el Thu Aug 27 16:53:04 2009 +0000 @@ -1515,6 +1515,20 @@ ;; because we don't know that yet. t))) +(defun vc-read-revision (prompt &optional files backend default initial-input) + (cond + ((null files) + (let ((vc-fileset (vc-deduce-fileset t))) ;FIXME: why t? --Stef + (setq files (cadr vc-fileset)) + (setq backend (car vc-fileset)))) + ((null backend) (setq backend (vc-backend (car files))))) + (let ((completion-table + (vc-call-backend backend 'revision-completion-table files))) + (if completion-table + (completing-read prompt completion-table + nil nil initial-input nil default) + (read-string prompt initial-input nil default)))) + ;;;###autoload (defun vc-version-diff (files rev1 rev2) "Report diffs between revisions of the fileset in the repository history." @@ -1523,8 +1537,6 @@ (files (cadr vc-fileset)) (backend (car vc-fileset)) (first (car files)) - (completion-table - (vc-call-backend backend 'revision-completion-table files)) (rev1-default nil) (rev2-default nil)) (cond @@ -1551,14 +1563,8 @@ "Older revision: ")) (rev2-prompt (concat "Newer revision (default " (or rev2-default "current source") "): ")) - (rev1 (if completion-table - (completing-read rev1-prompt completion-table - nil nil nil nil rev1-default) - (read-string rev1-prompt nil nil rev1-default))) - (rev2 (if completion-table - (completing-read rev2-prompt completion-table - nil nil nil nil rev2-default) - (read-string rev2-prompt nil nil rev2-default)))) + (rev1 (vc-read-revision rev1-prompt files backend rev1-default)) + (rev2 (vc-read-revision rev2-prompt files backend rev2-default))) (when (string= rev1 "") (setq rev1 nil)) (when (string= rev2 "") (setq rev2 nil)) (list files rev1 rev2)))) @@ -1598,13 +1604,9 @@ (interactive (save-current-buffer (vc-ensure-vc-buffer) - (let ((completion-table - (vc-call revision-completion-table (list buffer-file-name))) - (prompt "Revision to visit (default is working revision): ")) - (list - (if completion-table - (completing-read prompt completion-table) - (read-string prompt)))))) + (list + (vc-read-revision "Revision to visit (default is working revision): " + (list buffer-file-name))))) (vc-ensure-vc-buffer) (let* ((file buffer-file-name) (revision (if (string-equal rev "") @@ -1730,16 +1732,22 @@ (vc-checkout file t) (error "Merge aborted")))) (setq first-revision - (read-string (concat "Branch or revision to merge from " - "(default news on current branch): "))) + (vc-read-revision + (concat "Branch or revision to merge from " + "(default news on current branch): ") + (list file) + backend)) (if (string= first-revision "") (setq status (vc-call-backend backend 'merge-news file)) (if (not (vc-find-backend-function backend 'merge)) (error "Sorry, merging is not implemented for %s" backend) (if (not (vc-branch-p first-revision)) (setq second-revision - (read-string "Second revision: " - (concat (vc-branch-part first-revision) "."))) + (vc-read-revision + "Second revision: " + (list file) backend nil + ;; FIXME: This is CVS/RCS/SCCS specific. + (concat (vc-branch-part first-revision) "."))) ;; We want to merge an entire branch. Set revisions ;; accordingly, so that vc-BACKEND-merge understands us. (setq second-revision first-revision)