From b62a2b08b80ecf855096daf1e9e84b3f7bc7622a Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Thu, 25 May 2023 21:24:23 +0300 Subject: [PATCH] Add vc-create/switch/print-branch to menu and update documentation (bug#63690) * doc/emacs/maintaining.texi (VC Change Log): Add 'C-x v b l' (vc-print-branch-log). (Creating Branches): Add @kindex and @findex for vc-create-branch. (Switching Branches): Add @kindex and @findex for vc-switch-branch. * lisp/vc/vc-hooks.el (vc-menu-map): Add menu items for new commands vc-create-branch and vc-switch-branch, and also vc-print-branch-log. * lisp/vc/vc.el (vc-print-branch-log): Improve docstring. --- doc/emacs/maintaining.texi | 18 +++++++++++++++++- lisp/vc/vc-hooks.el | 9 +++++++++ lisp/vc/vc.el | 3 ++- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 7d49e28d11f..06f44a88aab 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -999,6 +999,10 @@ Display the change history for the current fileset Display the change history for the current repository (@code{vc-print-root-log}). +@item C-x v b l +Display the change history for another branch +(@code{vc-print-branch-log}). + @item C-x v I Display the changes that a ``pull'' operation will retrieve (@code{vc-log-incoming}). @@ -1063,6 +1067,13 @@ showing only the first line of each log entry. However, you can type @file{*vc-change-log*} buffer to reveal the entire log entry for the revision at point. A second @key{RET} hides it again. +@kindex C-x v b l +@findex vc-print-branch-log + @kbd{C-x v b l @var{branch-name} @key{RET}} (@code{vc-print-branch-log}) +displays a @file{*vc-change-log*} buffer showing the history of the +version-controlled directory tree like @code{vc-print-root-log} does, +but in another branch provided as an argument. + @kindex C-x v I @kindex C-x v O @findex vc-log-incoming @@ -1523,6 +1534,8 @@ switch to another branch using the @kbd{svn switch} command. With Mercurial, command @kbd{hg update} is used to switch to another branch. +@kindex C-x v b s +@findex vc-switch-branch The VC command to switch to another branch in the current directory is @kbd{C-x v b s @var{branch-name} @key{RET}} (@code{vc-switch-branch}). @@ -1673,9 +1686,12 @@ branch ID for a branch starting at the current revision. For example, if the current revision is 2.5, the branch ID should be 2.5.1, 2.5.2, and so on, depending on the number of existing branches at that point. +@kindex C-x v b c +@findex vc-create-branch This procedure will not work for distributed version control systems like git or Mercurial. For those systems you should use the command -@code{vc-create-branch} (@kbd{C-x v b c}) instead. +@code{vc-create-branch} (@kbd{C-x v b c @var{branch-name} @key{RET}}) +instead. To create a new branch at an older revision (one that is no longer the head of a branch), first select that revision (@pxref{Switching diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index e242d1e48e2..b559a776c09 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -897,6 +897,15 @@ In the latter case, VC mode is deactivated for this buffer." (bindings--define-key map [vc-create-tag] '(menu-item "Create Tag" vc-create-tag :help "Create version tag")) + (bindings--define-key map [vc-print-branch-log] + '(menu-item "Show Branch History..." vc-print-branch-log + :help "List the change log for a branch")) + (bindings--define-key map [vc-switch-branch] + '(menu-item "Switch Branch..." vc-switch-branch + :help "Switch to another branch")) + (bindings--define-key map [vc-create-branch] + '(menu-item "Create Branch..." vc-create-branch + :help "Make a new branch")) (bindings--define-key map [separator1] menu-bar-separator) (bindings--define-key map [vc-annotate] '(menu-item "Annotate" vc-annotate diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index c64da1233d1..ba981545085 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2851,7 +2851,8 @@ with its diffs (if the underlying VCS backend supports that)." ;;;###autoload (defun vc-print-branch-log (branch) - "Show the change log for BRANCH root in a window." + "Show the change log for BRANCH in a window. +The command prompts for the branch to log." (interactive (let* ((backend (vc-responsible-backend default-directory)) (rootdir (vc-call-backend backend 'root default-directory))) -- 2.39.2