aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Tromey2017-02-15 05:19:50 -0700
committerTom Tromey2017-02-25 10:46:13 -0700
commit9e9d381ff0c83283278f43a65d3ecefd0cde8041 (patch)
treec3738014788c19eb95c7948afe5a9bc3410041f7
parent54319e7a2418690508f29cd6833c9fd9ecbc2fa3 (diff)
downloademacs-9e9d381ff0c83283278f43a65d3ecefd0cde8041.tar.gz
emacs-9e9d381ff0c83283278f43a65d3ecefd0cde8041.zip
Add more branch support to vc-dir
Bug#25859: * lisp/vc/vc-dir.el (vc-dir-mode-map) Add "B" bindings. * lisp/vc/vc.el (vc-revision-history): New defvar. (vc-read-revision): Use vc-revision-history. (vc-print-branch-log): New function. * doc/emacs/maintaining.texi (VC Directory Commands): Document new bindings. * etc/NEWS: Mention new vc-dir bindings.
-rw-r--r--doc/emacs/maintaining.texi17
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/vc/vc-dir.el6
-rw-r--r--lisp/vc/vc.el16
4 files changed, 41 insertions, 2 deletions
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index faaa96072c7..80a4467f639 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1301,7 +1301,7 @@ up a multi-file VC fileset to be acted on by VC commands like
1301 1301
1302 The VC Directory buffer also defines some single-key shortcuts for 1302 The VC Directory buffer also defines some single-key shortcuts for
1303VC commands with the @kbd{C-x v} prefix: @kbd{=}, @kbd{+}, @kbd{l}, 1303VC commands with the @kbd{C-x v} prefix: @kbd{=}, @kbd{+}, @kbd{l},
1304@kbd{i}, @kbd{D}, @kbd{L}, @kbd{G}, @kbd{I} and @kbd{v}. 1304@kbd{i}, @kbd{D}, @kbd{L}, @kbd{G}, @kbd{I}, @kbd{O}, and @kbd{v}.
1305 1305
1306 For example, you can commit a set of edited files by opening a VC 1306 For example, you can commit a set of edited files by opening a VC
1307Directory buffer, where the files are listed with the @samp{edited} 1307Directory buffer, where the files are listed with the @samp{edited}
@@ -1332,6 +1332,21 @@ Do an incremental regular expression search on the fileset
1332Apart from acting on multiple files, these commands behave much like 1332Apart from acting on multiple files, these commands behave much like
1333their single-buffer counterparts (@pxref{Search}). 1333their single-buffer counterparts (@pxref{Search}).
1334 1334
1335 The VC Directory buffer additionally defines some branch-related
1336commands starting with the prefix @kbd{B}:
1337
1338@table @kbd
1339@item B c
1340Create a new branch (@code{vc-create-tag}).
1341
1342@item B l
1343Prompt for the name of a branch and display the change history of that
1344branch (@code{vc-print-branch-log}).
1345
1346@item B s
1347Switch to a branch (@code{vc-retrieve-tag}). @xref{Switching Branches}.
1348@end table
1349
1335@cindex stashes in version control 1350@cindex stashes in version control
1336@cindex shelves in version control 1351@cindex shelves in version control
1337 The above commands are also available via the menu bar, and via a 1352 The above commands are also available via the menu bar, and via a
diff --git a/etc/NEWS b/etc/NEWS
index 5d14e122a20..05f380fe19c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -708,6 +708,10 @@ string is computed dynamically based on 'url-privacy-level'.
708colorful faces to make it more obvious to the user what the state is. 708colorful faces to make it more obvious to the user what the state is.
709See the 'vc-faces' customization group. 709See the 'vc-faces' customization group.
710 710
711+++
712*** 'vc-dir-mode' now binds 'vc-log-outgoing' to 'O'; and has various
713branch-related commands on a keymap bound to 'B'.
714
711** CC mode 715** CC mode
712 716
713*** Opening a .h file will turn C or C++ mode depending on language used. 717*** Opening a .h file will turn C or C++ mode depending on language used.
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 21bd21e15de..0363aab8407 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -297,6 +297,12 @@ See `run-hooks'."
297 (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp) 297 (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp)
298 (define-key map "G" 'vc-dir-ignore) 298 (define-key map "G" 'vc-dir-ignore)
299 299
300 (let ((branch-map (make-sparse-keymap)))
301 (define-key map "B" branch-map)
302 (define-key branch-map "c" 'vc-create-tag)
303 (define-key branch-map "l" 'vc-print-branch-log)
304 (define-key branch-map "s" 'vc-retrieve-tag))
305
300 ;; Hook up the menu. 306 ;; Hook up the menu.
301 (define-key map [menu-bar vc-dir-mode] 307 (define-key map [menu-bar vc-dir-mode]
302 `(menu-item 308 `(menu-item
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0c8492d021e..c5fe8aa6b1f 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1757,6 +1757,9 @@ Return t if the buffer had changes, nil otherwise."
1757 ;; because we don't know that yet. 1757 ;; because we don't know that yet.
1758 t))) 1758 t)))
1759 1759
1760(defvar vc-revision-history nil
1761 "History for `vc-read-revision'.")
1762
1760(defun vc-read-revision (prompt &optional files backend default initial-input) 1763(defun vc-read-revision (prompt &optional files backend default initial-input)
1761 (cond 1764 (cond
1762 ((null files) 1765 ((null files)
@@ -1768,7 +1771,7 @@ Return t if the buffer had changes, nil otherwise."
1768 (vc-call-backend backend 'revision-completion-table files))) 1771 (vc-call-backend backend 'revision-completion-table files)))
1769 (if completion-table 1772 (if completion-table
1770 (completing-read prompt completion-table 1773 (completing-read prompt completion-table
1771 nil nil initial-input nil default) 1774 nil nil initial-input 'vc-revision-history default)
1772 (read-string prompt initial-input nil default)))) 1775 (read-string prompt initial-input nil default))))
1773 1776
1774(defun vc-diff-build-argument-list-internal () 1777(defun vc-diff-build-argument-list-internal ()
@@ -2373,6 +2376,17 @@ When called interactively with a prefix argument, prompt for LIMIT."
2373 (vc-print-log-internal backend (list rootdir) nil nil limit))) 2376 (vc-print-log-internal backend (list rootdir) nil nil limit)))
2374 2377
2375;;;###autoload 2378;;;###autoload
2379(defun vc-print-branch-log (branch)
2380 (interactive
2381 (list
2382 (vc-read-revision "Branch to log: ")))
2383 (when (equal branch "")
2384 (error "No branch specified"))
2385 (vc-print-log-internal (vc-responsible-backend default-directory)
2386 (list default-directory) branch t
2387 (when (> vc-log-show-limit 0) vc-log-show-limit)))
2388
2389;;;###autoload
2376(defun vc-log-incoming (&optional remote-location) 2390(defun vc-log-incoming (&optional remote-location)
2377 "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION. 2391 "Show a log of changes that will be received with a pull operation from REMOTE-LOCATION.
2378When called interactively with a prefix argument, prompt for REMOTE-LOCATION." 2392When called interactively with a prefix argument, prompt for REMOTE-LOCATION."