[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

PATCH: Re: TSVNCache process eating all the available CPU

From: Jacques Lemire <Jacques.Lemire_at_gmail.com>
Date: Tue, 1 Jul 2008 08:56:01 -0700 (PDT)

Patch in UDiff format. The starting and ending control lines must be
removed. I only tested TSVNCache.exe, regression testing should be
done on the other modules which use that class...

-- 8< ---- START: RootWCLoopFix.patch ---- 8< --
Index: TSVNPath.cpp
===================================================================
--- TSVNPath.cpp (revision 13352)
+++ TSVNPath.cpp (working copy)
@@ -89,6 +89,7 @@
                 len = MultiByteToWideChar(CP_UTF8, 0, pPath, -1,
m_sFwdslashPath.GetBuffer(len+1), len+1);
                 m_sFwdslashPath.ReleaseBuffer(len-1);
         }
+ SanitizeRootPath( m_sFwdslashPath, true );
         ATLASSERT(m_sFwdslashPath.Find('\\')<0);
 }

@@ -103,6 +104,7 @@
 {
         Reset();
         m_sFwdslashPath = sPath;
+ SanitizeRootPath( m_sFwdslashPath, true );
         ATLASSERT(m_sFwdslashPath.Find('\\')<0);
 }

@@ -110,22 +112,14 @@
 {
         Reset();
         m_sBackslashPath = pPath;
- // Make sure that root directories look like 'C:\' rather than 'C:'
- if(m_sBackslashPath.GetLength() == 2 && m_sBackslashPath[1] == ':')
- {
- m_sBackslashPath += '\\';
- }
+ SanitizeRootPath( m_sBackslashPath, false );
         ATLASSERT(m_sBackslashPath.Find('/')<0);
 }
 void CTSVNPath::SetFromWin(const CString& sPath)
 {
         Reset();
         m_sBackslashPath = sPath;
- // Make sure that root directories look like 'C:\' rather than 'C:'
- if(m_sBackslashPath.GetLength() == 2 && m_sBackslashPath[1] == ':')
- {
- m_sBackslashPath += '\\';
- }
+ SanitizeRootPath( m_sBackslashPath, false );
         ATLASSERT(m_sBackslashPath.Find('/')<0);
 }
 void CTSVNPath::SetFromWin(const CString& sPath, bool bIsDirectory)
@@ -134,12 +128,16 @@
         m_sBackslashPath = sPath;
         m_bIsDirectory = bIsDirectory;
         m_bDirectoryKnown = true;
- // Make sure that root directories look like 'C:\' rather than 'C:'
- if(m_sBackslashPath.GetLength() == 2 && m_sBackslashPath[1] == ':')
+ SanitizeRootPath( m_sBackslashPath, false );
+ ATLASSERT(m_sBackslashPath.Find('/')<0);
+}
+void CTSVNPath::SanitizeRootPath(CString& sPath, bool
bIsForwardSlash) const
+{
+ // Make sure to add the trailing slash to root paths such as 'C:'
+ if(sPath.GetLength() == 2 && sPath[1] == ':')
         {
- m_sBackslashPath += '\\';
+ sPath += (bIsForwardSlash) ? _T("/") : _T("\\");
         }
- ATLASSERT(m_sBackslashPath.Find('/')<0);
 }
 void CTSVNPath::SetFromUnknown(const CString& sPath)
 {
@@ -242,8 +240,7 @@
         m_sFwdslashPath.TrimRight('/');

         // Subversion 1.5 fixed the problem with root paths, but now it
expects a slash for root paths
- if ((m_sFwdslashPath.GetLength() == 2)&&(m_sFwdslashPath[1] == ':'))
- m_sFwdslashPath += _T("/");
+ SanitizeRootPath( m_sFwdslashPath, true );

         m_sFwdslashPath.Replace(_T("file:////"), _T("file:///\\"));

@@ -255,11 +252,8 @@
         m_sBackslashPath = sPath;
         m_sBackslashPath.Replace('/', '\\');
         m_sBackslashPath.TrimRight('\\');
- // Make sure that root directories look like 'C:\' rather than 'C:'
- if(m_sBackslashPath.GetLength() == 2 && m_sBackslashPath[1] == ':')
- {
- m_sBackslashPath += '\\';
- }
+
+ SanitizeRootPath(m_sBackslashPath, false);
 }

 void CTSVNPath::SetUTF8FwdslashPath(const CString& sPath) const
Index: TSVNPath.h
===================================================================
--- TSVNPath.h (revision 13352)
+++ TSVNPath.h (working copy)
@@ -243,7 +243,12 @@
          */
         static bool ArePathStringsEqual(const CString& sP1, const CString&
sP2);
         static bool ArePathStringsEqualWithCase(const CString& sP1, const
CString& sP2);
-
+
+ /**
+ * Adds the required trailing slash to local root paths such as 'C:'
+ */
+ void SanitizeRootPath(CString& sPath, bool bIsForwardSlash) const;
+
         void UpdateAttributes() const;

 private:
-- 8< ---- End: RootWCLoopFix.patch ---- 8< --

Jacques

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: dev-help_at_tortoisesvn.tigris.org
Received on 2008-07-01 18:02:13 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.