tags:

views:

65

answers:

2

I'm trying to sell our group on using Mercurial as a source repository rather than VSS. In the process of updating our build scripts, I'm running into an issue trying to retrieve files from the Hg repository.

Our builds are automated with NAnt and currently work for local builds or builds from VSS (ie, pull the source as needed from VSS). I'm trying to update them to work with Mercurial as well.

Basically, when I'm working with single files, I don't have any issues since I can just use NAnt's 'get' task (after getting the appropriate revision hash) to retrieve the individual file.

The problem that I'm having is when I need to work with a directory (and subdirectories) of files that aren't at the root of the repository. I can't seem to figure out the proper commands to retrieve/copy a subdirectory from the repository to my 'working' directory for the builds. I've spent basically the whole afternoon trying to figure out how to do this with the mercurial executables (so I can use a NAnt 'exec' task), and have basically hit a wall so I figured I'd try posting here.

Can someone confirm whether this is possible, and provide some suggestions as to how I might be able to do this? I realize that Mercurial tracks changes by files and not directories, but it seems odd to me that this isn't available out of the box (from what I can tell).

If it's just not possible, the only workarounds I see are either maintaining NAnt fileset lists of expected files to work with (ugh!), or cloning the entire repository to a temporary directory and then just copying the files from that source as needed (this feels like a cludge to me).

I realize that I could simply create another repository for the directory that I want to work with, but I'd prefer to not go that route since I think that would increase the complexity of what I'm trying to do by a significant amount (I would have to apply this a large number of times for all of the different libraries that we build..).

+5  A: 

Mercurial doesn't let you get only part of a repository. You have to get the whole tree. It's much more whole-repo focused than svn is.

Ned Batchelder
+1  A: 

You could try and segment your repository into multiple repos and manage them using the subrepos feature. Then you can pull the subdirectories independently.

David
I've thought of this, but since I'll be introducing Mercurial to the rest of the team, I'm trying to limit the number of modifications from the core product that we'd have to rely on. It is something that I've been considering for once it becomes a part of the core release.
Peter Bernier
But since your problem seems to be build oriented, it could be implemented without the users needing to play with the subrepos. They would still pull from the head (whole directory) and get their actual setup. As long as they push from the top, everything should be transparent. Anyway, I hope you pull it off, because VSS is a pain!
David