lördag 28 maj 2022 kl. 10:24:21 UTC+2 skrev Stefan:

> thanks for all your patches!
> I went with option 4, I agree that's the best solution.
>

(y), LGTM.

I realise you reworked the patch a bit and removed GetWindowText altogether 
(I thought about it but figured there was probably a reason it was used). 
For the matter of consistency, should the same be applied to 
MergeWizardTree? Something along the lines of [1]?
 

> one question though: how did you create the patch files? They have 
> absolute paths 
> (e.g. C:/Users/danie/AppData/Local/Temp/MergeWizardRevRange.cpp) and no 
> context lines at all.
>

Commit dialog.  Double click changed file (=> Opens TortoiseMerge). File, 
Create patch file. Save.

The attached files in this message are created from the Commit dialog, 
selected the file(s), right click and Create patch. It contains three 
context lines. (I believe this patch is created by TortoiseProc.exe?). 
However it contains no paths at all which is a bit strange since I started 
from a commit dialog in the root of the WC [4], so the commit dialog at 
least know the relative paths within the WC. 

TortoiseMerge seems to look at Software\TortoiseMerge\ContextLines (from 
the settings dialog), which I havn't set, and thus gets a default value of 
0 from src/TortoiseMerge/MainFrm.cpp line 2950. I'm attaching a proposed 
patch [2] to change this to three, which seems a better default. There were 
a few additional places in the code looking at the above reg key, but with 
a default value of 1 that I didn't change. I'm not sure if it makes sense 
to have different default values for the same registry key. The attached 
patch [3] should change the default setting in the Settings dialog to 3 as 
well. 

/Daniel


[1] MergeWizardTree_DontUseGetWindowText.txt 
[2] TortoiseMerge_Unidiff_Default_ThreeLinesContext.txt
[3] SetMainPage_Default_ThreeLinesContext.txt
[4] commitdialog.png

-- 
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/3bb873c0-bc14-437e-a89c-41b87339392bn%40googlegroups.com.
Index: SetMainPage.cpp
===================================================================
--- SetMainPage.cpp     (revision 29397)
+++ SetMainPage.cpp     (working copy)
@@ -36,7 +36,7 @@
     , m_bSmartTabChar(FALSE)
     , m_nTabSize(0)
     , m_bEnableEditorConfig(FALSE)
-    , m_nContextLines(0)
+    , m_nContextLines(3)
     , m_bIgnoreEOL(FALSE)
     , m_bOnePane(FALSE)
     , m_bViewLinenumbers(FALSE)
@@ -63,7 +63,7 @@
     m_regAutoAdd             = CRegDWORD(L"Software\\TortoiseMerge\\AutoAdd", 
TRUE);
     m_regMaxInline           = 
CRegDWORD(L"Software\\TortoiseMerge\\InlineDiffMaxLineLength", 3000);
     m_regUseRibbons          = 
CRegDWORD(L"Software\\TortoiseMerge\\UseRibbons", TRUE);
-    m_regContextLines        = 
CRegDWORD(L"Software\\TortoiseMerge\\ContextLines", 0);
+    m_regContextLines        = 
CRegDWORD(L"Software\\TortoiseMerge\\ContextLines", 3);
 
     m_bBackup              = m_regBackup;
     m_bFirstDiffOnLoad     = m_regFirstDiffOnLoad;
Index: MainFrm.cpp
===================================================================
--- MainFrm.cpp (revision 29397)
+++ MainFrm.cpp (working copy)
@@ -2947,7 +2947,7 @@
             return; // user cancelled
     }
 
-    CRegStdDWORD regContextLines(L"Software\\TortoiseMerge\\ContextLines", 0);
+    CRegStdDWORD regContextLines(L"Software\\TortoiseMerge\\ContextLines", 3);
     CAppUtils::CreateUnifiedDiff(origFile, modifiedFile, outputFile, 
regContextLines, ignoreEOL, true);
     CAppUtils::StartUnifiedDiffViewer(outputFile, 
CPathUtils::GetFileNameFromPath(outputFile));
 }
