BUG: Wrong source URL applied when branching from older revision

32 views
Skip to first unread message

Niklas Matthies

unread,
Jan 27, 2021, 11:55:41 AM1/27/21
to TortoiseSVN
TortoiseSVN version: 1.14.0.28885-x64 (most current version)

To reproduce:

1) Create a branch "old" and commit something to it.
2) Move (rename) the branch "old" to "current".
3) Open the log window for "current" (context menu "Show log").
4) Locate the commit from step 1 and select "Create branch/tag from
revision" in the context menu of that commit.
5) Change "To path" to "[...]/new" and submit the dialog ("OK").

=> TortoiseSVN shows an error dialog "Subversion reported an error"
with message "'<path>/current' path not found"

The problem is that the revision we are branching from only exists in
the "old" branch, but TortoiseSVN passes the path of the "current"
branch to SVN instead. This is also visible in the value of "From URL"
in the Copy dialog, which shows the URL of the newest revision in the
log. Judging from the Revision Graph view, TortoiseSVN should be able
to know that the revision to be copied has a different URL. A manual
"svn copy <URL>/old@<old revision> <URL>/new" does work.

Niklas

Stefan

unread,
Jan 27, 2021, 12:14:18 PM1/27/21
to TortoiseSVN
On Wednesday, January 27, 2021 at 5:55:41 PM UTC+1 Niklas Matthies wrote:
TortoiseSVN version: 1.14.0.28885-x64 (most current version)

To reproduce:

1) Create a branch "old" and commit something to it.
2) Move (rename) the branch "old" to "current".
3) Open the log window for "current" (context menu "Show log").
4) Locate the commit from step 1 and select "Create branch/tag from
revision" in the context menu of that commit.
5) Change "To path" to "[...]/new" and submit the dialog ("OK").

=> TortoiseSVN shows an error dialog "Subversion reported an error"
with message "'<path>/current' path not found"

I think this behavior is what we want here, because there's no indication in the log dialog that the url for which the log dialog is shown has changed. So the error clearly tells the user that the path/url for which the log dialog is shown does not exist in the selected revision.
This avoids a branch created from a wrong url.
 

The problem is that the revision we are branching from only exists in
the "old" branch, but TortoiseSVN passes the path of the "current"
branch to SVN instead. This is also visible in the value of "From URL"
in the Copy dialog, which shows the URL of the newest revision in the
log. Judging from the Revision Graph view, TortoiseSVN should be able
to know that the revision to be copied has a different URL. A manual
"svn copy <URL>/old@<old revision> <URL>/new" does work.

And have you noticed how long the revision graph takes to execute?
That's not something I will implement just for creating a branch...

Stefan

Niklas Matthies

unread,
Jan 27, 2021, 5:39:56 PM1/27/21
to Stefan via TortoiseSVN
On Wed 2021-01-27 at 09:14h, you wrote:
>On Wednesday, January 27, 2021 at 5:55:41 PM UTC+1 Niklas Matthies wrote:
>> TortoiseSVN version: 1.14.0.28885-x64 (most current version)
>>
>> To reproduce:
>>
>> 1) Create a branch "old" and commit something to it.
>> 2) Move (rename) the branch "old" to "current".
>> 3) Open the log window for "current" (context menu "Show log").
>> 4) Locate the commit from step 1 and select "Create branch/tag from
>> revision" in the context menu of that commit.
>> 5) Change "To path" to "[...]/new" and submit the dialog ("OK").
>>
>> => TortoiseSVN shows an error dialog "Subversion reported an error"
>> with message "'<path>/current' path not found"
>
>I think this behavior is what we want here, because there's no indication
>in the log dialog that the url for which the log dialog is shown has
>changed. So the error clearly tells the user that the path/url for which
>the log dialog is shown does not exist in the selected revision.
>This avoids a branch created from a wrong url.

Well, as a user it's suprising that the log dialog on the one hand
is able to construct the history across copies, showing revisions with
different URLs, and allows to initiate a copy from such a revision,
but then runs into an error. I understand from your comment on the
revision graph (which displays fairly quickly for me even with a large
number or branches and merges) that the information about the correct
URL is not readily available from the SVN history, so from that point
of view the behavior makes a certain sense. But it's still rather
unexpected from the user's point of view, and arguably could be
handled more gracefully. I suspect that it's a scenario that simply
wasn't considered when the functionality was originally implemented.
(And I fully sympathize with that. :))

Nevertheless, I'd like to find some way to improve the situation,
because branching from an older revision that lived on a different
path, e.g. on an archived or swapped branch, is a fairly frequent
use case in our projects. One possibility would be to make the "From
URL", or its "From path" suffix, editable in the Copy dialog, so that
the user has a chance to adjust it.

Another idea would be to add a Revision Graph action to the context
menu of revisions in the log dialog, and/or to add operations like
Copy (create branch/tag) to the context menu of revision nodes in the
Revision Graph. (I understand the latter would have implications for
updating the graph.) Anything that helps reduce navigation, and having
to remember which operations are available where, would be useful.

