unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Tom Tromey <tom@tromey.com>, 25859@debbugs.gnu.org
Subject: bug#25859: 25.1.91; add some branch operations to vc-dir
Date: Fri, 24 Feb 2017 21:01:03 -0700	[thread overview]
Message-ID: <87poi6vs00.fsf@tromey.com> (raw)
In-Reply-To: <83poi8rni2.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 24 Feb 2017 10:39:33 +0200")

[-- Attachment #1: Type: text/plain, Size: 89 bytes --]

Eli> This should be mentioned in the manual and in NEWS, I think.

How about this?

Tom


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: updated patch --]
[-- Type: text/x-patch, Size: 4532 bytes --]

commit dcc8e941391fe5abed73e81236ad633d15a39352
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Feb 15 05:19:50 2017 -0700

    Add more branch support to vc-dir
    
    Bug#25858:
    * 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.

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 @@ VC Directory Commands
 
   The VC Directory buffer also defines some single-key shortcuts for
 VC commands with the @kbd{C-x v} prefix: @kbd{=}, @kbd{+}, @kbd{l},
-@kbd{i}, @kbd{D}, @kbd{L}, @kbd{G}, @kbd{I} and @kbd{v}.
+@kbd{i}, @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 @@ VC Directory Commands
 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}:
+
+@table @kbd
+@item B c
+Create a new branch (@code{vc-create-tag}).
+
+@item B l
+Prompt for the name of a branch and display the change history of that
+branch (@code{vc-print-branch-log}).
+
+@item B s
+Switch to a branch (@code{vc-retrieve-tag}).  @xref{Switching Branches}.
+@end 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 9355dff..c46d7f3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -704,6 +704,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 has binds 'vc-log-outgoing' to 'O'; and 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 @@ vc-dir-mode-map
     (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 @@ vc-diff-internal
       ;; 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 @@ vc-read-revision
          (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 @@ vc-print-root-log
     (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	other threads:[~2017-02-25  4:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24  7:57 bug#25859: 25.1.91; add some branch operations to vc-dir Tom Tromey
2017-02-24  8:39 ` Eli Zaretskii
2017-02-25  4:01   ` Tom Tromey [this message]
2017-02-25  4:01     ` Tom Tromey
2017-02-25  7:39     ` Eli Zaretskii
2017-02-24 14:21 ` Dmitry Gutov
2017-02-25 17:48 ` bug#25859: done Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87poi6vs00.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=25859@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).