aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorSean Whitton2025-10-02 21:48:31 +0100
committerSean Whitton2025-10-04 18:18:48 +0100
commit9ccef794a8ed55a8f96e68c0dd1e53cb07e85baa (patch)
tree696157861965573700492168da284d8efef68de0 /doc
parent5ee1e205e1663409c9d0a196bd9bbec9b36cf53a (diff)
downloademacs-9ccef794a8ed55a8f96e68c0dd1e53cb07e85baa.tar.gz
emacs-9ccef794a8ed55a8f96e68c0dd1e53cb07e85baa.zip
VC: New commands for cherry-picking (bug#79408)
* lisp/vc/diff-mode.el (diff-buffer-file-names): New function. * lisp/vc/log-view.el (vc--pick-or-revert) (vc--prompt-other-working-tree): Autoload. (vc-parent-buffer-name, vc-log-short-style) (vc-print-log-internal): Declare. (log-view--pick-or-revert): New function. (log-view-revision-cherry-pick, log-view-revision-revert): New commands. (log-view-mode-map, log-view-mode-menu): Bind them. * lisp/vc/vc-dispatcher.el (vc-start-logentry): If get-file-buffer returns nil, use the current buffer as the parent buffer. * lisp/vc/vc.el (diff-buffer-file-names, diff-reverse-direction): Declare. (vc--pick-or-revert): New function. (vc-revision-cherry-pick, vc-revision-revert): New commands. * lisp/vc/vc-hooks.el (vc-menu-map): Bind them. * doc/emacs/maintaining.texi (VC Change Log, VC Undo) (Copying Between Branches): * etc/NEWS: Document the new commands.
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/emacs.texi9
-rw-r--r--doc/emacs/maintaining.texi81
2 files changed, 82 insertions, 8 deletions
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index b32c704bd12..7a5107ee359 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -857,10 +857,11 @@ VC Directory Mode
857 857
858Version Control Branches 858Version Control Branches
859 859
860* Switching Branches:: How to get to another existing branch. 860* Switching Branches:: How to get to another existing branch.
861* Pulling / Pushing:: Receiving/sending changes from/to elsewhere. 861* Pulling / Pushing:: Receiving/sending changes from/to elsewhere.
862* Merging:: Transferring changes between branches. 862* Merging:: Transferring changes between branches.
863* Creating Branches:: How to start a new branch. 863* Creating Branches:: How to start a new branch.
864* Copying Between Branches:: Copying the changes made by revisions.
864 865
865@ifnottex 866@ifnottex
866Miscellaneous Commands and Features of VC 867Miscellaneous Commands and Features of VC
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index e7a05a3556b..9d768cc1a77 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1264,6 +1264,15 @@ Unmark the entry at point (@code{log-view-unmark-entry}).
1264 1264
1265@item U 1265@item U
1266Unmark all marked entries (@code{log-view-unmark-all-entries}). 1266Unmark all marked entries (@code{log-view-unmark-all-entries}).
1267
1268@item C
1269Copy changes to a currently checked out branch; either the changes from
1270the revision at point, or the changes from all marked revisions
1271(@code{log-view-revision-cherry-pick}).
1272
1273@item R
1274Undo the effects of old revisions; either the revision at point, or all
1275marked revisions (@code{log-view-revision-revert}).
1267@end table 1276@end table
1268 1277
1269@vindex vc-log-show-limit 1278@vindex vc-log-show-limit
@@ -1307,6 +1316,9 @@ also prompt for a specific VCS shell command to run for this purpose.
1307@item C-x v u 1316@item C-x v u
1308Revert the work file(s) in the current VC fileset to the last revision 1317Revert the work file(s) in the current VC fileset to the last revision
1309(@code{vc-revert}). 1318(@code{vc-revert}).
1319
1320@item M-x vc-revision-revert
1321Undo the effects of an older commit.
1310@end table 1322@end table
1311 1323
1312@kindex C-x v u 1324@kindex C-x v u
@@ -1330,6 +1342,21 @@ unlocked; you must lock again to resume editing. You can also use
1330@kbd{C-x v u} to unlock a file if you lock it and then decide not to 1342@kbd{C-x v u} to unlock a file if you lock it and then decide not to
1331change it. 1343change it.
1332 1344
1345@findex vc-revision-revert
1346@cindex reverting commits
1347 To discard changes that have already been committed, by yourself or
1348someone else, you can use @w{@kbd{M-x vc-revision-revert}}. This is
1349called @dfn{reverting} a commit. The command prompts for a revision to
1350revert, and then the VC backend reverts it. Most backends implement
1351this by making a new commit which undoes the changes made by the
1352revision.
1353
1354 An alternative way to access this functionality is to the
1355@code{log-view-revision-revert} command, bound to @kbd{R} in Log View
1356mode buffers (@pxref{VC Change Log}). Compared to using @w{@kbd{M-x
1357vc-revision revert}} directly, this can make it easier to be sure you
1358are reverting the revision you intend.
1359
1333@node VC Ignore 1360@node VC Ignore
1334@subsection Ignore Version Control Files 1361@subsection Ignore Version Control Files
1335 1362
@@ -1642,10 +1669,11 @@ supports checking out different branches and committing into new or
1642different branches. 1669different branches.
1643 1670
1644@menu 1671@menu
1645* Switching Branches:: How to get to another existing branch. 1672* Switching Branches:: How to get to another existing branch.
1646* Pulling / Pushing:: Receiving/sending changes from/to elsewhere. 1673* Pulling / Pushing:: Receiving/sending changes from/to elsewhere.
1647* Merging:: Transferring changes between branches. 1674* Merging:: Transferring changes between branches.
1648* Creating Branches:: How to start a new branch. 1675* Creating Branches:: How to start a new branch.
1676* Copying Between Branches:: Copying the changes made by revisions.
1649@end menu 1677@end menu
1650 1678
1651@node Switching Branches 1679@node Switching Branches
@@ -1857,6 +1885,51 @@ revision.
1857on that branch. To leave the branch, you must explicitly select a 1885on that branch. To leave the branch, you must explicitly select a
1858different revision with @kbd{C-u C-x v v}. 1886different revision with @kbd{C-u C-x v v}.
1859 1887
1888@node Copying Between Branches
1889@subsubsection Copying Changes Made By Revisions Between Branches
1890
1891@table @kbd
1892@item M-x vc-revision-cherry-pick
1893Copy a single revision to branch checked out in this working tree.
1894@end table
1895
1896@cindex cherry-pick
1897@cindex revision, cherry-picks of
1898 Sometimes it is useful to copy a revision from one branch to another.
1899This means creating a new revision with the same changes, log message
1900and authorship information as an existing revision that can be found on
1901another branch. This is often called @dfn{cherry-picking} the revision
1902from one branch to another.
1903
1904@cindex revisions, backporting
1905 The most common case is copying a revision from a branch that won't be
1906merged (@pxref{Merging}) into your current branch. For example, your
1907project might have a feature-frozen branch that accepts only bug fixes.
1908Someone (possibly you) fixes a bug on the main development branch. You
1909can then cherry-pick that revision onto the feature-frozen branch in
1910order to fix the bug there, too. This is called @dfn{backporting} the
1911revision, or backporting the fix.
1912
1913@findex vc-revision-cherry-pick
1914 You can use the command @kbd{M-x vc-revision-cherry-pick} to
1915cherry-pick revisions. It prompts for a revision to cherry-pick. It
1916then pops up a buffer for you to edit the log message for the new
1917revision. Normally the VC backend generates a log message including a
1918reference to the revision you want to copy, so that the copy can be
1919traced. If you wish, you can delete this reference before typing
1920@kbd{C-c C-c} to conclude the cherry-pick.
1921
1922 Alternatively you can invoke the command with a prefix argument,
1923i.e. @w{@kbd{C-u M-x vc-revision-cherry-pick}}. In this case the log
1924message from the source revision is used unmodified, and the cherry-pick
1925happens immediately, without popping up a buffer for log message edits.
1926
1927 An alternative way to access this functionality is the
1928@code{log-view-revision-cherry-pick} command, bound to @kbd{C} in Log
1929View mode buffers (@pxref{VC Change Log}). Compared to using
1930@w{@kbd{M-x vc-revision-cherry-pick}} directly, this can make it easier
1931to be sure you are cherry-picking the revision you intend.
1932
1860@ifnottex 1933@ifnottex
1861@include vc1-xtra.texi 1934@include vc1-xtra.texi
1862@end ifnottex 1935@end ifnottex