Maybe you have other ideas how the operation could be performed more
conveniently, starting from a revision shown in the log dialog.

Niklas

Stefan

unread,
Jan 28, 2021, 12:02:29 PM1/28/21
to TortoiseSVN
On Wednesday, January 27, 2021 at 11:39:56 PM UTC+1 Niklas Matthies wrote:

Well, as a user it's suprising that the log dialog on the one hand
is able to construct the history across copies, showing revisions with
different URLs, and allows to initiate a copy from such a revision,
but then runs into an error. I understand from your comment on the
revision graph (which displays fairly quickly for me even with a large
number or branches and merges) that the information about the correct
URL is not readily available from the SVN history, so from that point
of view the behavior makes a certain sense. But it's still rather
unexpected from the user's point of view, and arguably could be
handled more gracefully. I suspect that it's a scenario that simply
wasn't considered when the functionality was originally implemented.
(And I fully sympathize with that. :))

Well, I've had the same discussion long ago with the svn developers. But there's a reason why that info isn't available.

But: I just found an easier way to get this to work (hint: peg revision).
So as of r29071, you can create a branch from a revision from before a rename.

Stefan

Niklas Matthies

unread,
Jan 29, 2021, 12:01:05 PM1/29/21
to Stefan via TortoiseSVN
That's great news, really appreciated.

I was also wondering whether it shouldn't be possible to track the
paths in the log history via the Copy revisions, as the information
about the source ("from") and target path of the copy is available. At
least that's how I determine the correct path by hand when looking at
the log.

Niklas

Stefan

unread,
Jan 30, 2021, 2:35:42 AM1/30/21
to TortoiseSVN
On Friday, January 29, 2021 at 6:01:05 PM UTC+1 Niklas Matthies wrote:

I was also wondering whether it shouldn't be possible to track the
paths in the log history via the Copy revisions, as the information
about the source ("from") and target path of the copy is available. At
least that's how I determine the correct path by hand when looking at
the log.

but you only get that if you show the log for a path upwards. If you show the log for e.g. branches/myBranch, then you won't get that info for branches/myBranch. Only if you show the log for branches, then you'll get that copyfrom infor for branches/myBranch.

Niklas Matthies

unread,
Jan 30, 2021, 1:19:54 PM1/30/21
to Stefan via TortoiseSVN
I don't think so? Here is an example (you can paste it into cmd.exe):

md c:\svntest
cd c:\svntest
svnadmin create repo
svn mkdir -m "New project" file:///c:/svntest/repo/myproject
svn mkdir -m "Add trunk" file:///c:/svntest/repo/myproject/trunk
svn mkdir -m "Add branches dir" file:///c:/svntest/repo/myproject/branches
svn checkout file:///c:/svntest/repo/myproject/trunk work\trunk
cd work
md trunk\subdir
svn add trunk\subdir
echo aaa > trunk\subdir\example.txt
svn add trunk\subdir\example.txt
svn commit -m "Add subdir/example.txt" trunk
svn copy -m "Create branch" trunk file:///c:/svntest/repo/myproject/branches/branch
svn checkout file:///c:/svntest/repo/myproject/branches/branch branch
echo bbb > branch\subdir\example.txt
svn commit -m "Modify subdir/example.txt in branch" branch
svn move -m "Swapping branch with trunk (1/3)" file:///c:/svntest/repo/myproject/trunk file:///c:/svntest/repo/myproject/temp
svn move -m "Swapping branch with trunk (2/3)" file:///c:/svntest/repo/myproject/branches/branch file:///c:/svntest/repo/myproject/trunk
svn move -m "Swapping branch with trunk (3/3)" file:///c:/svntest/repo/myproject/temp file:///c:/svntest/repo/myproject/branches/branch
svn log -v file:///c:/svntest/repo/myproject
svn log -v file:///c:/svntest/repo/myproject/branches
svn log -v file:///c:/svntest/repo/myproject/branches/branch
svn log -v file:///c:/svntest/repo/myproject/branches/branch/subdir

The log for /myproject/branches/branch/subdir for example consists of
the following three revisions and includes the copy information:

r9: copy /myproject/branches/branch -> /myproject/temp [Swapping branch with trunk (3/3)]
r7: copy /myproject/trunk -> /myproject/temp [Swapping branch with trunk (1/3)]
r4: [Add subdir/example.txt]

From that information, one is able to deduce the correct source path
for e.g. copying from r4:
/myproject/branches/branch/subdir ->
/myproject/temp/subdir (from info in r9) ->
/myproject/trunk/subdir (from info in r7)

That is, one applies the copy information backwards if it is a prefix
of the current path.

It works in the same way when copying from the log of
/myproject/branches/branch (one level up).

The log for /myproject/branches also has the information, but when
copying from there, the info for the previous copies wouldn't apply,
because the respective paths aren't a prefix of "/myproject/branches".
And the result is correct because /myproject/branches itself didn't
change (wasn't copied/moved), hence a copy from an earlier revision
doesn't need a different source path.

Or am I missing something?

Niklas

Reply all
Reply to author
Forward
0 new messages