Moving a VSS database to Mercurial

Here’s a document I wrote up for work yesterday. I think it may be generally useful for anyone else out there who is considering moving from Visual SourceSafe to Mercurial. This write-up is specific to an organization working in a Windows environment, using Visual Studio 2008 & 2010, and using bitbucket.org as a back-end for Hg.  I also assume you’re using TortoiseHg and VisualHg.

  1. Insure all files are checked in to VSS.
  2. Get a new, full copy of the project from VSS.
  3. Make all files writable (uncheck read-only flag in Win Explorer).
  4. At both the solution and project levels, delete all *.SCC files.
  5. Edit the .SLN file to remove the “SourceCodeControl” section. It should begin with “GlobalSection(SourceCodeControl)” and end with “EndGlobalSection”.
  6. Edit each .CSPROJ file (one in each project folder) and remove all settings starting with “Scc”. There should be 4 — SccProjectName, SccLocalPath, SccAuxPath, and SccProvider.
  7. In the same folder as the solution file, in Windows Explorer, right-click, and select “Create Repository Here” from the TortoiseHg menu. Make sure “add special files” is checked.
  8. Edit the new “.hgignore” file and insert contents as per below. You may need to modify this file, depending on the project.
  9. Optional: create a README.TXT file in the solution folder, describing the project. This will automatically be displayed on the Bitbucket home screen for this repository.
  10. Right-click in Windows Explorer and select “Hg Commit” from the Tortoise menu.
  11. Review the list of files shown. If you see anything that shouldn’t be in source control, cancel out and modify the .hgignore file accordingly.
  12. Click the “All” button to select all files. Enter “Initial Hg Commit” as the comment. Click “Commit”.
  13. When that is done, exit from the commit dialog and review the project in Windows Explorer. Make sure that all files that should be in source control have a green check superimposed over their icon.
  14. Create a new repository in Bitbucket for the project:
    • https://bitbucket.org
    • Repositories, Create repository.
    • Enter an appropriate name.
    • Language should usually be set to C#.
    • Make a note of the repository address.
  15. Back in the main solution folder, right-click and select “Synchronize” from the Tortoise menu.
  16. Set the remote repository to the address you noted above. Hit the ‘save’ icon, and give this alias a name.
  17. Hit the “push” button.
  18. When that is done, check the project page in Bitbucket to make sure the source is all there.
  19. As a sanity check, create a new temp folder on your hard drive, and pull a new copy of the repository into it.
    • Select “clone” from the Tortoise menu.
    • Enter the full path to the Bitbucket repo as the source (“https://bitbucket.org/…”) and leave the destination as-is.
    • When the clone is done, open the project in Visual Studio.
    • Go to Tools, Options, Source Control, and switch your plug-in to VisualHg.
    • Take a quick look through the files in the solution, and see if any appear to be missing. (A missing file will have a yellow triangle icon overlay.)
    • Do a full build of the solution.
    • If possible, run a few tests to be sure it’s working. After the build, exit Visual Studio, and bring up the Hg Commit dialog at the root level. If you see any changed files to check in, they are probably temp files that should be excluded. If this is the case, please edit .hgignore accordingly.
    • When done, simply delete your temp folder.
  20. You have now migrated a VSS database to a Hg repository.

Note that I am not retaining version history here, just starting fresh in Hg.  If you want to move your version history over, please look at vss2hg.pl.  I tried this out on one of my VSS databases, and it did work, after some tweaking, though it didn’t quite manage to get 100% of the data over, and it was a bit confused about dates. I decided that it wasn’t worth bothering with it, in my case.

References:

  1. stackoverflow.com — how to remove VSS bindings.
  2. visualstudiohacks.com — small program to automatically remove bindings.
  3. stackoverflow.com — sample .hgignore files for VS 2008
  4. stackoverflow.com — sample .hgignore files for VS 2010.

Concrete

I just started reading Concrete: The Human Dilemma. I’ve had this mini-series sitting in my reading pile since it was published back in 2004/2005. I’m really enjoying it, and I wish I had more Concrete to read, but I just checked Wikipedia, and apparently there hasn’t been any Concrete published since then. Oh well.
Paul Chadwick does a great job of mixing large-scale social commentary with small-scale human moments. And his artwork is great too. He obviously puts a lot of thought into panel arrangement and “camera angle” within the panels, and sometimes uses little tricks (for lack of a better word) that could only work in comics. Bits that, in the wrong context, would be distracting, but work well for him.

EasyHttp

I haven’t had much reason, until recently, to start messing around with .NET 4 and C# 4. But I just had to do a bunch of stuff involving REST and JSON, and I found that the new dynamic type was very helpful there. Specifically, I used EasyHttp (available on GitHub), which makes it very easy to consume RESTful web services, and (via JsonFx) serialize and de-serialize JSON.

I know that there are other ways to do all this stuff, but I think EasyHttp and JsonFx work well and are easy to use. With dynamic objects, I don’t have to worry about mapping a JSON result to an explicit .NET class; I can just access those members I need to access and ignore the rest.

PHP tip of the day

If you’re running an array through json_encode(), and part of that array is a reference to another array, do _not_ json_encode() *that* array first. JSON-encoding something that’s already JSON results in… confusion. This is one of those things that I would have figured out a lot faster if I had any kind of debugging set up for PHP. Maybe I should look at FirePHP. I don’t do a lot of PHP work, but I’m using PHP right now to test some REST web services that I’m writing in .Net/C#. (Debugging the .Net code, of course, is a piece of cake.)

kicking and screaming

OK, I’ve been dragged kicking and screaming into 2011. I finally upgraded my home desktop machine to Firefox 4 and IE 9. (The work machine, of course, has had both installed for quite a while.)
I didn’t want to upgrade either until I was sure at least one of them would work with LogMeIn. It does seem to work OK in both Firefox 4 and IE 9 now, so there’s no reason for me to not upgrade now.
On a related issue, I was testing HTML 5 video in IE 9 last week, and ran into a really annoying problem.  For some crazy reason, my work machine has Windows 7 N on it, the version without Media Player. Well, it turns out that IE 9 won’t play HTML 5 video if Media Player isn’t installed. And it won’t show you a useful error message either.  It just won’t play. I eventually figured this out, and installed the Media Feature Pack for Windows 7 N. Now, all is well.

many things

Lots of things going on right now, and I just feel like I should dump them all into a blog post. This isn’t necessarily going to be an interesting or useful post for anyone but me, but I feel like I need to write it.

  • My brother Mike is in the hospital with pneumonia.  I haven’t been able to talk to him yet, so I’m not sure how bad it is.  (I’m in NJ and he’s in GA, and I haven’t been able to reach him on the phone.)
  • My brother Pat’s widow, who remarried a couple of years ago, just had a baby girl.
  • I met with someone today to organize an estate sale, so I can finally empty out my parents’ old home.  It looks like we’ll be doing it in about a month, so I really need to finish sorting through everything down there and make some final decisions about what I want to keep and what I want to get rid of.
  • My allergies have been pretty bad over the last week or two.  I went to the doctor yesterday, because I was starting to worry that it might be more than just allergies, but there’s no sign that there’s anything else wrong with me.  So, now I’ve got a prescription for Nasonex, to go along with the over-the-counter Zyrtec that I’ve been taking.  Hopefully, the combination of the two will help me out.

The next few blog posts will be about computer programming or comic books, I hope.