patch.py refactoring - new API proposal

Bartosz SKOWRON getxsick at gmail.com
Sat Dec 13 21:49:52 CST 2008


Hi,

as some of you may know, me and my colleague Michał put the effort on
refactoring patch.py module mentored by Patrick Mezard.
Here is a proposal of new API.

The fist step, is to extract applydiff() to an interface with isolated
functions.

Patchable:
 open
 close
 read
 write
 write_rej
 print
 applyhunk
 remove

This interface should be pre-implemented by some backends like
in-memory or working directory.

Those new interefaces should be implemented by exsisting (and future)
states: hunk, file, git.


After that, applydiff() should be rewritten to manage Patchable's
objects and keep the flow. iterhunks() should be removed in this
state.

Any suggestions?

best regards



More information about the Mercurial-devel mailing list