D816: histedit: add copy histedit action
mbthomas (Mark Thomas)
phabricator at mercurial-scm.org
Tue Sep 26 10:14:35 UTC 2017
mbthomas created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Add a new `histedit` action: `copy`. This allows copying of changesets from
outside of the history that is being edited, using the node hash of the other
changeset.
The other changeset is left intact - its contents are duplicated in a new
changeset.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D816
AFFECTED FILES
hgext/histedit.py
tests/test-histedit-arguments.t
tests/test-histedit-bookmark-motion.t
tests/test-histedit-commute.t
tests/test-histedit-edit.t
tests/test-histedit-obsolete.t
tests/test-histedit-outgoing.t
CHANGE DETAILS
diff --git a/tests/test-histedit-outgoing.t b/tests/test-histedit-outgoing.t
--- a/tests/test-histedit-outgoing.t
+++ b/tests/test-histedit-outgoing.t
@@ -52,6 +52,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
@@ -86,6 +87,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
@@ -112,6 +114,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -132,6 +132,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -476,6 +476,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, fold = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
--- a/tests/test-histedit-commute.t
+++ b/tests/test-histedit-commute.t
@@ -70,6 +70,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
@@ -348,6 +349,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
diff --git a/tests/test-histedit-bookmark-motion.t b/tests/test-histedit-bookmark-motion.t
--- a/tests/test-histedit-bookmark-motion.t
+++ b/tests/test-histedit-bookmark-motion.t
@@ -76,6 +76,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
@@ -132,6 +133,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -70,6 +70,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
@@ -305,6 +306,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
@@ -541,6 +543,7 @@
# e, edit = use commit, but stop for amending
# m, mess = edit commit message without changing commit content
# p, pick = use commit
+ # c, copy = copy (graft) a changeset from elsewhere
# d, drop = remove commit from history
# f, fold = use commit, but combine it with the one above
# r, roll = like fold, but discard this commit's description and date
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -857,6 +857,16 @@
def commiteditor(self):
return cmdutil.getcommiteditor(edit=True, editform='histedit.mess')
+ at action(['copy', 'c'],
+ _('copy (graft) a changeset from elsewhere'))
+class copy(histeditaction):
+ def _verifynodeconstraints(self, prev, expected, seen, basenodes):
+ pass
+
+ def continueclean(self):
+ ctx, replacement = super(copy, self).continueclean()
+ return ctx, []
+
def findoutgoing(ui, repo, remote=None, force=False, opts=None):
"""utility function to find the first outgoing changeset
To: mbthomas, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list