You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Victoria Muntean <vi...@gmail.com> on 2008/06/03 06:57:51 UTC

digging whole history of the file

How can I do (script or svn command) two following things:
    1) for given file x, print series of diffs -rN-1:N for *all* revisions
of the file (fopr every revision that 'svn log x' reports, that is)
    2) for given file x and range of lines M:N in this file, print all
revisions that touched on this region of lines (and optionally,
diffs for that revision for that region only)

For (1), I wonder if there is faster way than parsing svn log x +
bunch of 'svn diff'. This can be really slow.

Thanks
Viki

Re: digging whole history of the file

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 3, 2008, at 01:57, Victoria Muntean wrote:

> How can I do (script or svn command) two following things:
>     1) for given file x, print series of diffs -rN-1:N for *all*  
> revisions
> of the file (fopr every revision that 'svn log x' reports, that is)

> For (1), I wonder if there is faster way than parsing svn log x +
> bunch of 'svn diff'. This can be really slow.

I'd do it just like that.

You can get the list of revisions with:

svn log -q $REPO/path/to/x \
| sed -n 's%^r%%p' \
| awk '{print $1}'

For each revision, run:

svn diff -c $REV $REPO/path/to/x


>     2) for given file x and range of lines M:N in this file, print all
> revisions that touched on this region of lines (and optionally,
> diffs for that revision for that region only)

Not sure how to do this. You can start with:

svn blame $REPO/path/to/x \
| sed -n $M,$Np \
| awk '{print $1}'

This will print the most recent revisions to touch each of the lines  
in the range $M to $N. However, where you go from here is unclear.  
Any of those revisions, or preceding revisions, might have added or  
removed lines. How do you programmatically know where your range of  
lines is in the earlier revision?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org