[PATCH] Empty message box when applying a patch that does not affect any files
Denis Kovalchuk via TortoiseSVN-dev <[email protected]>
| Newsgroups | gmane.comp.version-control.subversion.tortoisesvn.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello! Steps to reproduce: 1. Download the empty.patch from attachments. 2. Open TortoiseMerge.exe. 3. Enter the path to the empty.patch. 4. Enter the path to any working copy. 5. Click "OK". The same behavior if you try to apply any file that is not a patch. It looks like if the applied file does not affect any files, then it is considered an error (see line 782 in TortoiseMerge/MainFrm.cpp [1]). But SVNPatch::Init() [2] does not set an error message in this case. What do you think if this case is not treated as an error? I've attached a patch. [1] https://osdn.net/projects/tortoisesvn/scm/svn/blobs/head/trunk/src/TortoiseMerge/MainFrm.cpp [2] https://osdn.net/projects/tortoisesvn/scm/svn/blobs/head/trunk/src/SVN/SVNPatch.cpp Best Regards, Denis Kovalchuk -- 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/edb7fdda-0781-4c2c-9edb-1d5a08689852n%40googlegroups.com.
empty.patch
(text/x-diff, 0 B)
fix-empty-message-box.patch.txt
(text/plain, 2.2 KB)
Index: src/SVN/SVNPatch.cpp
===================================================================
--- src/SVN/SVNPatch.cpp (revision 29348)
+++ src/SVN/SVNPatch.cpp (working copy)
@@ -157,7 +157,7 @@
if (patchFile.IsEmpty() || targetPath.IsEmpty() || !svn_dirent_is_absolute(target.GetSVNApiPath(m_pool)))
{
m_errorStr.LoadString(IDS_ERR_PATCHPATHS);
- return 0;
+ return -1;
}
svn_error_t* err = nullptr;
apr_pool_t* scratchpool = nullptr;
@@ -233,7 +233,7 @@
m_errorStr = GetErrorMessage(err);
m_filePaths.clear();
svn_error_clear(err);
- return 0;
+ return -1;
}
if ((m_nRejected > (static_cast<int>(m_filePaths.size()) / 3)) && !m_testPath.IsEmpty())
@@ -293,6 +293,7 @@
m_errorStr = GetErrorMessage(err);
m_filePaths.clear();
svn_error_clear(err);
+ return -1;
}
}
Index: src/SVN/SVNPatch.h
===================================================================
--- src/SVN/SVNPatch.h (revision 29348)
+++ src/SVN/SVNPatch.h (working copy)
@@ -35,7 +35,7 @@
* Does a dry run of the patching, fills in all the arrays.
* Call this function first.
* The progress dialog is used to show progress info if the initialization takes a long time.
- * \return the number of files affected by the patchfile, 0 in case of an error
+ * \return the number of files affected by the patchfile, -1 in case of an error
*/
int Init(const CString& patchFile, const CString& targetPath, CProgressDlg* pPprogDlg);
Index: src/TortoiseMerge/MainFrm.cpp
===================================================================
--- src/TortoiseMerge/MainFrm.cpp (revision 29348)
+++ src/TortoiseMerge/MainFrm.cpp (working copy)
@@ -779,7 +779,7 @@
{
m_data.m_baseFile.TransferDetailsFrom(m_data.m_theirFile);
}
- else if ((!m_data.m_sDiffFile.IsEmpty()) && (!m_patch.Init(m_data.m_sDiffFile, m_data.m_sPatchPath, &progDlg)))
+ else if ((!m_data.m_sDiffFile.IsEmpty()) && (m_patch.Init(m_data.m_sDiffFile, m_data.m_sPatchPath, &progDlg) < 0))
{
progDlg.Stop();
ClearViewNamesAndPaths();
TortoiseMerge-empty-message-box.png
(image/png, 165.5 KB) - not displayed