<div class="gmail_quote">On Fri, Oct 21, 2011 at 09:07, Patrick Mézard <span dir="ltr"><<a href="mailto:pmezard@gmail.com">pmezard@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Le 21/10/11 17:56, Eric ROSHAN EISNER a écrit :<br>
<div class="im">> On Fri, Oct 21, 2011 at 07:30, Patrick Mézard <<a href="mailto:pmezard@gmail.com">pmezard@gmail.com</a> <mailto:<a href="mailto:pmezard@gmail.com">pmezard@gmail.com</a>>> wrote:<br>
><br>
>     I have some questions after looking at "Issue3056 - hg diff/status - subrepo files not listed on revision where subrepo was added". With the following setup (one modified subrepo being added):<br>
><br>
>      $ hg init sub<br>
>      $ echo b > sub/b<br>
>      $ hg -R sub add sub/b<br>
>      $ hg -R sub ci -m "addb"<br>
>      $ hg init repo<br>
>      $ cd repo<br>
>      $ hg clone ../sub sub<br>
>      $ echo sub = sub > .hgsub<br>
>      $ hg add .hgsub<br>
>      $ echo b >> sub/b<br>
><br>
>     1- Should "hg diff -S" display the changes to sub/b ?<br>
><br>
>     I guess it should, it is the whole point of -S.<br>
><br>
>     2- Say we commit this change as revision 0. Should "hg diff -S --change 0" display the changes to sub/b ?<br>
><br>
>     Yes for consistency with [1].<br>
><br>
>     No because it is undefined : we know the subrepo was introduced at revision 1, we do not know the use start adding it while being at revision 0 and committed it recursively.<br>
><br>
>     3- Say we modify "sub" 3 times with as many recursive commits. Should "hg diff -S -r null:3" display the changes to sub/b and which ones ?<br>
><br>
><br>
> The transparent thing to do is show the file diffs as if these files were directly tracked by the main repo. Since these files were unknown in rev 0 and known in rev 3, diff -S should show them all adding their full contents from /dev/null. Before you wrote this I had been under the impression that diff -S and status -S already did this.<br>


><br>
> Either way the subdiffs are useless for patching purposes (as any new commit made with them will conflict with .hgsubstate).<br>
<br>
</div>Then how do you address [1]? Display a diff of sub/b against /dev/null instead of the actual change in the subrepo?<br>
<br>
If you do that, you do not know what you are committing in the subrepo unless you ask the subrepo yourself.</blockquote><div><br></div><div>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.</div>

<div><br></div><div>  $ hg diff -S # effect on root repo</div><div>  ---/dev/null</div><div>  +++sub/b</div><div>  +b</div><div>  +b</div><div>  $ cd sub</div><div>  $ hg diff # effect on sub repo</div><div>  ---sub/b</div>

<div>  +++sub/b</div><div>  b</div><div>  +b</div><div>  $ hg commit -m b2 # manual recursive commit</div><div>  $ cd ..</div><div>  $ hg diff -S</div><div><div>  ---/dev/null</div><div>  +++sub/b</div><div>  +b</div><div>

  +b</div></div><div><br></div><div>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.</div>

</div>