I often work with Mercurial by keeping a local store of my upstream clones, and then just cloning again locally for my actual working environment:
$ cd /clones
$ hg clone ssh://external-repo.example.com/some/repo/path/foo
$ cd ~/Development
$ hg clone /clones/foo
This is particularly useful for me because I often want to make new clones on airplanes, etc., where I have no internet access. However, this doesn't work when the original clone contains subrepos - the presence of the .hgsubstate
file means that hg
will always go out to the internet instead of grabbing the local cloned revision (even if they are the same). Is there any way to make a local clone copy the files without going out to the internet?
This question has an answer which would probably work, but seems very unfortunate for long-term management (deleting the .hgsubstate
file in the clone in /clones/
, and then making local clones from that).
You can use a "trivial" subrepository path in your .hgsub
file like this:
foo = foo
bar = bar
This is the recommended setup. The advantage of setup a layout is that a clone has the same structure as the repository you clone from. You can thus clone your clones when on a plane.
Alternatively, you can use the [subpaths]
setting to re-map the URLs to local paths. This lets you add
[subpaths]
http://server/(.*) = /clones/libs/\1
to your ~/.hgrc
file and then you'll see that paths are remapped to /clones/libs
when you clone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With