OK, I'm reopening a topic that's been done to death, I know. I
spelunked in the old mails, though, and I didn't spot anyone suggesting
the resolution I just came upon (with Ben C-S's help), so I'm hoping I
can be glorious and heroic, and not merely annoyingly repetitive.
OTOH, there's a lotta history here, and I probably just missed it. Oh,
For the keyword matchers among us: this is not, by the way, the
question of whether diff should be sensible about diffing over
committed copies (issue 1093, now fixed in 1.1).
The problem I'm talking about is: what should diff do when the WC has
scheduled-copy (but perhaps not further modified) files?
Short form: I suggest we add two switches:
--show-copies produces lines like what "svn stat" shows ("A +
if there have been tweaks since the copy, a
is also shown
--verbose causes a diff-against-empty-file also to appear
not sure of the right answer in the presence of
There are, I believe, two basic opinions:
One opinion (held, among others, by the present implementation) is that
"svn diff" in this situation should show me "the changes I've recently
made." Since these files copied into this wc from elsewhere have not
been modified by "me", diff should not mention them. In an
over-simplification which I do *not* mean disparagingly, but only
present so I can have a simple handle on the idea, I'll call this the
"what have I typed" philosophy.
Another opinion (naturally enough, held by me), diff should show me
"the changes I'm about to inflict on the world with my commit." Since
this is my own opinion, I can be not only convenient but even
disparaging in calling this the "show me what I'm about to do"
Of course, there are valid reasons to want either one of these
questions answered, or there wouldn't be a difference of opinion.
Since we now have an implementation in circulation that provides one
philosophy, I do not recommend we change the default behavior. But I do
recommend we add a switch that provides the other behavior, and I
present not only the proposal and a switch name to do the deed, but
what I hope is a coherent model that will make all sides, and new users
as well, like the new "diff" even better than the old.
I think there's a common understanding of "diff" here, at a suitably
hand-wavey level, and it's in the general "what I changed"
neighborhood. The problem is that these files copied in from elsewhere
are ambiguous by this test. We may generally assume that they've
already been verified as goodness over in that other branch whence I
copied them, or I wouldn't have done the copy. And I'm not really
responsible for their detailed content. And (very important), if it
happens that I first copied them, and then tweaked them a little bit, I
really *am* responsible for the tweaks, and I think all would agree it
would be swell if diff would highlight the tweaks a bit.
So much for consensus; what shall we do, then, about the unmodified,
I note that "svn diff"'s output does not, even today, consist solely of
"modified file text." If you've changed props, you get a delta
description modeled upon the file-delta description, but definitely
different. I propose an additional not-quite-like-file-delta output
Without either switch, behavior is unchanged (good for all those people
writing scripts that parse diff output).
With only "--show-copies", we have a kind of compromise: it's "what
have I typed" enough not to bother me with those file contents I copied
over, and yet it's "what I'm about to do" enough to at least remind me
I did that. More importantly, if I've tweaked a copied file, we would
still get the text-base diff we already get today: first the "A +
filename" line, and then the additional delta.
With "--verbose", we get full file text for copies. I think (but this
is the least confident of my suggestions) that we should not also show
the text-base delta here; if there have been tweaks, we should show the
full file text as it is now, tweaks and all. I might be wrong about
that. Maybe we should show full text of the copied version (i.e., the
text-base), and then delta for tweaks. Someone who likes the "what I
typed" philosophy should probably comment here.
There is presently no "--verbose" switch to diff, and without
"--show-copies" there would continue to be no meaning to it; if this
inorthogonality bothers anyone, we might think about a broader meaning
of "--verbose" in the diff context, or we might use the (mutually
exclusive) option-pair "--show-copies" and "--show-full-copies".
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Fri Sep 3 21:02:18 2004