How to treat subrepo as normal files?

Mads Kiilerich mads at kiilerich.com
Thu May 26 09:12:45 UTC 2011


On 05/26/2011 07:17 AM, Weijun Wang wrote:
> Hi All
>
> I use Mercurial to create a backup system: A cron job "rsync -aL" my
> working directory to a repo on another disk and do a "hg commit -A"
> there. Now the problem is that there are some Mercurial repos in my
> working directory and in the backup repo they are treated as subrepos so
> files inside are not managed by the top backup repo.
>
> I'd like to simply treat them as normally files, so that the backup repo
> becomes a single node for all history. Is there an option I can add into
> .hgrc?

I doubt the backup repo treats random repositories in its working 
direcotory as subrepos. It is just that Mercurial repositories (by 
definition) can't contain .hg folders, and commands like addremove and 
commit thus doesn't recurse into directories with a .hg directory.

A solution for you could be to exclude .hg folders from your rsync (and 
remove the stale .hg directories from your back repo working directory 
once).

(You could also list your hg repositories in .hgsub and treat them as 
real subrepos - it is up to you to decide if that is better or not.)

/Mads



More information about the Mercurial mailing list