Breaking hard links between repositories
Guido Ostkamp
hg at ostkamp.fastmail.fm
Thu May 22 21:04:27 UTC 2008
On Tue, 20 May 2008, Matt Cross wrote:
> Is there a clean way to break hardlinks between cloned repositories?
>
> In our environment, we clone repositories on a central server, and
> occasionally lock branches using file permissions to prevent accidental
> pushes to a repository. However, when a branch is cloned without a
> '--pull' option, the data store files are hardlinked, and so permission
> changes affect both repositories. I know we can break the hardlinks by
> making a new clone with the --pull option and switching to the new
> repository, but it would be more convenient if there was a way to break
> the hardlinks in place in an atomic manner (with respect to mercurial
> push/pull operations).
If I understand you correctly, you want to disable pushing from one repo
clone to the original repo it was cloned from.
This should be possible by simply renaming the directory of the original
repo, e.g. from 'repo1' to 'repo1.locked'. An 'hg push' from the clone
should then report something like
'abort: repository /home/testuser/hg-test/repo1 not found!'.
The hardlinks and permissions on them should be unaffected by this method
so anyone should still be able to read the files. As far as I know, as
soon as someone needs to modify such a file by doing a commit in his
clone, Mercurial will anyway break the hardlink itself in favor of a
private copy stored in that repository.
Regards
Guido
More information about the Mercurial
mailing list