Size: 1597
Comment: add transplant invocation to example.
|
Size: 1436
Comment: removed URL - transplant is bundled now.
|
Deletions are marked like this. | Additions are marked like this. |
Line 6: | Line 6: |
You can find it at [http://hg.kublai.com/mercurial/transplant/] |
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).
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):
import.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"
I then did the import like so:
hg transplant -n -s ../transplant --filter import.sh 0:tip