Hi,
I have investigated the issue mentioned in the users group in the thread
with the same subject as above [1]. I'm providing an analysis and a few
different patches (choose 1 of those).
The root cause is that CopyUrlsCommand add \n at the end of the copied
paths. It has the capability to copy multiple paths and URLs so I believe
this is a good thing for consistency. However it could be modified [2] to
only emit the \n if more than 1 path is being copied. I believe this is the
least sensible path, both since it changes external behaviour.
Another solution could be to adjust the consumer of the URL, in
MergeCommand.cpp, to remove any trailing newline from the URL. See [3].
However I realised that this behaviour only exists on "Merge a range of
revisions". If doing a "Merge two different trees", the trailing newline is
filtered already in the dialog. On inspection MergeWizardRevRange.cpp does
m_urlCombo.GetWindowText(sUrl) while MergeWizardTree.cpp does
m_urlCombo.GetString(). (MergeWizardTree.cpp actually does both, with
GetWindowText() to check if the text is a URL). I've made a patch [4] to
have MergeWizardRevRange.cpp use GetString() just like MergeWizardTree.cpp.
It is actually reversing part of the changes in r24686 since previously.
This is the patch I personally prefer, it seems cleaner to remove the \n on
the source, it also aligns with hor "Merge two different trees" behave.
Kind regards,
Daniel
[1] https://groups.google.com/g/tortoisesvn/c/PHloNjOHids
[2] Attachment CopyUrlsCommand_DontSetLFOnSinglePath.txt
[3] Attachment MergeCommand_RemoveTrailingNewlineFromUrl.txt
[4] Attachment MergeWizardRevRange_GetUrlByGetString.txt
--
You received this message because you are subscribed to the Google Groups
"TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tortoisesvn-dev/2310c036-5e36-484b-84d1-4217b844a3fdn%40googlegroups.com.
---
C:/Users/danie/AppData/Local/Temp/MergeWizardRevRange.cpp-revBASE.svn001.tmp.cpp
fre apr 30 18:29:07 2021
+++ C:/Devel/tortoisesvn/src/TortoiseProc/MergeWizardRevRange.cpp tor maj
26 22:21:18 2022
@@ -126,0 +127 @@ LRESULT CMergeWizardRevRange::OnWizardNext()
+ sUrl = m_urlCombo.GetString();
--- C:/Users/danie/AppData/Local/Temp/MergeCommand.cpp-revBASE.svn001.tmp.cpp
fre apr 30 18:29:07 2021
+++ C:/Devel/tortoisesvn/src/TortoiseProc/Commands/MergeCommand.cpp tor maj
26 22:10:50 2022
@@ -65,0 +66,4 @@ bool MergeCommand::Execute()
+ // URL copied from the right-click context menu ends in \n. Remove it
to avoid
+ // errors accessing the repo with a URL ending in %0A.
+ if (wizard.m_url1.Right(1) == '\n')
+ wizard.m_url1 = wizard.m_url1.Left(wizard.m_url1.GetLength() - 1);
--- C:/Users/danie/AppData/Local/Temp/CopyUrlsCommand.h-revBASE.svn001.tmp.h
fre apr 30 18:35:34 2021
+++ C:/Devel/tortoisesvn/src/TortoiseProc/Commands/CopyUrlsCommand.h tor maj
26 22:08:54 2022
@@ -38 +38,2 @@ class CopyUrlsCommand : public Command
- for (int i = 0; i < pathList.GetCount(); ++i)
+ const auto count = pathList.GetCount();
+ for (int i = 0; i < count; ++i)
@@ -41 +42,2 @@ class CopyUrlsCommand : public Command
- sUrls += L"\n";
+ if (count > 1)
+ sUrls += L"\n";