3

I want to create the VisualSVN Server repository and get that repository URL in command prompt. I need only that URL not any other information. can anyone help me?

I need command equal to VisualSVN Servers New->Repository and Copy URL to clipboard.

bahrep
  • 29,961
  • 12
  • 103
  • 150
Ramesh
  • 347
  • 3
  • 11
  • 2
    i want equal command to `new->repository` & `copy URL to clipboard` in visual SVN window... – Ramesh Aug 07 '13 at 09:48

2 Answers2

2

Update 2016:

Upgrade to the latest VisualSVN Server version that includes a PowerShell module that adds a number of PowerShell cmdlets for Subverion server and repository administrators. Read VisualSVN Server | Scripting and Automation page.

The cmdlets should be very helpful in regular administration tasks and automation. Here is the complete list of VisualSVN Server PowerShell cmdlets: KB88: VisualSVN Server PowerShell Cmdlet Reference.

As @IvanZhakov already suggested, you can create a new repository using New-SvnRepository cmdlet.

Here is an example of creating a new repository MyRepository and grabbing its URL parameter:

$repo = New-SvnRepository -Name MyRepository
$repo.URL

Outdated answer:

I assume you mean VisualSVN Server, not VisualSVN extension for Visual Studio.

  • You can create a repository with svnadmin create command or using VisualSVN Server's WMI (Windows Management Instrumentation) provider. Here is the PowerShell command that creates a new repository "Repo1":

    Invoke-WmiMethod -namespace root\VisualSVN -class VisualSVN_Repository -Name Create -ArgumentList Repo1

  • You can get URL of repository "Repo1" with the following PowerShell command:

    Get-WmiObject -namespace root\VisualSVN -class VisualSVN_Repository | Select-Object -expandproperty URL | Select-String -SimpleMatch "Repo1"

If you want to explore VisualSVN Server WMI provider, you can check it's MOF file which is located in the following folder "%VISUALSVN_SERVER%\WMI" on the computer where VisualSVN Server installed. Using this file as a reference you can write a program to manage VisualSVN Server on a various programming languages.

You may also want to check the MSDN article "Using WMI".

bahrep
  • 29,961
  • 12
  • 103
  • 150
  • thanks!, i'm new to WMI and PowerShell, if we want to create a new repository in 'c:\ drive' with name Repo1 what will the PowerShell command to do this. I had tried this `Invoke-WmiMethod -namespace C:\new\VisualSVN -class VisualSVN_Repository -Name Create -ArgumentList Repo1` in powershell, its shows error message that `Invoke-Wmimethd` is not recognized as a function. what type method we want to use for this case. – Ramesh Aug 08 '13 at 14:35
  • what does that root means whether local path or server. you had used back-slash(\) so i used local path. we want to mention anything else. – Ramesh Aug 08 '13 at 15:16
  • 1
    @Ramesh you should check MDSN links I've specified, it can be tedious but definitely worth it; namespace part points to VisualSVN Server WMI provider and is not related to your filesystem.Via WMI you can create repositories in repositories root location only ("C:\Repositories", by default). It also looks like there is a typo in your command. – bahrep Aug 08 '13 at 15:31
  • thanks!, i had created the repository and i got the url. but i didn't have access to import data into it. i want to give access `*=rw` . i had tried `-EnableAllPrivileges`, `-Authentication` but i didn't got the right one. – Ramesh Aug 12 '13 at 13:40
  • @Ramesh Managing Subversion repository access permissions via WMI is described here: http://stackoverflow.com/a/14686167/761095 – bahrep Aug 12 '13 at 14:46
1

It's very easy with latest VisualSVN Server 3.4.0: it includes Powershell module for managing Subversion server. Just run PowerShell 3.0 and execute the following command:

$repo = New-SvnRepository -Name repo
$repo.URL

You may use Get-Command -Module VisualSVN to get list of all VisualSVN Server cmdlets.

Ivan Zhakov
  • 3,981
  • 28
  • 24