How to treat subrepo as normal files?

Weijun Wang weijun.wang at oracle.com
Thu May 26 09:26:46 UTC 2011



On 05/26/2011 05:12 PM, Mads Kiilerich wrote:
> 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).

I'd rather keep the .hg folders in rsync. I have several mq patches 
folders which are very important. It's a pity the backup repo cannot 
include them, I'll create repos for the patches in the working 
directory. Hopefully this is enough.

>
> (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.)

No, I dare not do that. What if I commit in the working directory and 
rsync and commit again inside backup?

Maybe I should use git for the backup repo. Or, maybe I can tweak hg a 
little so that the ".hg" name is customizable.

Thanks
Max


>
> /Mads



More information about the Mercurial mailing list