Restore a unified diff

Mike Meyer mwm at mired.org
Wed Jan 5 14:21:46 EST 2005


Tim Peters <tim.peters at gmail.com> writes:

> [Nick Allen]
>> Unfortunately, restore does not do the same for unified_diff.  I do
>> not see any similar function that is intended for unified_diff.  Does
>> anyone know how to "restore" from a unified diff generated delta?
>
> That's in general impossible, since unified diffs generally omit most
> lines that compared equal to begin with.  Unified and context diffs
> are, in part, compression gimmicks, showing only what changed plus a
> bit of context.  ndiff shows everything, so can restore everything
> too.

The unix patch utility seems to do a fine job of handling the unix
unified and context diffs. Unified is the preferred format for the
open source projects I contribute patches to.

Possibly this is some other form of "unified diff" than what you get
from "diff -u" on a Unix system?

     <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list