[oe] mtnpatch (updated)

cyril Romain c.romain at laposte.net
Sun Mar 11 14:59:12 UTC 2007


Justin Patrin wrote:
> Just thought I'd let everyone know that I just cherrypicked my first
> revision with mtnpatch.py. I made some efl/e17 updates to .dev and
> edited one file, made a diff, and applied the diff to .oz354x with
> mtnpatch.py. It worked like a charm.
>
> For those that missed it, I have checked in mtnpatch.py into
> org.openembedded.dev in contrib/. I have also switch to using a regex
> instead of split() so that whitespace in filenames should be correctly
> taken care of.
>
> The script is used like this:
>  mtn diff -r ParentRev -r RevToCherryPick > file.patch
>  cd /branch/to/cherrypick/to
>  contrib/mtnpatch.py file.patch
> Look at the output to make sure it's sane
>  contrib/mtnpatch.py file.patch | sh
>  mtn ci
Maybe I've just missed the right mtn command reading the documentation, 
but as I'm submitting some patches/recipes for OE metadata, I'd like to:
 1. test that my 'mtn diff' patches successfully apply on a up-to-date 
metadata tree without any local modifications.
 2. apply some patches to another development tree.

And this script is "almost" what I'm looking for :)
"Almost" because it does not takes file/directory drop order into 
account, i.e. "mtnpatch.py the.patch | sh" can fail.
For example if mtnpatch dumps:
---
mtn drop -e packages/quilt/files/install.patch
mtn drop -e packages/quilt/files
---
And if you run these commands in that order, you get "mtn: misuse: 
cannot remove packages/quilt/files/, it is not empty"

In attachment, an updated version of mtnpatch.py with the following 
improvements:
 1. output command are sorted, so that 'mtnpatch.py my_patch.patch | sh' 
should now succeed in all cases, hopefully :)
 2. help (-h, --help) option added, and usage message is printed on misuse
 3. reverse mode (-R option) can be also set with --reverse
 4. the reverse option is used to unapply the patch. The dropped files 
are reverted (not added), but maybe it is not what you, Justin, wanted 
to do with -R ?


Best regards,

  cyril

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mtnpatch.py
Type: text/x-python
Size: 3369 bytes
Desc: not available
URL: <http://lists.openembedded.org/pipermail/openembedded-devel/attachments/20070311/189a3e11/attachment-0002.py>


More information about the Openembedded-devel mailing list