Sunday, July 25, 2010

Resolving SVN Tree Conflicts

The Red Bean SVN Book has a good explanation of how to fix Tree Conflicts in the chapter Dealing with Structural Conflicts.  Basically, this happens because one developer has made a change to a file or directory that another user has deleted or renamed.  The svn status command will indicate which file is at issue:
C:\testrepos>svn st
M       baz.cs
M       foo.cs
A  +  C bar.cs
      >   local edit, incoming delete upon update
The "C" in column 5 next to bar.cs indicates a tree conflict, namely that this file has been renamed by another user.
To resolve this, do an SVN UPDATE, which will bring in the renamed version, apply your changes to this version, use SVN REMOVE to delete bar.cs, and finally, let SVN know that the conflict is resolved with this command:
svn resolve --accept=working bar.cs
This lets Subversion know that the change we made to bar.cs, namely deleting it, should be propagated up to the repository. Finally, do a commit to mark the change complete.

UPDATE: We moved to GIT, so these are now a distant memory. Git can handle this scenario cleanly.

Saturday, July 24, 2010

Subversion FAQ

Digging into the Subversion FAQ. It has a lot of useful tips, such as this one:
I have a file in my project that every developer must change, but I don't want those local mods to ever be committed. How can I make 'svn commit' ignore the file?

The answer is: don't put that file under version control. Instead, put a template of the file under version control, something like 'file.tmpl'.

Then, after the initial 'svn checkout', have your users (or your build system) do a normal OS copy of the template to the proper filename, and have users customize the copy. The file is unversioned, so it will never be committed. And if you wish, you can add the file to its parent directory's svn:ignore property, so it doesn't show up as '?' in the 'svn status' command.

Tuesday, July 20, 2010

Just wondering...

Why doesn't windows provide a command line interface to uncompress *.zip files?  Something legal, or they just don't want us doing that in our bat scripts?

Wednesday, July 14, 2010

Excluding .svn Directories from the MSBUILD Copy task

This post shows how to exclude .svn directories from an MSBUILD task. The magic syntax to exclude them is this:
     <LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude="$(LibrariesReleaseDir)\**\.svn\**" />

Monday, July 12, 2010

Keeping Web.Config nice and tidy

I've been digging through .Net blogs to get some ideas about how to tidy up the web.config file.

OdeToCode recommends building an encapsulation layer between Web.Config and your code, so that the string values keys used to access Web.Config settings are replaced with property names of a Configuration class.   This also provides a place for casting not string values, and for replacing the source of the data at a later point in a way that will be transparent to the rest of the application.

Sunday, July 11, 2010

Tweaking the project file to customize MSBUILD

Compiling Apps With Custom Tasks For The Microsoft Build Engine explains the black art of tweaking your .csproj file.

Web Deployment projects ...

... are very cool.  They let you automate deployment to production or test environments either from Visual Studio or from the MSBUILD.exe command, with pre- and post- build customized tasks, and web.config overrides, all driven by the Configuration setting.  I've found a good blog post but not a lot of documentation, so I'm still figuring out how the tasks work.

Update: There's an open source project to write custom MSBUILD tasks.