开发者

Mercurial share extension: how to unshare?

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: https://www.mercurial-scm.org/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", are开发者_开发问答n't very googlable.

Any help appreciated, kind regards, Tijs


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