views:

40

answers:

1

Hi,

I'm using the Mercurial share extention in the Mercurial 1.6.4 supplied with TortoiseHG 1.1.1 on Windows (XP 32 bit).

More info at: http://mercurial.selenic.com/wiki/ShareExtension

I've been using the share extention, works nice, in both directions. The main repo is on a local harddisk, the shared repo is on a network share (Samba on AIX).

Now I want to remove a share link (which must be known on both sides, since they update eachother). How do I do that? I can't find anything on the web... the words "share" , "unshare", aren't very googlable.

Any help appreciated, kind regards, Tijs

+1  A: 

I think you are/were misunderstanding that extension. The (very seldom used!) share extension is for when you want multiple working dirs pointing to the same underlying repository -- instead of the much more normal one to one relationship between repos and working dirs.

There's no unshare because there's no bi-directional link.

Here's an explanation:

You create a new repo using hg init or hg clone:

repoA
\-- .hg (repoA's repository)

If you created another clone you'd have another working directory with another repository inside it. This is what's done 99.9% of the time.

repoA  (the one you already had)
\-- .hg (repoA's repository)

repoB  (the new clone)
\-- .hg (repo B's repository)
    \-- hgrc (config file with a [paths] default=../repoA)

However, if you use hg share you'll get something like this:

repoA  (the one you already had)
\-- .hg (repoA's repository)

repoB  (the new shared repo)
\-- .hg (a symlink-like pointer to ../repoA/.hg)

So it appears bidirectional only because they have the exact same repo under the covers. If they're on different machines/volumes then repoB is unusable if repoA isn't available -- which is the opposite of what a DVCs is supposed to do for you.

So, in answer you "unlink" by deleting repoB. If there are uncommitted files in repoB that you don't want to commit into repoA you can do something like this:

hg clone -U repoA newRepoB  # create a clone with no working dir
cp -a repoB/* newRepoB    # excludes all files including .hg (and other .* files)

TL;DR: don't use share ; it is almost never the right choice.

Ry4an
Hi Ry4an, Thanks for your very clear answer. "repoB is unusable if repoA isn't available " wasn't clear to me, it is now (and makes sense).Kind regards, Tijs
Yeah, perhaps this existing text should be bolded on the ShareExtension page to which you've linked: "In short, this is a small modification that deeply affects Mercurial's usual 'clones are independent' contract. Make sure you understand what it does before you shoot yourself in the foot!" Just clone. (So how about selecting the answer?)
Ry4an