Moving Directories in a SVN Repository using Tortoise SVN

Moving a directory that is already under SVN using Tortoise SVN isn’t as straightforward as this question and answer on Stackoverflow.com appears to suggest – the SVN Move versioned files here option isn’t always available…

So how do you move versioned directories to another location in the repository?

  • Create the new directory and add that directory to SVN using the Tortoise SVN Add command (no need to commit at this stage!) *or* move to a directory that is already under source-control
  • Right-click and drag the directory that is to be moved to the new directory (above) and select the SVN Move versioned files here option, as follows:

  • If the directory you’re moving to isn’t Tortoise Aware (i.e. hasn’t been added or isn’t already under source control), you won’t get the option, as follows:

  • Once the directory has been moved, commit the changes as usual.
Enhanced by Zemanta
Advertisements

Subversion & BizTalk: Setting Committer Auto-Properties

In my last post, I discussed how to configure the version control system, Subversion, to correctly handle BizTalk files. Although I did talk about how to set the correct file-type properties and how to mass update files already in the repository, I neglected to detail how to set those properties when files are first added to a repository.

As a committer, you won’t want to keep updating your newly added files with Subversion properties every time you add a or import a file. To resolve this problem, Subversion uses a concept of ‘auto-properties’ – properties that are automatically set on a new file (based on file type) when they are first added to the repository. Auto-properties can either be set in the Subversion configuration file or in the Windows Registry.

Auto-Properties in the Subversion Configuration File

To set auto-properties in the Subversion configuration file, open the config file

%USERPROFILE%Application DataSubversionconfig

and add lines similar to the following under the [auto-props] section of the file:

[auto-props]
*.btm = svn:mime-type=text/xml
*.btp = svn:mime-type=text/xml
*.odx = svn:mime-type=text/xml
*.xsd = svn:mime-type=text/xml;svn:eol-style=native
*.xml = svn:mime-type=text/xml;svn:eol-style=native
*.xsn = svn:mime-type=application/octet-stream

This sets the MIME-types defined in my earlier post for several common BizTalk file types; note that multiple properties can be set per file type, each separated by a semi-colon (e.g. *.xsd and *.xml file-types).

In order to enable these auto-properties, enable-auto-props under [miscellany] must be set to ‘yes’:

[miscellany]
enable-auto-props = yes

Auto-Properties in the Registry

The same auto-properties settings can be achieved through the Windows Registry. A sample .reg file is shown below that sets the same auto-properties detailed earlier:

REGEDIT4

[HKEY_CURRENT_USERSoftwareTigris.orgSubversionConfigauto-props]
"*.btm"="svn:mime-type=text/xml"
"*.btp"="svn:mime-type=text/xml"
"*.odx"="svn:mime-type=text/xml"
"*.xsd"="svn:mime-type=text/xml;svn:eol-style=native"
"*.xml"="svn:mime-type=text/xml;svn:eol-style=native"
"*.xsn"="svn:mime-type=application/octet-stream"

[HKEY_CURRENT_USERSoftwareTigris.orgSubversionConfigmiscellany]
"enable-auto-props"="yes"

For a full list of auto-properties that can be set, see the Special Properties section of the Subversion Online Help.

Configuring Subversion to Correctly Handle BizTalk Files

Subversion is a great open-source version control system, however it doesn’t work all that well with BizTalk solutions straight out of the box, particularly orchestration, pipeline and map files. In order to get these artifacts working seamlessly, there are a number of configuration changes that need to be made.

Contextual-Merging & MIME Types

When changes are received from the repository during an update of a local working file, Subversion attempts a contextual, line-based merge of changes. When this is performed on certain Biztalk files (including orchestrations, pipelines and maps) the result is an unreadable file in Visual Studio – the contextual, line-based merge simply can’t handle the file content unless given a little help by correctly specifying the file MIME-type through the Subversion svn:mime-type property.

Because Orchestrations, Maps, Pipelines and Schemas are essentially only Xml (orchestrations may additionally contain embedded XLANG/S code), we can easily set the MIME-type property to text/xml. The property can either be set using the TortoiseSVN Windows Explorer shell extension or via the the Subversion command-line propset command:


svn propset svn:mime-type text/xml TestOrchestration.odx
svn propset svn:mime-type text/xml TestMap.btm
svn propset svn:mime-type text/xml TestPipeline.btp
svn propset svn:mime-type text/xml TestSchema.xsd

To check that the property has been set correctly, you can use the subversion propget command:


svn propget svn:mime-type TestOrchestration.odx
> text/xml

This change ensures that when a local working copy of the file is updated from the repository, Subversion handles the line-based merge correctly. If you need to maintain binary files within your repository, such as InfoPath XSN files, you will need to set the MIME-type property to application/octet-stream.

More information about the MIME-type property can be found in the Subversion Online Help.

Mass Updating File Properties 

Although the TortoiseSVN Explorer shell extension and Subversion command line utilities are helpful, they only operate on one file at a time. To get around this problem, I have written a small VBScript to recursively apply Subversion properties to specified file types within sub-folders – any subversion property can be applied to any file type using the script. A simple batch file could be used to execute the script on each file-type as follows:

cscript SvnSetProps.vbs false "svn:mime-type text/xml" .btm "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .btp "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .odx "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .xsd "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .xml "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type application/octet-stream" .xsn "..IntegrationBiztalk"

You can download a copy of the SvnSetProps.vbs script here – please be aware that the script doesn’t do any error checking, so make sure you are confident in its operation by setting the second parameter (‘pretend’) to true – although it appears to be applying the changes, nothing is actually happening. Once you have applied the changes, they need to be committed back to the repository.

Disclaimer

This work is licensed under a Creative Commons Attribution 2.5 License – you can use commercially and modify as necessary, but you must give the original author credit. Furthermore, this script is provided “AS IS” with no warranty. Click the image below to view further detail of the licence.

Creative Commons License