emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 9e9d381: Add more branch support to vc-dir


From: Tom Tromey
Subject: [Emacs-diffs] master 9e9d381: Add more branch support to vc-dir
Date: Sat, 25 Feb 2017 12:48:08 -0500 (EST)

branch: master
commit 9e9d381ff0c83283278f43a65d3ecefd0cde8041
Author: Tom Tromey <address@hidden>
Commit: Tom Tromey <address@hidden>

    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.
---
 doc/emacs/maintaining.texi | 17 ++++++++++++++++-
 etc/NEWS                   |  4 ++++
 lisp/vc/vc-dir.el          |  6 ++++++
 lisp/vc/vc.el              | 16 +++++++++++++++-
 4 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index faaa960..80a4467 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
 
   The VC Directory buffer also defines some single-key shortcuts for
 VC commands with the @kbd{C-x v} prefix: @kbd{=}, @kbd{+}, @kbd{l},
address@hidden, @kbd{D}, @kbd{L}, @kbd{G}, @kbd{I} and @kbd{v}.
address@hidden, @kbd{D}, @kbd{L}, @kbd{G}, @kbd{I}, @kbd{O}, and @kbd{v}.
 
   For example, you can commit a set of edited files by opening a VC
 Directory buffer, where the files are listed with the @samp{edited}
@@ -1332,6 +1332,21 @@ Do an incremental regular expression search on the 
fileset
 Apart from acting on multiple files, these commands behave much like
 their single-buffer counterparts (@pxref{Search}).
 
+  The VC Directory buffer additionally defines some branch-related
+commands starting with the prefix @kbd{B}:
+
address@hidden @kbd
address@hidden B c
+Create a new branch (@code{vc-create-tag}).
+
address@hidden B l
+Prompt for the name of a branch and display the change history of that
+branch (@code{vc-print-branch-log}).
+
address@hidden B s
+Switch to a branch (@code{vc-retrieve-tag}).  @xref{Switching Branches}.
address@hidden table
+
 @cindex stashes in version control
 @cindex shelves in version control
   The above commands are also available via the menu bar, and via a
diff --git a/etc/NEWS b/etc/NEWS
index 5d14e12..05f380f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -708,6 +708,10 @@ string is computed dynamically based on 
'url-privacy-level'.
 colorful faces to make it more obvious to the user what the state is.
 See the 'vc-faces' customization group.
 
++++
+*** 'vc-dir-mode' now binds 'vc-log-outgoing' to 'O'; and has various
+branch-related commands on a keymap bound to 'B'.
+
 ** CC mode
 
 *** 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 21bd21e..0363aab 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -297,6 +297,12 @@ See `run-hooks'."
     (define-key map (kbd "M-s a M-C-s") 'vc-dir-isearch-regexp)
     (define-key map "G" 'vc-dir-ignore)
 
+    (let ((branch-map (make-sparse-keymap)))
+      (define-key map "B" branch-map)
+      (define-key branch-map "c" 'vc-create-tag)
+      (define-key branch-map "l" 'vc-print-branch-log)
+      (define-key branch-map "s" 'vc-retrieve-tag))
+
     ;; Hook up the menu.
     (define-key map [menu-bar vc-dir-mode]
       `(menu-item
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0c8492d..c5fe8aa 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1757,6 +1757,9 @@ Return t if the buffer had changes, nil otherwise."
       ;; because we don't know that yet.
       t)))
 
+(defvar vc-revision-history nil
+  "History for `vc-read-revision'.")
+
 (defun vc-read-revision (prompt &optional files backend default initial-input)
   (cond
    ((null files)
@@ -1768,7 +1771,7 @@ Return t if the buffer had changes, nil otherwise."
          (vc-call-backend backend 'revision-completion-table files)))
     (if completion-table
         (completing-read prompt completion-table
-                         nil nil initial-input nil default)
+                         nil nil initial-input 'vc-revision-history default)
       (read-string prompt initial-input nil default))))
 
 (defun vc-diff-build-argument-list-internal ()
@@ -2373,6 +2376,17 @@ When called interactively with a prefix argument, prompt 
for LIMIT."
     (vc-print-log-internal backend (list rootdir) nil nil limit)))
 
 ;;;###autoload
+(defun vc-print-branch-log (branch)
+  (interactive
+   (list
+    (vc-read-revision "Branch to log: ")))
+  (when (equal branch "")
+    (error "No branch specified"))
+  (vc-print-log-internal (vc-responsible-backend default-directory)
+                         (list default-directory) branch t
+                         (when (> vc-log-show-limit 0) vc-log-show-limit)))
+
+;;;###autoload
 (defun vc-log-incoming (&optional remote-location)
   "Show a log of changes that will be received with a pull operation from 
REMOTE-LOCATION.
 When called interactively with a prefix argument, prompt for REMOTE-LOCATION."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]