Hi,
I noticed several problems about ra_local URL for UNC path.
- When a repo-browser is opened for a repository on UNC path,
an invalid node is shown.
- On a dialog with a box for repository URL (checkout, export, etc),
the browse button [...] opens Browse for Folder dialog for
"file://host/path", while the button opens repo-browser for
"file:///\host/path".
(at TortoiseSVN 1.5.0, Build 12278 - 32 Bit -dev, 2008/03/05 20:53:23)
Also, I prefer "file://host/path" form which is supported since
Subversion 1.2. Then I propose changing default form of URL for
UNC path.
I made the attached patch by simple grep for "file://". I'm sorry
for that the patch is neither compiled nor tested. I have only
Express Edition of VC++. Please use the patch if you like.
Proposed log message for the patch:
[[[
Revised handling of ra_local URL for UNC path. The form
"file://host/path" which is supported since Subversion 1.2 is now
supported correctly as the default.
]]]
--
k_satoda
Index: src/SVN/SVN.cpp
===================================================================
--- src/SVN/SVN.cpp (ƒŠƒrƒWƒ‡ƒ“ 12395)
+++ src/SVN/SVN.cpp (ì‹ÆƒRƒs[)
@@ -1706,7 +1706,10 @@
path.Replace('\\','/');
// prepend file:///
if (path.GetAt(0) == '/')
- path.Insert(0, _T("file://"));
+ if (path.GetAt(1) == '/')
+ path.Insert(0, _T("file:"));
+ else
+ path.Insert(0, _T("file://"));
else
path.Insert(0, _T("file:///"));
path.TrimRight(_T("/\\")); //remove trailing slashes
@@ -1716,13 +1719,15 @@
{
// we have to convert paths like file:///c:/myfolder
// to c:/myfolder
- // and paths like file:////mymachine/c/myfolder
+ // and paths like file:////mymachine/c/myfolder, file://mymachine/c/myfolder
// to //mymachine/c/myfolder
url.Trim();
url.Replace('\\','/');
- url = url.Mid(7); // "file://" has seven chars
- if (url.GetAt(1) != '/')
- url = url.Mid(1);
+ // "file://" has seven chars
+ if (url.GetAt(7) == '/' && url.GetAt(8) != '/')
+ url = url.Mid(8); // remove "file:///"
+ else
+ url = url.Mid(5); // network share, remove "file:"
SVN::preparePath(url);
// now we need to unescape the url
url = CPathUtils::PathUnescape(url);
@@ -1736,11 +1741,11 @@
// workaround for Subversions UNC-path bug
if (path.Left(10).CompareNoCase(_T("file://///"))==0)
{
- path.Replace(_T("file://///"), _T("file:///\\"));
+ path.Replace(_T("file://///"), _T("file://"));
}
else if (path.Left(9).CompareNoCase(_T("file:////"))==0)
{
- path.Replace(_T("file:////"), _T("file:///\\"));
+ path.Replace(_T("file:////"), _T("file://"));
}
}
@@ -1918,8 +1923,7 @@
BOOL SVN::IsBDBRepository(CString url)
{
preparePath(url);
- url = url.Mid(7);
- url.TrimLeft('/');
+ UrlToPath(url);
while (!url.IsEmpty())
{
if (PathIsDirectory(url + _T("/db")))
Index: src/SVN/SVN.h
===================================================================
--- src/SVN/SVN.h (ƒŠƒrƒWƒ‡ƒ“ 12395)
+++ src/SVN/SVN.h (ì‹ÆƒRƒs[)
@@ -644,7 +644,7 @@
CString GetRepositoryRootAndUUID(const CTSVNPath& url, CString& sUUID);
/**
- * Checks if a file:/// url points to a BDB repository.
+ * Checks if a file:// url points to a BDB repository.
*/
static BOOL IsBDBRepository(CString url);
Index: src/SVN/TSVNPath.cpp
===================================================================
--- src/SVN/TSVNPath.cpp (ƒŠƒrƒWƒ‡ƒ“ 12395)
+++ src/SVN/TSVNPath.cpp (ì‹ÆƒRƒs[)
@@ -245,11 +245,11 @@
//workaround for Subversions UNC-path bug
if (m_sFwdslashPath.Left(10).CompareNoCase(_T("file://///"))==0)
{
- m_sFwdslashPath.Replace(_T("file://///"), _T("file:///\\"));
+ m_sFwdslashPath.Replace(_T("file://///"), _T("file://"));
}
else if (m_sFwdslashPath.Left(9).CompareNoCase(_T("file:////"))==0)
{
- m_sFwdslashPath.Replace(_T("file:////"), _T("file:///\\"));
+ m_sFwdslashPath.Replace(_T("file:////"), _T("file://"));
}
m_sUTF8FwdslashPath.Empty();
}
Index: src/TortoiseProc/AppUtils.cpp
===================================================================
--- src/TortoiseProc/AppUtils.cpp (ƒŠƒrƒWƒ‡ƒ“ 12395)
+++ src/TortoiseProc/AppUtils.cpp (ì‹ÆƒRƒs[)
@@ -768,15 +768,14 @@
// browse local directories
CBrowseFolder folderBrowser;
folderBrowser.m_style = BIF_EDITBOX | BIF_NEWDIALOGSTYLE | BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
- // remove the 'file:///' so the shell can recognize the local path
- strUrl = strUrl.Mid(8);
- strUrl.Replace('/', '\\');
- if (folderBrowser.Show(pParent->GetSafeHwnd(), strUrl) == CBrowseFolder::OK)
+ CString strBrowse = strFile;
+ strBrowse.Replace('/', '\\');
+ if (folderBrowser.Show(pParent->GetSafeHwnd(), strBrowse) == CBrowseFolder::OK)
{
- SVN::PathToUrl(strUrl);
+ SVN::PathToUrl(strBrowse);
combo.SetCurSel(-1);
- combo.SetWindowText(strUrl);
+ combo.SetWindowText(strBrowse);
return true;
}
}
Index: src/TortoiseProc/Commands/RepositoryBrowserCommand.cpp
===================================================================
--- src/TortoiseProc/Commands/RepositoryBrowserCommand.cpp (ƒŠƒrƒWƒ‡ƒ“ 12395)
+++ src/TortoiseProc/Commands/RepositoryBrowserCommand.cpp (ì‹ÆƒRƒs[)
@@ -50,14 +50,16 @@
// The path points to a local repository.
// Add 'file:///' so the repository browser recognizes
// it as an URL to the local repository.
- url = _T("file:///")+cmdLinePath.GetWinPathString();
- url.Replace('\\', '/');
+ url = cmdLinePath.GetWinPathString();
+ SVN::PathToUrl(url);
}
}
}
- if (cmdLinePath.GetUIPathString().Left(8).CompareNoCase(_T("file:///"))==0)
+ if (cmdLinePath.GetUIPathString().Left(7).CompareNoCase(_T("file://"))==0)
{
- cmdLinePath.SetFromUnknown(cmdLinePath.GetUIPathString().Mid(8));
+ CString localRepository = cmdLinePath.GetUIPathString();
+ SVN::UrlToPath(localRepository);
+ cmdLinePath.SetFromUnknown(localRepository);
}
bFile = PathFileExists(cmdLinePath.GetWinPath()) ? !cmdLinePath.IsDirectory() : FALSE;
Index: src/TortoiseProc/RepositoryBrowser.cpp
===================================================================
--- src/TortoiseProc/RepositoryBrowser.cpp (ƒŠƒrƒWƒ‡ƒ“ 12395)
+++ src/TortoiseProc/RepositoryBrowser.cpp (ì‹ÆƒRƒs[)
@@ -292,7 +292,8 @@
(m_InitialUrl.Compare(_T("https://")) == 0)||
(m_InitialUrl.Compare(_T("svn://")) == 0)||
(m_InitialUrl.Compare(_T("svn+ssh://")) == 0)||
- (m_InitialUrl.Compare(_T("file:///")) == 0))
+ (m_InitialUrl.Compare(_T("file:///")) == 0)
+ (m_InitialUrl.Compare(_T("file://")) == 0))
{
m_InitialUrl.Empty();
}
@@ -334,7 +335,7 @@
nID = IDI_REPO_SVN;
if (m_strReposRoot.Left(10).CompareNoCase(_T("svn+ssh://"))==0)
nID = IDI_REPO_SVNSSH;
- if (m_strReposRoot.Left(8).CompareNoCase(_T("file:///"))==0)
+ if (m_strReposRoot.Left(7).CompareNoCase(_T("file://"))==0)
nID = IDI_REPO_FILE;
CAppUtils::SetListCtrlBackgroundImage(m_RepoList.GetSafeHwnd(), nID);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_tortoisesvn.tigris.org
For additional commands, e-mail: dev-help_at_tortoisesvn.tigris.org
Received on 2008-03-21 15:06:27 CET