Subrepos and diff command

Martin Geisler mg at
Mon Oct 24 04:38:53 CDT 2011

Patrick Mézard <pmezard at> writes:

> Le 21/10/11 18:47, Eric ROSHAN EISNER a écrit :
>> On Fri, Oct 21, 2011 at 09:07, Patrick Mézard <pmezard at <mailto:pmezard at>> wrote:

>> Well you're doing two different things with the recursive commit, so
>> I think it's reasonable to ask the two repos separately to get the
>> two different answers.
>>   $ hg diff -S # effect on root repo
>>   ---/dev/null
>>   +++sub/b
>>   +b
>>   +b
>>   $ cd sub
>>   $ hg diff # effect on sub repo
>>   ---sub/b
>>   +++sub/b
>>   b
>>   +b
>>   $ hg commit -m b2 # manual recursive commit
>>   $ cd ..
>>   $ hg diff -S
>>   ---/dev/null
>>   +++sub/b
>>   +b
>>   +b
>> Importantly, it is consistent that a diff -S in the root repo gives
>> the same result before and after the inner commit, because they end
>> up with the same contents. I agree this is a bit confusing, but it
>> reflects the confusing nature of recursive commit.
> Right, I agree this approach gives well defined, consistent results. I
> guess "hg status -S" will do the same, again for consistency.

It does give the same consistent results -- and people are confused
about it for the same reasons.

Eric's description is really good: 'hg status -S' shows that happens as
seen from the outer repository, 'cd sub; hg status' shows what happens
from the subrepo.

Martin Geisler

aragost Trifork
Professional Mercurial support

More information about the Mercurial-devel mailing list