[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

"svn blame" with a specified revision

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-10-14 01:16:49 CEST

"svn blame" is great. It's a really big step to nail the last remaining publically-obvious missing CVS feature. So don't interpret this as a complaint; its just a bit of development work. I already saw a mention of "blame" not working well with revision specifiers, but I can't find that now.

At the moment (r7405), "svn blame" doesn't behave very well when "--revision" is specified. I was going to start reporting what it does do, but then I switched tack to evaluate what we _want_ it to do. Can we write a short specification of what "blame -rARG" means, perhaps to appear in the book and/or the help? After careful consideration, and thinking about the alternatives, I'd suggest:

Proposal:
[[[
"svn blame -rX FILE"
  - Give the origin of each line of the file "FILE@X".

"svn blame -rX:Y FILE" (X >= Y)
  - Give the origin of each line of the file "FILE@X" that originated in or after revision Y, or an "unknown origin" indication if the line originated before revision Y.

"svn blame -rX:Y FILE" (X < Y)
  - Error.

"svn blame FILE"
  - Shorthand for "svn blame -rHEAD FILE".

The "unknown origin" indication is "-" for the revision number and "-" for the author.
]]]

Notes and explanations:

This definition of "-rX" is the same as in "cvs annotate". I think the current "svn blame" interprets "-rX" as "annotate FILE@HEAD from rX to rHEAD" which is, in my opinion, confusing, partly because FILE@BASE could equally well be expected or desired, but mainly because of the expectation that (only) the lines that existed in FILE@X will be shown.

The reasons for "-rX:Y" meaning "FILE@rX back to rY" are:
  - It fits with the "-rX" case: together they can be desribed as "-rX[:LIMIT]". Otherwise, while "-rX" describes FILE@X, "-rX:Y" would describe FILE@Y, which is harder to teach and to learn.
  - This is an inherently backward-looking operation, so having the larger number first is OK, unlike "diff" and "log" which can be thought of as going either way and therefore accept a reversible revision range.

The reason for (X < Y) being an error is that it would introduce a confusion about which version of the file is to be annotated: FILE@X or FILE@Y. It would be possible to write a forward-looking annotator which says who was the next person to change each line of this old file, and, for that, "-rX:Y" (X < Y) would be appropriate.

This definition of "-rX:Y" includes changes made between revision (X-1) and (X). I am not sure whether it should. I would like it to be consistent with other commands, but there is already an inconsistency between "log" and "diff". This "inclusive" definition matches "log" and the implementation must remember to fetch the diff that created revision X from a previous revision as well as those between X and Y.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 14 01:16:13 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.