1

如何获取目录的当前存储库?

我想要做:

SvnInfoEventArgs info;
Uri repos = new Uri("http://my.server/svn/repos");
client.GetInfo(repos, out info);

但我不知道该目录的 URI 是什么,因为它之前已签出。如何获取给定结帐位置的 URI?

4

1 回答 1

1

我使用以下内容从文件夹中获取存储库 URI:

     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.");
              }
           }
        }
     }
于 2011-05-04T18:21:04.650 回答