[BioPython] Patches (was: GenBank Parser and large files?)

Jan T. Kim jtk at cmp.uea.ac.uk
Wed Mar 16 09:26:13 EST 2005


On Wed, Mar 16, 2005 at 12:27:02PM +0000, Peter wrote:
> Stephan Herschel wrote:
> >Hi Peter,
> >
> >Thanks for the the fast solution! (I guessed that I could not be the
> >only one having this problem ...)
> >
> >Apparently I applied the patch successfully - only the 'Reversed
> >patch'- message was confusing - as you can see here:
> 
> Yeah - that was the first time I ever created a patch file, and in the 
> absence of any instructions on the BioPython developers list, I just 
> improvised:
> 
> diff my_version.py vcs_version.py > patch.txt
> 
> Would the reversed patch messages would go away if I had done this?
> 
> diff vcs_version.py my_version.py > patch.txt

Yes. The direction of patches is old -> new, by convention. If the patch
program can tell whether the order was reversed, and it prints the
'Reversed patch' message.

With a plain diff, as you sent it, patch can reliably tell whether the
file being patched is the "old" or the "new" version, so there should not
be any problem.

> >(Stripping trailing CRs from patch.)
> 
> Those are because I did this on Windows.

Most Windows editors can switch the extraneous CRs on or off these
days. But again, this should not cause any serious problem.

> >can't find file to patch at input line 1
> >
> >Perhaps you should have used the -p or --strip option?
> 
> The --strip option doesn't exist on my version of diff, and -p is an 
> alias for --show-c-function (Show which C function each change is in) 
> which doesn't seem relevant:-

These options pertain to patch: -pnum or --strip=num: Strip the smallest
prefix containing num leading slashes from each file name found in the
patch file.

Plain diffs tend to trigger some informational messages or requests for
interactive input (request for the file to be patched etc.) when fed into
patch, because this information is not contained in a plain diff. Unified
context diffs contain this information, as seen in the (very minor)
patch I recently submitted:

    diff -Naur biopython-1.40b/Bio/expressions/genbank.py biopython-1.40b-hacked/Bio/expressions/genbank.py
    --- biopython-1.40b/Bio/expressions/genbank.py  2004-03-18 00:53:24.000000000 +0000
    +++ biopython-1.40b-hacked/Bio/expressions/genbank.py   2005-03-10 11:34:37.134325592 +0000

> diff (GNU diffutils) 2.8.7
> (The cygwin version running on Windows)

This should accept the options -Naur (-N: treat new files as empty in other
directory, -a: treat lines as text, -u: write unified format, -r: recursive).

This allows changes that have affected multiple files to be rolled into one
patch (which wasn't the case here), but once you pick up this habit, you'll
use it by default (like I did).

> >Tested the parser - works just fine!
> 
> Great.

I'll give it a try as soon as I get around to do so too -- in fact, I
must confess that I've started using ad hoc hacks to work with eukaryotic
pseudochromosome files since an attempt to parse one with Biopython didn't
terminate in more than 24 hours...

Best regards, Jan
-- 
 +- Jan T. Kim -------------------------------------------------------+
 |    *NEW*    email: jtk at cmp.uea.ac.uk                               |
 |    *NEW*    WWW:   http://www.cmp.uea.ac.uk/people/jtk             |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*


More information about the BioPython mailing list