<div dir="ltr"><br><br><div class="gmail_quote">On Tue, May 26, 2015 at 2:35 PM Pierre-Yves David <<a href="mailto:pyd@fb.com">pyd@fb.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
<br>
<br>
<div>On 05/26/2015 02:02 PM, Martin von
Zweigbergk wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr"><br>
<br>
<div class="gmail_quote">On Tue, May 26, 2015 at 1:43 PM
Pierre-Yves David <<a href="mailto:pyd@fb.com" target="_blank">pyd@fb.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> <br>
<br>
<div>On 05/26/2015 01:25 PM, Martin von Zweigbergk wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">On Sun, May 24, 2015 at 3:08
PM Pierre-Yves David <<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a>>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 05/22/2015 06:01 PM, Martin von Zweigbergk
wrote:<br>
><br>
><br>
> On Fri, May 22, 2015 at 3:51 PM Pierre-Yves
David<br>
> <<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a>
<mailto:<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a>>><br>
</blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div><div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> (I'm also a bit
curious about how often you need it a what you use it for)</div>
</blockquote></div></div></blockquote></div><div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite"><div dir="ltr"><div class="gmail_quote">
<div><br>
</div>
<div>I think I usually use when I have a branch and I think of
an alternative approach, so I start from scratch, but I
still want some pieces from the old branch (perhaps test
cases).</div>
</div></div></blockquote></div><div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"></div>
</div>
</blockquote>
And will you often use `-i` for that?</div></blockquote><div><br></div><div>Is -i already supported? If it is, I probably will use it for that.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>
In the ancestor case (a), `hg diff --rev (a)`
would be consistent with<br>
what solution (2) show during revert.<br>
In the descendant case (b), `hg diff --rev (b)`
would be consistent with<br>
what solution (1) show during revert.<br>
<br>
I've to admit that I barely use the (b) case
anymore. I used to need it<br>
to rework stack of patch, but uncommit/fold/etc
are fitting this need<br>
for me now. My biggest usage of `hg revert` is
without a revision to<br>
clean up silly change (debug print) or against
an ancestors to try to<br>
get something to work again.<br>
<br>
The consistency argument is interesting here,
let's widen it. The most<br>
important point to me is the consistency of the
experience across all<br>
commands. Mercurial is a VCS, vcs are mostly
about handling "changes"<br>
(hunks in this context). The vast majority of
command present such<br>
change in the same direction, from parent to
child.<br>
<br>
commands | direction<br>
hg diff | parent -> child<br>
hg diff -r (a) | parent -> child<br>
hg diff -r (b) | child -> parent <-
one exception<br>
</blockquote>
<div><br>
</div>
<div>With this history:</div>
<div>x---a---c<br>
</div>
<div>
<div> \</div>
<div> @---b</div>
</div>
<div><br>
</div>
<div>Currently, it behaves this way (with clean
working copy):</div>
<div>
<div>hg diff -r a | diff from a to @<br>
</div>
<div>hg diff r b | diff from b to @</div>
<div>hg diff -r c | diff from c to @</div>
</div>
<div><br>
</div>
<div>I think you're suggesting:</div>
<div>
<div>hg diff -r a | diff from a to @</div>
<div>hg diff r b | diff from @ to b</div>
<div>hg diff -r c | diff from @ to c</div>
</div>
<div><br>
</div>
<div>I fear that a "hg diff -r a" followed by a
"hg diff -r c" would surprise people, because
the hunks corresponding to changes between @ and
'a' would be reversed between the two
invocations.</div>
</div>
</div>
</div>
</blockquote>
<br>
</div>
<div text="#000000" bgcolor="#FFFFFF"> I'm confused. I'm
not suggesting changing `hg diff` at all. I'm just
pointing at how `hg diff` behave currently and how I think
it is fine to have `hg revert` match this behavior.<br>
<br>
Did you misunderstood me?<br>
</div>
</blockquote>
<div><br>
</div>
<div>Maybe I did misunderstand you. I thought you were arguing
that we 'hg revert -i -r $rev' should show the diff *from*
$rev is $rev is an ancestor (and answering 'yes' *drops* the
hunk), but it should show the diff *to* $rev if it is not an
ancestor (and answering 'yes' *applies* the hunk). Correct?</div>
</div>
</div>
</blockquote>
<br></div><div text="#000000" bgcolor="#FFFFFF">
I'm saying:<br>
<br>
- `hg revert -i --rev X` should show the same diff as `hg diff --rev
X`<br>
- `hg diff --rev X ` should stay unchanged<br>
<br>
This mean "reverse change" when C is a "descendant" From there, it
can be either:<br>
<br>
- Drop the hunk [Yn]<br>
- Keep this hunk [yN]<br></div></blockquote><div><br></div><div>Okay, I see what you're saying (the same thing as you said from the beginning, but I somehow thought you changed your mind a bit). In that case, I maintain that I would be surprised if "hg revert --rev X" where X is a sibling were to show me a diff from X to @. I would expect a diff from @ to X.</div><div><br></div><div>I understand if the word 'revert' makes it sound like you're undoing something, but when X is a sibling, that's not the case (at least for my uses).</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">
<br>
(also keep curse UI in mind)<br>
<br>
This mean the "descendant" case show a strange hunk, but so does `hg
diff` in this case.</div><div text="#000000" bgcolor="#FFFFFF"><br>
<br>
-- <br>
Pierre-Yves David<br>
<br>
<br>
<br>
</div></blockquote></div></div>