Why are unified diffs only "grudgingly" accepted?

Thomas Wouters thomas at xs4all.net
Sun Aug 6 12:20:11 EDT 2000


On Sun, Aug 06, 2000 at 09:37:47AM -0400, François Pinard wrote:
> [Moshe Zadka]
> > [unattributed]
> > >     We like context diffs. We grudgingly accept unified diffs.
> > >     Straight ("ed-style") diffs are right out!
> 
> > > I understand why ed-style diffs are out, but why the are context diffs
> > > favoured over unified? I've always found unified (-u) diffs to be
> > > infinitely easier to read (by human eyes/brain) than context (-c) diffs.
> 
> > Guido doesn't. That's reason enough really -- it's the same as asking
> > "why should I follow the Python style guidelines?": no real reason for
> > that style, but Guido likes it, and there has to be some consistency.
> 
> I understand that `ed-style' diffs are hardly useful, and that we can
> expect users to understand this.  However, between `-c' and `-u' lies
> a matter of preference, and I always found sad having to know that this
> maintainer strictly prefers `-u', while this other strictly prefers `-c'.
> When one relates with many maintainers, it becomes pretty cumbersome to
> remember the little mania and methods for each of them.

The readability of unified versus context diffs is mostly a matter of
personal opinion, but I personally can't see how you can think unified
diffs, especially large ones, are easier to read than their context
brothers. Unified diffs have all info in one 'block', mixing both 'new' and
'old' versions, which makes it hard to see at one glance what the file
looked like, and what it's turning into. Howver, context diffs have *two*
blocks, one with the 'old' version, with lines that are going to be removed
marked by '-' and lines that are going to be changed by '!', and a 'new'
version, with '+' and '!' markers to mirror the one in the 'old' version.

I used to think unified diffs were better than context ones, but not since I
discovered how readable context diffs are for blocks of code ! They are only
a few lines larger than unified diffs when doing only additions or removal
(because of the extra header), and for the more complicated case the extra
lines sure as hell pay off.

> As I wrote a few times in the past, it progressively becomes more difficult
> for users to report bugs than it used to be, and this is not good news to me,
> as it taints a tiny bit the pleasure of using free software.  It also conveys
> the message that our-maintainer-time-is-so-precious-that-yours-is-not-really.
> I'm a maintainer and a user; and I care about my time whatever hat I bear!

Like I said before, it's *no use* sending in patches if noone has time to
check them in. I think you're being very unfair to Guido and the others who
do most of the work on Python: the difference between sending in a context
diff and a unified diff is *one character* in a command line, and they *do*
accept unified diffs. The difference between SourceForge or a mailinglist
without a searchable archive is huge in their time, however, and several
people have offered to upload your patches if you can't do it yourself.

Would you prefer it if noone had time to work on Python ?

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list