1

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 the URI is for a given checkout location?

1 Answer 1

1

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.");
              }
           }
        }
     }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.