Scott Hanselman

AnkhSVN and a Monad SVN Provider?

March 28, '06 Comments [10] Posted in PowerShell | ASP.NET | Subversion | Bugs
Sponsored By

There's an interesting and ongoing, but not-to-often-updated project called AnkhSVN that aims to bridge the Visual Studio .NET IDE and its Source Code Control (SCC) Provider model with the SVN Source Repository.

The latest totally unstable snapshot installer can be found at the bottom of this page. As with all scary alpha stuff, use at your own risk. You can get daily updates at the CIA that show that a burst of development is happening. The screenshots are here and the details on how to get the source code via SVN is on their wiki. I use TortoiseSVN for SVN access. (Note that the latest release has built-in support for the ASP.NET hack/fix.)

UPDATE: I assumed that since there hasn't been a release in a while that the source I found was in an unstable state. The author responded in the comments, and it turns out the current source is more stable than the current release, fixing a number of bugs. I've been using Ankh at work for the majority of my SVN work and haven't had any problems.

All this isn't news, nor is it that interesting, IMHO. The really interesting stuff lies in the deep web (the sometimes-Google-able but not always easily)...if you actually retrieve the SVN repository as Patrick Cauldwell pointed out to me, you'll see that there appears to be a Microsoft Command Shell (MSH/Monad) Provider in the works for Subversion.

Nutshell...in Monad/MSH you can "cd" into more than just drives. You can say "cd HKLM:" and run around the Registry like it was a disk drive. You can say "cd ENV:" and poke around inside of the Environment Variables. The possibilities are endless when you can create your own MSH Providers. One guy has one that lets you look at Windows Services as if they were a location. Not sure why that is interesting, but it's cool. This time next year there will be dozens, I'm sure. Here's the start of a Visual Sourcesafe MSH Provider.

It looks like this particular provider would be used like this:

new-provider C:\dev\svnprovider\Svn.cmdletprovider
new-drive ankh svn
http://mysubversionsystem/svn/finalproject
cd ankh:

I'd have a screen shot for you, but trying to compile this stuff is the Trials of Job. The provider is lovely, written in C# 2.0, but it has dependencies on NSvn.Core and a number of other Managed C++ which themselves have dependencies on C. Then there's the whole Python gen-make.py thing that actually generates the makefiles, yada yada. It's very MacGyver.

I'll wait and hope it's released soon. Perhaps the author will notice that we noticed and chime in!

UPDATE: Holy CRAP there is some stuff in Monad/MSH that is OBSCURE. Sheesh. I'm getting 0x8007007e COM Errors from Snapins, zero feedback if things are working, and this whole assembly loading thing is just death. Anyway. Rather than trying to get the files I needed by building, instead I installed the latest build of Ankh and referenced its assemblies directly, then built just the SvnProvider myself. Elsewhere on the net folks were using InstallUtil to add cmdlets and providers, but I couldn't figure that out, so instead I created these registry keys. I had to put the new provider assembly in the same directory as Ankh.

Registry Editor Monad 1

Then I was able to do this from MSH:

MSH C:\> add-mshsnapin Rogue.Monad.Provider.dll
MSH C:\> get-provider

Name                 Capabilities                  Drives
----                 ------------                  ------
Alias                ShouldProcess                 {Alias}
Environment          ShouldProcess                 {Env}
FileSystem           Filter, ShouldProcess         {C, D, T, Z, A, E, F, G}
Function             ShouldProcess                 {Function}
Registry             ShouldProcess                 {HKLM, HKCU}
Variable             ShouldProcess                 {Variable}
Certificate          ShouldProcess                 {cert}
Svn                  None                          {}

There it is at the bottom. Then I did

MSH C:\> new-drive ankh svn http://www.ankhsvn.com/svn/finalproject/trunk/src/

Name       Provider      Root                                   CurrentLocation
----       --------      ----                                   ---------------
ankh       Rogue.Mona...
http://www.ankhsvn.com/svn/final...

MSH C:\documents and Settings\scott\Desktop> cd ankh:
MSH ankh:\> dir

Then I got stuff like:

MSH ankh:\> dir

MshPath         : Rogue.Monad.Provider.dll\Svn::http://www.ankhsvn.com/svn/fina
                  lproject/trunk/src/Ankh
MshParentPath   : Rogue.Monad.Provider.dll\Svn::http://www.ankhsvn.com/svn/fina
                  lproject/trunk/src
MshChildName    : Ankh
MshDrive        : ankh
MshProvider     : Rogue.Monad.Provider.dll\Svn
MshIsContainer  : True
LastAuthor      : macgyver
Time            : 3/20/2006 11:01:54 PM
CreatedRevision : 2408
HasProperties   : True
Size            : 0
NodeKind        : Directory
Path            : Ankh

And then:

MSH ankh:\> dir | format-table MshPath,LastAuthor,CreatedRevision,Size,NodeKind

