By Weijun on Mar 14, 2011
But then I see a problem, there is a VirtualBox bug saying that symlinks in a shared folder shows incorrectly inside the guest. Now I share the OpenJDK forest in read-write mode to the guest, when trying to run
hg pull -R jdk/src/closed inside the guest, it would complain
abort: Is a directory: /mnt/root/openjdk7/jdk/src/closed/.hg/wlockThis is bad.
So I go take a look at the Mercurial commands and notice this cool feature: bundles. A bundle looks like a code repository as a single file, which can contain the whole history or only part of it. Now in the guest I would call
hg inc -R jdk/src/closed --bundle jscto create a bundle file to contain all incoming changesets of the jdk/src/closed repo. Note that there is no problem creating a normal file from within the guest in a shared folder. Then I can go back to the host machine, and call this
hg fetch -R jdk/src/closed bundle://jscCool, a bundle-schemed URI. In fact, I can now make the shared folder as read-only, and create another another smaller read-write shared folder only for file transmission from guest to host. Mecurial has dedicated commands like
unbundleto deal with bundles, but I'm not eager to look into their details now.
Something else to say, I wrap the calls into a script, and it's a single script that can be called on both guest and host. In fact, this script does not perform any real mercurial/file actions, all it does is to iterate thru repository names and call echo to output command lines on the screen (plus #comments). I often write scripts in this way so that I can take a second look at the output commands for safety. After making sure they are OK I can simply copy and paste (drag thru and middle-click) lines I want to run to execute them. In this case, I run the "hg inc" lines on the guest and "hg fetch" lines on the host.