How to get the current repository?
how do i get what the current repository is for a directory?
I want to do:
SvnInfoEventArgs info;
Uri repos = new Uri("http://my.server/svn/repos");
client.GetInfo(repos, out info);
but I don't know what the URI is for the directory as it was previously checked out. How do I get what th开发者_如何学编程e URI is for a given checkout location?
I use the following to get the repository URI from a folder:
using (var folderDlg = new FolderBrowserDialog())
{
folderDlg.Description = Resources.SelectBranchFolder;
folderDlg.ShowNewFolderButton = false;
folderDlg.RootFolder = Environment.SpecialFolder.MyComputer;
if (folderDlg.ShowDialog() == DialogResult.OK)
{
string workingPath = folderDlg.SelectedPath;
using (var svnClient = new SvnClient())
{
Uri repo = svnClient.GetUriFromWorkingCopy(workingPath);
if (repo != null)
{
MessageBox.Show("The URI for this folder is " + repo.AbsoluteUri);
}
else
{
MessageBox.Show("This is not a working SVN directory.");
}
}
}
}
精彩评论