Mercurial共享扩展:如何取消共享?

use*_*773 3 mercurial

我在Windows(XP 32位)上使用TortoiseHG 1.1.1提供的Mercurial 1.6.4中的Mercurial共享扩展.

更多信息请访问:https: //www.mercurial-scm.org/wiki/ShareExtension

我一直在使用分享扩展,在两个方向都很好用.主要仓库位于本地硬盘上,共享仓库位于网络共享上(AIX上的Samba).

现在我想删除一个共享链接(必须在双方都知道,因为它们互相更新).我怎么做?我在网上找不到任何东西......"分享","取消共享"这些词语并不是很容易上传.

任何帮助表示赞赏,亲切的问候,Tijs

Ry4*_*ase 8

我认为你是误解了这种延伸.(很少使用!)共享扩展是指当你想要多个工作目录指向同一个底层存储库时 - 而不是repos和工作目录之间更常见的一对一关系.

没有取消共享,因为没有双向链接.

这是一个解释:

您使用hg init或创建新的仓库hg clone:

repoA
\-- .hg (repoA's repository)
Run Code Online (Sandbox Code Playgroud)

如果您创建了另一个克隆,则您将拥有另一个工作目录,其中包含另一个存储库.这是99.9%的时间.

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)
Run Code Online (Sandbox Code Playgroud)

但是,如果你使用hg share你会得到这样的东西:

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

repoB  (the new shared repo)
\-- .hg (a symlink-like pointer to ../repoA/.hg)
Run Code Online (Sandbox Code Playgroud)

因此它看起来是双向的,因为它们在封面下具有完全相同的回购.如果他们在不同的机器/卷上,那么repoB如果repoA不可用则无法使用 - 这与DVC应该为您做的相反.

所以,回答你通过删除repoB"取消链接".如果repoB中有未提交的文件,您不想提交到repoA,您可以执行以下操作:

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

TL; DR:不要使用share; 它几乎永远不是正确的选择.