Using VisualSVN plugin to Add a Project on SVN Server in VS 2013

Before we were using AnkhSVN plugin in Visual Studio, but sometimes we got unknown issues when we have multiple team members, so later we changed to VisualSVN plugin, we feels the new one is more stable.

Here is a sample which about how to add a project to SVN server using VisualSVN plugin in Visual Studio 2013.

All steps suppose you have installed VisualSVN plugin.

1: Right click the solution name in Visual Studio 2013, select “Add Solution to Subversion…”:

image

Continue reading “Using VisualSVN plugin to Add a Project on SVN Server in VS 2013”

Using AnkhSVN to Add a new project on SVN Server

I have introduced AnkhSVN, which is a SVN plugin for Visual Studio. But I just realized I never gave some real steps which about how I used this plugin.

Sometimes, if I spent longer time to write code, I found I forgot to how to add a new project to SVN server using AnkhSVN. So this is the first thing which I want to write down it:

Continue reading “Using AnkhSVN to Add a new project on SVN Server”

Edit SVN logs after committed

You might want to edit log after you committed code using SVN, but you might see the following error screen:

All you need to do is create a pre-revprop-change hook.

IF your SVN server is not VisualSVN, then you try to copy the following code and save the file as “pre-revprop-change.bat” and throw it in the hooks directory. IF you use VisualSVN, you can set the following code into pre-revprop-change hook setting:

Right click the project name in VisualSVN -> All Tasks -> Manage Hooks…

@ECHO OFF
:: Set all parameters. Even though most are not used, in case you want to add
:: changes that allow, for example, editing of the author or addition of log messages.
set repository=%1
set revision=%2
set userName=%3
set propertyName=%4
set action=%5

:: Only allow the log message to be changed, but not author, etc.
if /I not “%propertyName%” == “svn:log” goto ERROR_PROPNAME

:: Only allow modification of a log message, not addition or deletion.
if /I not “%action%” == “M” goto ERROR_ACTION

:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f “tokens=*” %%g in (‘find /V “”‘) do (
set bIsEmpty=false
)
if “%bIsEmpty%” == “true” goto ERROR_EMPTY

goto :eof

:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT

:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT

:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1

How to change VisualSVN log message after committing?

To make the VisualSVN server accept log message changes, a pre-revprop-change hook, that allows to change author or message, has to be installed for the repository. The default installation rejects changes to author and log message.

It is hard to find a sample hook script. but the following one is a solution but it need to put all script to a file and copy the file under /hooks folder in repository folder:

Just copy the following code to VisualSN Studio:  Select database you want to set hook, then click right mouse button and get a “New Task” menu item -> select “Manage Hook”, then select “Pre-revision proterty change hook” and edit ,  just copy  the following code into . 

OR     save the following code   as file “pre-revprop-change.bat” and throw it in the hooks directory (

set userName=%3
set propertyName=%4
set action=%5

:: Only allow the log message to be changed, but not author, etc.
if /I not "%propertyName%" == "svn:log" goto ERROR_PROPNAME

:: Only allow modification of a log message, not addition or deletion.
if /I not "%action%" == "M" goto ERROR_ACTION

:: Make sure that the new svn:log message is not empty.
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if "%bIsEmpty%" == "true" goto ERROR_EMPTY

goto :eof

:ERROR_EMPTY
echo Empty svn:log messages are not allowed. >&2
goto ERROR_EXIT

:ERROR_PROPNAME
echo Only changes to svn:log messages are allowed. >&2
goto ERROR_EXIT

:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT

:ERROR_EXIT
exit /b 1

And also there is a sample here. Maybe they are the same one.

Great svn client software for Visual Studio

Let me recommend a plugin for Visual Studio, its name is AnkhSVN.

I think many programmer might be using TortoiseSVN as a svn client tool. Yes, TortoiseSVN is a great SVN client (it has server function also) too. But if you write code using visual studio, you might think about a svn client which is more fit for Visual Studio IDE.

For example, you might know it is painful if you need to add or delete files, when you use TortoiseSVN, most of time you have to click “Add” to add your new generated files, if you forget to “Add” files, TortoiseSVN will not add your new files by default.

Fortunately there is a perfect svn tool is just for Visual Studio, After you used this svn client, you will not want to leave away from it.

Actually, it is a plugin for Visual Studio, its name is AnkhSVN, you can download from its official site

AnkhSVN is a Subversion Source Control Provider for Microsoft Visual Studio 2005, 2008 and 2010.

AnkhSVN provides source code management support to all project types supported by Visual Studio and allows you to perform the most common version control operations directly from inside the Microsoft Visual Studio IDE.

The Pending Changes dashboard gives you a unique insight in your development process and provides easy access to the source code and issue management features. The deep source code control (SCC) integration allows you to focus on developing, while AnkhSVN keeps track of all your changes and provides you the tools to effectively handle your specific needs.

Remove subversion (SVN) source control from a project

How to remove subversion (SVN) source control from a project ?

Too easy ways:

Way 1: Just simply delete all .svn folders under your project folder and all sub folders in Windows Explorer;

Way 2: Create a new folder  which you can get a Non-SVN control project code later, go to your SVN controled project, right click on root folder, TortoiseSVN -> Export , then select the folder that you created just now, click OK, then you will get a clear project without SVN control;

Good luck !

Should I add the Visual Studio .suo and .user files to source control ?

.suo and .user file are two types of hidden user files in Visual Studio project.

.suo file which is a binary file. .user file is the project user file which is a text file.

You don’t need to add these 2 files to your source control (SCM) since they contain per-user settings and SUO (Solution User Options) records all of the options that you might associate with your solution so that each time you open it, it includes customizations that you have made.