[BUG] patch.py not portable to windows

John A Meinel john at arbash-meinel.com
Fri Jul 1 19:33:26 BST 2005


I realize we don't use it much yet, but while working with Aaron on the
changeset code, I started looking into the diff & patching code.

Anyway, inside of that code, he spawns patch in order to apply patches
to files. Unfortunately, he uses popen2.Popen3() which does not exist on
windows. (patch may not exist on windows, but I'm not worrying about
that case yet).
This is one of the motivations to move to using subprocess since it
really cleans up process spawning.

In the long term, it would be nice to switch to perhaps a python
implementation of patch, something that could keep everything in memory,
rather than having to write out a bunch of temporary files. Right now,
you have to decompress the store data, write that to a file, then spawn
patch and pipe in the changes and create a new file, the read that back
in, and delete the other files.

I know we have the 'mdiff.py' script, though that is fairly poorly
written with no documentation and single letter variables. But I don't
think that handles unified diffs anyway.

Is there interest in writing a built-in patch? It wouldn't have to be a
super-fancy one, since most of the use cases are for exact patching. Any
fuzzy patching is generally done by the merge code (and diff3 or patch).

It seems like you could write a unified diff patcher without too many
lines of python. It probably wouldn't try as hard as patch might.

I suppose we need to come up with some sort of consensus if we want to
have things work under windows. Even if we just recommend installing
some version if diff & patch, we still can't use the Popen3/Popen4
classes in popen2.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050701/8fba1d7b/attachment.pgp 


More information about the bazaar mailing list