Index: TortoiseMerge.cpp
===================================================================
--- TortoiseMerge.cpp   (revision 29397)
+++ TortoiseMerge.cpp   (working copy)
@@ -454,7 +454,7 @@
             }
             if (!outfile.IsEmpty())
             {
-                CRegStdDWORD 
regContextLines(L"Software\\TortoiseMerge\\ContextLines", 0);
+                CRegStdDWORD 
regContextLines(L"Software\\TortoiseMerge\\ContextLines", 3);
                 CAppUtils::CreateUnifiedDiff(origFile, modifiedFile, outfile, 
regContextLines, true, false);
                 return FALSE;
             }
Index: MergeWizardTree.cpp
===================================================================
--- MergeWizardTree.cpp (revision 29397)
+++ MergeWizardTree.cpp (working copy)
@@ -201,16 +201,15 @@
         return FALSE;
     }
 
-    CString sUrl;
-    m_urlCombo.GetWindowText(sUrl);
-    CTSVNPath url(sUrl);
+    auto sUrlFrom = m_urlCombo.GetString();
+    CTSVNPath url(sUrlFrom);
     if (!url.IsUrl())
     {
         ShowComboBalloon(&m_urlCombo, IDS_ERR_MUSTBEURL, IDS_ERR_ERROR, 
TTI_ERROR);
         return FALSE;
     }
-    m_urlCombo2.GetWindowText(sUrl);
-    CTSVNPath url2(sUrl);
+    auto sUrlTo = m_urlCombo2.GetString();
+    CTSVNPath url2(sUrlTo);
     if (!url2.IsUrl())
     {
         ShowComboBalloon(&m_urlCombo2, IDS_ERR_MUSTBEURL, IDS_ERR_ERROR, 
TTI_ERROR);
@@ -218,20 +217,17 @@
     }
 
     m_urlCombo.SaveHistory();
-    m_urlFrom = m_urlCombo.GetString();
-
     m_urlCombo2.SaveHistory();
-    m_urlTo = m_urlCombo2.GetString();
 
     CString    sRegKeyFrom = 
L"Software\\TortoiseSVN\\History\\repoURLS\\MergeURLForFrom" + 
static_cast<CMergeWizard*>(GetParent())->m_wcPath.GetSVNPathString();
     CRegString regMergeUrlForWCFrom(sRegKeyFrom);
-    regMergeUrlForWCFrom = m_urlFrom;
+    regMergeUrlForWCFrom = sUrlFrom;
     CString    sRegKeyTo = 
L"Software\\TortoiseSVN\\History\\repoURLS\\MergeURLForTo" + 
static_cast<CMergeWizard*>(GetParent())->m_wcPath.GetSVNPathString();
     CRegString regMergeUrlForWCTo(sRegKeyTo);
-    regMergeUrlForWCTo = m_urlTo;
+    regMergeUrlForWCTo = sUrlTo;
 
-    static_cast<CMergeWizard*>(GetParent())->m_url1     = m_urlFrom;
-    static_cast<CMergeWizard*>(GetParent())->m_url2     = m_urlTo;
+    static_cast<CMergeWizard*>(GetParent())->m_url1     = sUrlFrom;
+    static_cast<CMergeWizard*>(GetParent())->m_url2     = sUrlTo;
     static_cast<CMergeWizard*>(GetParent())->m_startRev = m_startRev;
     static_cast<CMergeWizard*>(GetParent())->m_endRev   = m_endRev;
 
Index: MergeWizardTree.h
===================================================================
--- MergeWizardTree.h   (revision 29397)
+++ MergeWizardTree.h   (working copy)
@@ -78,8 +78,6 @@
     CPathEdit     m_wc;
 
 public:
-    CString m_urlFrom;
-    CString m_urlTo;
     SVNRev  m_startRev;
     SVNRev  m_endRev;
 };

Reply via email to