( )⚙ D1025 fbhistedit: add graft histedit action

This is an archive of the discontinued Mercurial Phabricator instance.

fbhistedit: add graft histedit action
ClosedPublic

Authored by mbthomas on Oct 12 2017, 6:14 AM.
Tags
None
Subscribers
None

Details

Reviewers
ryanmce
Group Reviewers
Restricted Project
Commits
rFBHGX59da598a3d75: fbhistedit: add graft histedit action
Summary

Add a new histedit verb: graft. This allows grafting (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.

The other changeset must not be one of the changesets that are being
edited as part of the histedit.

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mbthomas created this revision.Oct 12 2017, 6:14 AM
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 12 2017, 6:14 AM
ryanmce accepted this revision.Oct 13 2017, 6:43 AM

What happens if you attempt to graft an ancestor that isn't listed? Say you run hg histedit .^ and graft the hash of .^^? Does this behave like graft -f, which would attempt to apply it, or like graft which would skip it because it's an ancestor?

I wish graft were 4 chars...

tests/test-fbhistedit-graft.t
60–68

At first I was confused by the new rev numbers here, but then I realized that in this test we're actually still stripping the old rev 3, thus the re-ordering of rev numbers.

This revision is now accepted and ready to land.Oct 13 2017, 6:43 AM

It acts like graft -f and allows you to reapply it. I picked this deliberately as it's the more flexible option, and lets users reapply backed-out changes. For example: you make a commit and publish it, and then make a draft stack that depends on that commit. Someone else backs out your change, which you discover when you rebase your stack and it breaks. You can now use histedit to re-introduce it into your stack at an appropriate point (and presumably then fix whatever it was that caused them to back it out).

This revision was automatically updated to reflect the committed changes.