Change location of .hg: mercurial equivalent of --separate-git-dir

Michael Forbes michael.forbes+hg at gmail.com
Fri Oct 12 16:04:54 UTC 2018


> On Oct 12, 2018, at 7:54 AM, Nathan Goldbaum <nathan12343 at gmail.com> wrote:
> I *think* you're looking for the share extension?
> 
> https://www.mercurial-scm.org/wiki/ShareExtension

Thanks!  That looks like it might work nicely.  Putting the shared repo I was worried that changes on dropbox might somehow affect the repo, but after playing with it a bit, it seems that only a few files are stored in the .hg repo in the shared copy (naming the current branch etc.) and if anyone tries to commit or something, it will fail unless the link in .hg/sharedpath points to an associated repo on their machine.  (This is perhaps a little undesirable, but --separate-git-dir would have the same problem, and I doubt it would generally be a problem.)


> 
> On Fri, Oct 12, 2018 at 9:52 AM Michael Forbes <michael.forbes+hg at gmail.com> wrote:
> On Oct 12, 2018, at 3:02 AM, Marcin Kasperski <Marcin.Kasperski at mekk.waw.pl> wrote:
> > 
> >> My use case is allowing others to edit a working copy through Dropbox,
> >> Google Drive, etc. and then periodically being able to compare the
> >> state of that copy with my repository, optionally adding or committing
> >> their changes.
> >> 
> >> I don't want to store the .hg folder in the shared repo for risk of
> >> data corruption (if people simultaneously commit in several places and
> >> the drive share auto-manages conflicts IN the .hg repo).
> > 
> > I'd consider solving it the other way:
> > 
> >   dropbox exclude add path/to/.hg
> > 
> > (and .hg is not synced anymore, but the files are, you are free to
> > commit as you like).
> > 
> > I suppose gdrive has sth similar.
> 
> In principle, these options would work, but in practise they are very poorly implemented.  For example, simply excluding the .hg from dropbox will delete it, and it cannot be excluded if it does not exist, so one needs to go through a convoluted procedure of adding a fake .hg directory, syncing that, excluding it, then moving the correct .hg file in place.
> 
> Also, the method differs for each type of remote share, and is extremely difficult to automate.  I am looking for a universal solution which using an alternative location for the .hg directory would provide.
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial




More information about the Mercurial mailing list