<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <br>
    <div class="moz-cite-prefix">On 05/26/2015 02:02 PM, Martin von
      Zweigbergk wrote:<br>
    </div>
    <blockquote
cite="mid:CAESOdVDRPCQOd2z0jsemOx8=jGaaRks0tT4h069cfr1owYjDvg@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <div dir="ltr"><br>
        <br>
        <div class="gmail_quote">On Tue, May 26, 2015 at 1:43 PM
          Pierre-Yves David <<a moz-do-not-send="true"
            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 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 moz-do-not-send="true"
                      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 moz-do-not-send="true"
                        href="mailto:pierre-yves.david@ens-lyon.org"
                        target="_blank">pierre-yves.david@ens-lyon.org</a>
                      <mailto:<a moz-do-not-send="true"
                        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>
    <blockquote
cite="mid:CAESOdVDRPCQOd2z0jsemOx8=jGaaRks0tT4h069cfr1owYjDvg@mail.gmail.com"
      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><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>
    And will you often use `-i` for that?<br>
    <br>
    <blockquote
cite="mid:CAESOdVDRPCQOd2z0jsemOx8=jGaaRks0tT4h069cfr1owYjDvg@mail.gmail.com"
      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>
    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>
    <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.<br>
    <br>
    -- <br>
    Pierre-Yves David<br>
    <br>
    <br>
    <br>
  </body>
</html>