Revert-changes: "Unable to reconstruct working copy path" with "^" in repo URL

44 views
Skip to first unread message

Julian Foad

unread,
Jan 10, 2020, 10:13:43 AM1/10/20
to torto...@googlegroups.com
SUMMARY:

The "revert changes" option in the log viewer's changed paths list
throws an error "Unable to reconstruct working copy path", when there is
a URI-encoded "^" character in the repository root URL.

We (Assembla) use repository root URLs containing a caret character
('^', '%5E') for many repositories; it is not something we could easily
avoid. I am sending this report on behalf of a customer who ran into
the problem when moving their repository onto our hosting. From their
point of view it looks like a problem with our hosting, which is awkward.

SYSTEM INFO:

- TSVN 1.13.1 (also seen on 1.12.2 and 1.10.5)

- Repository root URL contains a (URI-escaped) "^" character.
Repo URLs used in production are in this form:
https://subversion.assembla.com/svn/something%5Esomething
Repo URLs used for reproducing this bug:
file:///C:/something/something%5Esomething

- Svn server version: is the SVN client library version in TSVN, when
reproducing with a local file:// URL.

STEPS TO REPRODUCE:

Create a repo and checkout a WC using this script (also attached as
'revertchanges1.bat.txt'):
[[[
set "REPO_DIR=C:\svn-test-dir\repo1^^A"
set "REPO_URL=file:///C:/svn-test-dir/repo1^^A"
set "WC_DIR=C:\svn-test-dir\wc1"

mkdir c:\svn-test-dir
svnadmin create %REPO_DIR%
svn checkout %REPO_URL% %WC_DIR%
cd %WC_DIR%
svn mkdir trunk
echo "hello" > trunk/file.txt
svn add trunk/file.txt
svn commit -m "Add a file"
echo "changed" > trunk/file.txt
svn commit -m "Modify a file"
cd C:\svn-test-dir\wc1\trunk
svn del file.txt
svn commit -m "Delete a file"

svn info
]]]

In the folder 'C:\svn-test-dir\wc1', using TSVN:
- open the context menu on the 'trunk' entry
- select 'Show log'
In the Log Messages dialog:
- select revision 2 ('Modify a file'),
- open context menu of changed-path 'file.txt' (Action is 'Modified')
- select 'Revert changes from this revision'

EXPECTED RESULT:

- TSVN should display a "Reverting changes" confirmation dialog.

ACTUAL RESULT:

- TSVN displays an error dialog, saying,
"""
Something went wrong
Unable to reconstruct working copy path!
This can happen if the file has been renamed.
Please start the log dialog on this specific file alone and then
revert the changes from the top pane in the log dialog.
"""

INVESTIGATION:

The result is also the same if we select a changed path with Action =
'Added' (r1 in the repro).

If we select a changed path with Action = 'Deleted' (r3 in the repro),
then we get a different result with a clue in it:
"""
Reverting changes
Do you want to revert all changes in
C:\svn-test-dir\w%5EA\trunk\file.txt
which were made in this revision?
"""

In this test case the WC root path was
C:\svn-test-dir\wc1
the WC folder containing the selected file "File1.txt" was
C:\svn-test-dir\wc1\trunk
the repo URL of that folder was
file:///C:/svn-test-dir/repo1%5EA/trunk

It looks like the WC path was constructed wrongly, including not enough
of the WC root path or selected folder path, and including too much of
the repository URL.

The relevant source code is in LogDlg.cpp:

https://osdn.net/projects/tortoisesvn/scm/svn/blobs/28686/trunk/src/TortoiseProc/LogDialog/LogDlg.cpp

The error dialog is displayed in ExecuteRevertChangedPaths, line 7416.
The bad WC path 'pCmi->wcPath' is constructed in
GetContextMenuInfoForChangedPaths starting at line 7110.

It looks like it is comparing a URI-encoded 'fileUrl' against a
non-encoded 'sUnescapedUrl'.

Although I can read the source code, I don't have a development/debug
environment available to examine the variables or develop a fix.

Can anyone please confirm this and/or fix it?

Thank you.
- Julian Foad

Stefan

unread,
Jan 10, 2020, 1:34:18 PM1/10/20
to TortoiseSVN
So yes, there is a small bug in TSVN here. But please see inline because even with the bug resolved, the issue still remains...
here, you're deleting the c:\svn-test-dir\wc1\trunk\file.txt file. So it does not exist in HEAD anymore.
 

svn info
]]]

In the folder 'C:\svn-test-dir\wc1', using TSVN:
- open the context menu on the 'trunk' entry
- select 'Show log'
In the Log Messages dialog:
- select revision 2 ('Modify a file'),
- open context menu of changed-path 'file.txt' (Action is 'Modified')
- select 'Revert changes from this revision'

EXPECTED RESULT:

- TSVN should display a "Reverting changes" confirmation dialog.

ACTUAL RESULT:

- TSVN displays an error dialog, saying,
   """
   Something went wrong
   Unable to reconstruct working copy path!
   This can happen if the file has been renamed.
   Please start the log dialog on this specific file alone and then
   revert the changes from the top pane in the log dialog.
   """


Since the file.txt does not exist anymore, you can not revert changes from revision 2: in that revision, file.txt was modified. So you can not undo those modifications to a file that doesn't exist anymore.
As the dialog shown explains: you have to revert not just rev 2 but from HEAD up (and including) r2.
correct observation of the bug. It's indeed the mismatched comparison of unescaped and escaped urls that's the problem. But as mentioned above: reverting changes for a file that does not exist anymore in the wc is not possible.

fix committed in r28713

Stefan

Julian Foad

unread,
Jan 13, 2020, 5:44:35 AM1/13/20
to torto...@googlegroups.com
Stefan via TortoiseSVN wrote:
> So yes, there is a small bug in TSVN here.
> fix committed in r28713

Thank you for the quick fix, Stefan!

For the record: we have confirmed that this bug also affected repo URLs
without a "^". (Of course you will already know that.)

Any idea roughly when a new release might be available for us to test?


> even with the bug resolved, the issue still remains...

Not really; only in that artificial test case, where the file ended up
in a Deleted state. The real case is not like that. (I should have
made two separate test cases for clarity.)

Thanks,
- Julian

Stefan

unread,
Jan 13, 2020, 10:41:23 AM1/13/20
to TortoiseSVN


On Monday, January 13, 2020 at 11:44:35 AM UTC+1, Julian Foad (Assembla) wrote:
Stefan via TortoiseSVN wrote:
> So yes, there is a small bug in TSVN here.
> fix committed in r28713

Thank you for the quick fix, Stefan!

For the record: we have confirmed that this bug also affected repo URLs
without a "^".  (Of course you will already know that.)

Any idea roughly when a new release might be available for us to test?

puf....@gmail.com

unread,
Jan 20, 2020, 1:28:20 PM1/20/20
to TortoiseSVN
Hi,

We have tested it and it's working as expected. Thanks for the quick fix!

May I know when will this be released?

Cheers,
Toshi

Stefan

unread,
Jan 20, 2020, 3:18:37 PM1/20/20
to TortoiseSVN
The next TSVN release will be in sync with the next svn release.
Don't know however when that will be, sorry.

Stefan
Reply all
Reply to author
Forward
0 new messages