⇤ ← Revision 1 as of 2006-08-19 03:49:20
554
Comment:
|
1483
Added some examples of changeset filtering.
|
Deletions are marked like this. | Additions are marked like this. |
Line 8: | Line 8: |
=== Using transplant to rewrite changesets === The transplant extension accepts a {{{--filter}}} option, which lets you edit the changelog message and patch before applying it to its destination (they are supplied to the script as {{{$1}}} and {{{$2}}}, respectively). For example, you could add a "Signed-off-by: " header to each changeset with a script like this: {{{ #!/bin/sh cat <<EOF >> "$1" Signed-off-by: Me EOF }}} As a slightly more complicated example, I used the following script to import my transplant extension from a standalone repository into mercurial's {{{hgext}}} folder (transplant uses git-style patches, so a little extra work was required): {{{ #!/bin/sh MESSAGE="$1" PATCH="$2" sed -e's,^\(--- a/\)\|\(+++ b/\),&hgext/,' \ -e'/^diff --git/s,a/\(.*\) b/\(.*\),a/hgext/\1 b/hgext/\2,' \ -e's,^\(rename\|copy\) \(from\|to\) ,&hgext/', \ -i "$PATCH" }}} |
This extension allows you to transplant patches from another branch. It records the original changeset ID in the transplanted changeset, and avoids transplanting previously-transplanted patches. It can also be used to rebase a branch against upstream changes (including dropping changesets that have been adopted upstream).
You can find it at [http://hg.kublai.com/mercurial/transplant/]
Using transplant to rewrite changesets
The transplant extension accepts a --filter option, which lets you edit the changelog message and patch before applying it to its destination (they are supplied to the script as $1 and $2, respectively). For example, you could add a "Signed-off-by: " header to each changeset with a script like this:
cat <<EOF >> "$1" Signed-off-by: Me EOF
As a slightly more complicated example, I used the following script to import my transplant extension from a standalone repository into mercurial's hgext folder (transplant uses git-style patches, so a little extra work was required):
MESSAGE="$1" PATCH="$2" sed -e's,^\(--- a/\)\|\(+++ b/\),&hgext/,' \ -e'/^diff --git/s,a/\(.*\) b/\(.*\),a/hgext/\1 b/hgext/\2,' \ -e's,^\(rename\|copy\) \(from\|to\) ,&hgext/', \ -i "$PATCH"