[PATCH 0 of 3] mq.patchheader refactoring and more

Patrick Mézard pmezard at gmail.com
Mon Feb 15 13:20:34 CST 2010

Le 13/02/10 02:11, Steve Losh a écrit :
> This series of patches is an attempt to clean up the patchheader class in
> mq.py. My goal is to make it more readable and more robust when dealing with
> various types of patch headers.
> The first patch in the series just adds any() and all() functions to
> mercurial/util.py. These are built-in functions that were added in 2.5 so we
> can't use them yet. They're very useful and can make code much easier to read.
> The second patch is the actual refactoring of patchheader. The documentation I
> added to the module's docstring probably needs some work, and I'm sure I
> missed some coding-style things along the way. I updated a lot of the test
> output, but that was only to reflect the new (more consistent) ordering the
> the headers -- no functionality should have changed.
> The third patch combines test-mq-header-from and test-mq-header-date into on
> file: test-mq-headers. Now that the Parent IDs are included in hg-style MQ
> patches it makes more sense to test all the headers at once so we can cover
> all the possible combinations.
> This third patch also completely refactors the header tests to provide much,
> much more comprehensive testing of the possible combinations of headers.
> Unfortunately it increases the run time of the header tests from ~22 seconds
> to ~74 seconds (on my laptop).
> I'm not sure if that's too much of a performance hit for these tests that
> cover a less-than-critical part of the code. Even if this patch doesn't go
> into core it I'm glad I did it to test my patchheader refactoring.

Since it does not fix existing bugs, I suggest we wait for the end of code freeze to update and push these changes.

Patrick Mézard

More information about the Mercurial-devel mailing list