MshPath         LastAuthor      CreatedRevision            Size        NodeKind
-------         ----------      ---------------            ----        --------
Rogue.Monad.... macgyver                   2408               0       Directory
Rogue.Monad.... ProjectAutoU...            2012           18591            File
Rogue.Monad.... Arild                      2386             312            File
Rogue.Monad.... Arild                       443               0       Directory
Rogue.Monad.... Arild                      1990               0       Directory
Rogue.Monad.... macgyver                   2351           18809            File
Rogue.Monad.... Arild                      2112             142            File
Rogue.Monad.... Arild                       747           91588            File
Rogue.Monad.... macgyver                   1713               0       Directory
Rogue.Monad.... macgyver                   2354               0       Directory
Rogue.Monad.... Arild                      2362               0       Directory
Rogue.Monad.... macgyver                   2388               0       Directory
Rogue.Monad.... Arild                      2137           16372            File
Rogue.Monad.... macgyver                   2285               0       Directory
Rogue.Monad.... Arild                      1154             198            File

I couldn't figure out how to get just the interesting path bits on the right side of MshPath. Someone will know.

Monad folks - I read the docs, did the labs, but there's a HUGE dearth of good doc on this. ETA?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Tuesday, 28 March 2006 15:28:26 UTC
You can do something like this,

dir | select @{e={$_.MshPath.replace("$($_.MshProvider)::","")};n='path'},
,LastAuthor,CreatedRevision,Size,NodeKind | ft

you can also add it a a noteproperty with add-member, or add it to your typedata
(of both you can finds examples on my blog).
also you can add the property in the provider

hope this helps

gr /\/\o\/\/

Tuesday, 28 March 2006 17:50:51 UTC
There are a couple other interesting projects out there that I thought you might be interested in.

There's a C# binding(subversionsharp) in the works for subversion that will allow you to talk to subversion directly from c#(see link below). The only issue here is that you would have to recompile the windows version to include these bindings. I couldn't locate a precompiled copy.

http://www.softec.st/en/OpenSource/ClrProjects/SubversionSharp/SubversionSharp.html


A company called pushok software has released a com object(svncom) that provides all the functionality of the commands svnclient and svnadmin(see link below). I believe you mentioned in your podcast last week that monad can utilize com objects?

http://www.pushok.com/soft_svncom.php
Tuesday, 28 March 2006 19:57:28 UTC
I'd be interested to know if the Monad book just release by O'Reilly is useful. I noticed that the only copy of it at the Tannesborne BN disappeared in the last week.
Tuesday, 28 March 2006 20:16:35 UTC
Sounds like something that the TFS guys should do too...
Wednesday, 29 March 2006 18:22:42 UTC
Scott, try this:

dir | format-table @{e={parse-path $_.MshPath -NoQualifier};l="Path"}

Parse-Path is a very useful little cmdlet when dealing with paths. Be aware that this cmdlet's name is likely to change to Split-Path in a future drop.

The MshSnapin functionality is relatively new (Beta 3 / January) and was done based on feedback from the community. Before snapins the only way to add your own custom cmdlets was to create a new shell which creates a new MSH executable. I'm hopeful that we will be getting better documentation on snapins in a future drop.
Thursday, 30 March 2006 12:35:04 UTC
BTW - The new version of Console (http://sourceforge.net/projects/console) allows you to chose the shell that it ran, and you can also have tabs. Thanks to WinKey when I press Windows+C I now get a console that looks good and allows me to easily switch between MSH and CMD...
Friday, 14 April 2006 03:47:25 UTC
Scott,

What version of AnkhSVN are you using? Also, are you using this VS2005? I want to know if you had any issues with trying to use it with VS2005.
Friday, 14 April 2006 04:39:16 UTC
I'm using the one from the "unusable snapshot installer" link above, and I'm using it with both 2005 and 2003. No problems yet.
Scott Hanselman
Sunday, 23 April 2006 01:04:52 UTC
The author noticed...

I'm the author of that MSH provider and one of the authors of AnkhSVN (the Arild in the dir listing above). I must admit I had pretty much forgotten about the MSH provider. It was an experiment when I was first introduced to MSH (ie, it seemed like a neat thing to do...). At the time, I had lots of neat plans for it, but it got lost in other obligations. Is there really a call for a release of this thing?

As for having a massive dependency chain; that's true, but you could always use the NSvn.*.dlls from the AnkhSVN installation. There's also a build script in the provider source that will build and install the thing for you. Since we recognized that building Ankh is a chore with all the dependencies, we have also provided these development zips with all the dependencies prebuilt: http://ankhsvn.tigris.org/servlets/ProjectDocumentList?folderID=4476&expandFolder=4476&folderID=4013

I sort of resent the "totally unstable" tag given to the current Ankh snapshot. We have known bugs, but a large number of people are using it and seem happy with it. If we called it a release right now, it would have no more bugs than the latest release (0.5.5) with a lot more features and a lot better/smoother VS integration.

(re: the TFS guys should do this also):
There is a TFS MSH provider somewhere. I have it installed at work; can't remember right now where I got it from, though.
Sunday, 23 April 2006 04:05:39 UTC
I will edit the post, I wasn't actually aiming the "totally unstable" comment at ankh, but I totally see that it looks like that. I meant to warn my readers that I had got the source in an unstable state out of the tree, not knowing the status of the tree. They (the readers) tend to complain to me if things I reccommend aren't "2.0" quality. Didn't mean to offend.

Scott Hanselman
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.