Differences between revisions 1 and 21 (spanning 20 versions)
Revision 1 as of 2009-04-26 09:07:09
Size: 537
Comment:
Revision 21 as of 2013-08-26 15:42:03
Size: 3604
Editor: alex hunsley
Comment: Vandalism
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Histedit Extension == #pragma section-numbers 2
= Histedit Extension =
'''This extension is distributed with Mercurial 2.3 and later.'''
Line 3: Line 5:
'''This extension is not distributed with Mercurial.''' ''Author: Augie Fackler''
Line 5: Line 7:
''Author: durin42'' Repository: https://bitbucket.org/durin42/histedit/
Line 7: Line 9:
Download site: Works with: Mercurial 1.3 and beyond (tests are run against versions seen [[https://bitbucket.org/durin42/histedit/src/tip/Makefile#cl-23|in the Makefile]].)
Line 9: Line 11:
Home page: http://bitbucket.org/durin42/histedit/ In core since version 2.3
Line 11: Line 13:
Works with: Mercurial 1.0 and beyond. <<TableOfContents>>
Line 13: Line 15:
== Overview ==
History editing plugin for Mercurial, heavily inspired by {{{git rebase --interactive}}}.
Line 14: Line 18:
=== Overview === It allows selecting ('''pick'''), combining ('''fold'''), rejecting ('''drop''') or modifying ('''edit''') already commited changesets.
Line 16: Line 20:
History editing plugin for Mercurial, heavily inspired by git rebase --interactive.

=== Configuration ===
Configure your [:.hgrc:.hgrc] to enable the extension by adding following lines:
== Configuration ==
In versions of Mercurial after 2.3, enable the extension by adding the following lines to your [[http://www.selenic.com/mercurial/hgrc.5.html|configuration file]]:
Line 23: Line 25:
histedit = histedit =
}}}
For older versions, you need to grab the extension source and then configure your [[http://www.selenic.com/mercurial/hgrc.5.html|configuration file]] to enable the extension by adding following lines:
Line 25: Line 29:
{{{
[extensions]
histedit = ~/path/to/histedit/hg_histedit.py
Line 26: Line 33:
== Usage Scenario ==
The extension adds the {{{histedit}}} command, which takes a {{{revision}}} argument. All changesets from that revision and onwards are selected for history reordering and modification. They are presented as an ordered list with a changeset revision preceded by an action keyword for each line ({{{action revision-id}}}).
Line 27: Line 36:
=== Usage Scenario === If you were to run {{{hg histedit c561b4e977df}}} for a repo with the history graph
Line 29: Line 38:
{{{
@ 3[tip] 7c2fd3b9020c 2009-04-27 18:04 -0500 durin42
| Add delta
|
o 2 030b686bedc4 2009-04-27 18:04 -0500 durin42
| Add gamma
|
o 1 c561b4e977df 2009-04-27 18:04 -0500 durin42
| Add beta
|
o 0 d8d2fcd0e319 2009-04-27 18:04 -0500 durin42
     Add alpha
}}}
an editor would open containing the following text:

{{{
pick c561b4e977df Add beta
pick 030b686bedc4 Add gamma
pick 7c2fd3b9020c Add delta

# Edit history between c561b4e977df and 7c2fd3b9020c
#
# Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
# f, fold = use commit, but fold into previous commit
# d, drop = remove commit from history
#
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
}}}
History rewriting works by reordering changesets so that they reflect a new ordering in the history graph, or by changing the desired action to take on each changeset. The possible actions are one of {{{pick}}}, {{{fold}}}, {{{edit}}} and {{{drop}}}:

 pick:: Simply accepts the changeset as is. This is the default action.
 fold:: Combines a changeset with the previous changeset in the list and opens an editor to edit the commit message.
 edit:: Drops to the command prompt, allowing to edit files freely to commit some changes as a separate commit. When done, any remaining uncommitted changes will be committed as well. When done, run {{{hg histedit --continue}}} to finish this step or {{{hg histedit --abort}}} to abandon the new changes and keep the previous state.
 drop:: Removes the changeset from history.

When changes lead to conflicts then the user is dropped to the command prompt and has the very same options as when the {{{edit}}} action is selected. To accept new changes the {{{hg histedit --continue}}} command is used and to drop them the {{{hg histedit --abort}}} one.

See http://bitbucket.org/durin42/histedit/src/tip/README for a more detailed explanation.
Line 31: Line 80:
CategoryExtension CategoryExtensionsByOthers

Histedit Extension

This extension is distributed with Mercurial 2.3 and later.

Author: Augie Fackler

Repository: https://bitbucket.org/durin42/histedit/

Works with: Mercurial 1.3 and beyond (tests are run against versions seen in the Makefile.)

In core since version 2.3

1. Overview

History editing plugin for Mercurial, heavily inspired by git rebase --interactive.

It allows selecting (pick), combining (fold), rejecting (drop) or modifying (edit) already commited changesets.

2. Configuration

In versions of Mercurial after 2.3, enable the extension by adding the following lines to your configuration file:

[extensions]
histedit =

For older versions, you need to grab the extension source and then configure your configuration file to enable the extension by adding following lines:

[extensions]
histedit = ~/path/to/histedit/hg_histedit.py

3. Usage Scenario

The extension adds the histedit command, which takes a revision argument. All changesets from that revision and onwards are selected for history reordering and modification. They are presented as an ordered list with a changeset revision preceded by an action keyword for each line (action revision-id).

If you were to run hg histedit c561b4e977df for a repo with the history graph

@  3[tip]   7c2fd3b9020c   2009-04-27 18:04 -0500   durin42
|    Add delta
|
o  2   030b686bedc4   2009-04-27 18:04 -0500   durin42
|    Add gamma
|
o  1   c561b4e977df   2009-04-27 18:04 -0500   durin42
|    Add beta
|
o  0   d8d2fcd0e319   2009-04-27 18:04 -0500   durin42
     Add alpha

an editor would open containing the following text:

pick c561b4e977df Add beta
pick 030b686bedc4 Add gamma
pick 7c2fd3b9020c Add delta

# Edit history between c561b4e977df and 7c2fd3b9020c
#
# Commands:
#  p, pick = use commit
#  e, edit = use commit, but stop for amending
#  f, fold = use commit, but fold into previous commit
#  d, drop = remove commit from history
#
0 files updated, 0 files merged, 0 files removed, 0 files unresolved

History rewriting works by reordering changesets so that they reflect a new ordering in the history graph, or by changing the desired action to take on each changeset. The possible actions are one of pick, fold, edit and drop:

pick
Simply accepts the changeset as is. This is the default action.
fold
Combines a changeset with the previous changeset in the list and opens an editor to edit the commit message.
edit

Drops to the command prompt, allowing to edit files freely to commit some changes as a separate commit. When done, any remaining uncommitted changes will be committed as well. When done, run hg histedit --continue to finish this step or hg histedit --abort to abandon the new changes and keep the previous state.

drop
Removes the changeset from history.

When changes lead to conflicts then the user is dropped to the command prompt and has the very same options as when the edit action is selected. To accept new changes the hg histedit --continue command is used and to drop them the hg histedit --abort one.

See http://bitbucket.org/durin42/histedit/src/tip/README for a more detailed explanation.


CategoryExtensionsByOthers

HisteditExtension (last edited 2021-02-01 14:07:53 by muxator)