"Blame" for search deleted blocks instead of created.

124 views
Skip to first unread message

Александр IY

unread,
Mar 19, 2024, 4:26:02 AM3/19/24
to TortoiseSVN
Can i use tool "Blame" for search deleted blocks instead of created? And how?

Johan Corveleyn

unread,
Mar 19, 2024, 5:17:44 PM3/19/24
to TortoiseSVN
On Tue, Mar 19, 2024 at 9:26 AM Александр IY поставщик: TortoiseSVN
<torto...@googlegroups.com> wrote:
>
> Can i use tool "Blame" for search deleted blocks instead of created? And how?

I'm not sure whether TortoiseSVN supports this, but the core SVN
library (and commandline client) can do this as of version 1.9 (for
the client, needs at least 1.8 server). See this section from the 1.9
release notes:
https://subversion.apache.org/docs/release-notes/1.9.html#prospective-blame

Quoting here for convenience:

[[[
The blame command can now show not only when the last change to each
line of a given file was, but also when the next change will be.

For example, to see for each line in revision 3 of README.txt what the
next revision that changed (or removed) that line would be, run svn
blame -r HEAD:3 README.txt. (You may need to pass a peg revision if
the file had been renamed since r3.)

In the blame command, the range -r M:N always means "display
information about the file at revision N". If the range is "forward"
(M<N) then the normal blame algorithm is used, displaying for each
line in the file when it was added or last changed; if the range is
"reversed" (M>N) then the above-described sense is used, describing
for each line in rN when it was first changed (or deleted) after rN
and before rM.

Here is an example, from Subversion's own repository. The autoconf
macro SVN_CHECK_FOR_DUNDER_BUILTINS was present in r1509167 but is not
present in HEAD. The blame command can determine the revision in which
the macro was removed:

% svn blame -r HEAD:1509167 svn-macros.m4

1509168 danielsh AC_DEFUN([SVN_CHECK_FOR_DUNDER_BUILTINS],
]]]

--
Johan

Александр IY

unread,
Mar 20, 2024, 3:12:05 AM3/20/24
to TortoiseSVN
I try run this
svn blame -r 21857:21760 debug.h
and get this answer
svn: E200007: The 'get-file-revs-reversed' feature is not supported by 'svn://.../debug.h'
среда, 20 марта 2024 г. в 01:17:44 UTC+4, Johan Corveleyn:

Daniel Sahlberg

unread,
Mar 20, 2024, 3:19:25 AM3/20/24
to TortoiseSVN
It works very well for me, I'm on a Subversion 1.14.2 server (VisualSVN server 5.3.2). Can you check the version of your SVN server?

In the Blame dialog of TortoiseSVN you just reverse the From and To revision fields, as in Johan's example. You can even use HEAD as the From revision. See attached image (blame.png).

In TortoiseBlame (see tortoiseblame.png) you will get the original text (as in the To revision) and any deleted lines will be marked, in this case I deleted lines 3 to 5 in revision 47.

Kind regards,
Daniel
blame.png

Александр IY

unread,
Mar 20, 2024, 4:56:29 AM3/20/24
to TortoiseSVN
Thnx for answer. but, can not put HEAD to "from" field, because file was moved. "File not found: revision xxx, path yyy

среда, 20 марта 2024 г. в 11:19:25 UTC+4, daniel.l...@gmail.com:

Daniel Sahlberg

unread,
Mar 20, 2024, 4:59:41 AM3/20/24
to TortoiseSVN
onsdag 20 mars 2024 kl. 09:56:29 UTC+1 skrev alexan...@gmail.com:
Thnx for answer. but, can not put HEAD to "from" field, because file was moved. "File not found: revision xxx, path yyy

This is what the "peg revision" is all about - you can say "use file.txt as it was in revision [peg]". However it seems TortoiseSVN doesn't support a peg revision in the Blame dialog - at least not obvious in the user interface.

As a workaround, if you can figure out in which revisions the file was renamed you can try to do the "blame" in several separate sections, one for each name the file has had in its history.

Still - this will not help if you have a Subversion server that is older than the minimum version mentioned in Johan's message. Can you check the version of your Subversion server?

Kind regards,
Daniel
Reply all
Reply to author
Forward
0 new messages