[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Monotone-devel] Re: mtnpatch (updated)
From: |
Nathaniel Smith |
Subject: |
Re: [Monotone-devel] Re: mtnpatch (updated) |
Date: |
Sun, 11 Mar 2007 18:20:35 -0700 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Sun, Mar 11, 2007 at 03:59:12PM +0100, cyril Romain wrote:
> 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 :)
Not sure I understand what exactly you're trying to do here, and would
be curious if 'mtn pluck' would work for you, or if not, why not...
> "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 :)
It won't. To handle arbitrary add/drop/renames, you have to do
somewhat complicated things. The simplest example is:
rename a b
rename b a
(i.e., interchange the two files.) Obviously there's no order you can
put those in that will work, you need to move one out of the way to a
temporary location first...
Other complicated cases involve intermixing different file operations,
like
add b
rename a/foo b/foo
drop a
add b/foo/baz
Here you have to do things in this order in particular, or it won't
work.
This is all solvable with the right sort of abstraction, I think there
are some comments about it in cset.cc, but it requires a trick. The
best _documentation_ of the trick is probably this blog post that
Aaron Bentley wrote:
http://mebentley.blogspot.com/2005/12/tree-transforms-on-posix-filesystems.html
I don't know that you care, though :-).
-- Nathaniel
--
The Universe may / Be as large as they say
But it wouldn't be missed / If it didn't exist.
-- Piet Hein