1. 12 Mar, 2019 1 commit
    • Martin von Zweigbergk's avatar
      revert: option to choose what to keep, not what to discard · c1d83d916e85
      Martin von Zweigbergk authored
      I know the you (the reader) are probably tired of discussing how `hg
      revert -i -r .` should behave and so am I. And I know I'm one of the
      people who argued that showing the diff from the working copy to the
      parent was confusing. I think it is less confusing now that we show
      the diff from the parent to the working copy, but I still find it
      confusing. I think showing the diff of hunks to keep might make it
      easier to understand. So that's what this patch provides an option
      One argument doing it this way is that most people seem to find `hg
      split` natural. I suspect that is because it shows the forward diff
      (from parent commit to the commit) and asks you what to put in the
      first commit. I think the new "keep" mode for revert (this patch)
      matches that.
      In "keep" mode, all the changes are still selected by default. That
      means that `hg revert -i` followed by 'A' (keep all) (or 'c' in
      curses) will be different from `hg revert -a`. That's mostly because
      that was simplest. It can also be argued that it's safest. But it can
      also be argued that it should be consistent with `hg revert -a`.
      Note that in this mode, you can edit the hunks and it will do what you
      expect (e.g. add new lines to your file if you added a new lines when
      editing). The test case shows that that works.
      Differential Revision: https://phab.mercurial-scm.org/D6125
  2. 02 Feb, 2019 1 commit
  3. 27 Aug, 2017 1 commit
  4. 24 Apr, 2017 1 commit
    • Boris Feld's avatar
      record: update help message to use operation instead of "record" (issue5432) · 51fdedd29b0a
      Boris Feld authored
      Update the hunk selector help message to use the operation name instead
      of using "record" for all operations. Extract the help message in the same way
      as other single and multiple message line.
      Update tests to make sure that both "revert" and "discard" variants are tested.
      branch : stable
  5. 11 Dec, 2017 1 commit
    • Matt Harbison's avatar
      tests: remove (glob) annotations that were only for '\' matches · 4441705b7111
      Matt Harbison authored
      # skip-blame because this was mechanically rewritten the following script.  I
      ran it on both *.t and *.py, but none of the *.py changes were proper.  All *.t
      ones appear to be, and they run without addition failures on both Windows and
        import argparse
        import os
        import re
        ap = argparse.ArgumentParser()
        ap.add_argument('path', nargs='+')
        opts = ap.parse_args()
        globre = re.compile(r'^(.*) \(glob\)(.*)$')
        for p in opts.path:
            tmp = p + '.tmp'
            with open(p, 'rb') as src, open(tmp, 'wb') as dst:
                for line in src:
                    m = globre.match(line)
                    if not m or '$LOCALIP' in line or '*' in line:
                    if '?' in line[:-3] or ('?' in line[:-3] and line[-3:] != '(?)'):
                    dst.write(m.group(1) + m.group(2) + '\n')
            os.rename(tmp, p)
  6. 19 May, 2018 1 commit
  7. 03 Sep, 2018 1 commit
  8. 31 Aug, 2018 1 commit
    • Sushil Khanchi's avatar
      revert: fix the inconsistency of status msgs in --interactive mode · cb70501d8b71
      Sushil Khanchi authored
      Before this patch we were priting every action msg before actually
      performing that action and that was resulting in inconsistencies;
      like in --interactive session if user decided to not revert any
      changes in a file foo, still there will be a msg on console saying
      "reverting foo".
      To fix this, I have made some changes to print status msg just
      before the action it is going to perform, no matter if --interactive
      or not.
      Changes made in test-revert-interactive.t reflect the changed behavior.
      There are also some changes in test-revert.t because of change in the
      order of messages.
      Differential Revision: https://phab.mercurial-scm.org/D4380
  9. 03 Nov, 2017 1 commit
    • Denis Laxalde's avatar
      revert: do not reverse hunks in interactive when REV is not parent (issue5096) · 3649c3f2cd90
      Denis Laxalde authored
      And introduce a new "apply" operation verb for this case as suggested in
      issue5096. This replaces the no longer used "revert" operation.
      In interactive revert, when reverting to something else that the parent
      revision, display an "apply this change" message with a diff that is not
      The rationale is that `hg revert -i -r REV` will show hunks of the diff from
      the working directory to REV and prompt the user to select them for applying
      (to working directory). This contradicts dcc56e10c23b in which it was
      decided to have the "direction" of prompted hunks reversed. Later on
      [1], there was a broad consensus (but no decision) towards the "as to
      be applied direction". Now that --interactive is no longer experimental
      (5910db5d1913), it's time to switch and thus we drop no longer used
      "experimental.revertalternateinteractivemode" configuration option.
      [1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-November/090142.html
      .. feature::
        When interactive revert is run against a revision other than the working
        directory parent, the diff shown is the diff to *apply* to the working directory,
        rather than the diff to *discard* from the working copy. This is in line with
        related user experiences with `git` and appears to be less confusing with
  10. 30 Jun, 2016 1 commit
    • skarlage's avatar
      revert: don't backup if no files reverted in interactive mode (issue4793) · 1b38cfde9530
      skarlage authored
      When reverting interactively, we always backup files before prompting the user
      to find out if they actually want to revert them. This can create spurious
      *.orig files if a user enters an interactive revert session and then doesn't
      revert any files. Instead, we should only backup files that are actually being
  11. 03 Jun, 2016 1 commit
  12. 25 Nov, 2016 2 commits
  13. 05 Feb, 2016 1 commit
    • liscju's avatar
      revert: makes interactive mode ask to forget added files (issue4936) · 79139c7a88bd
      liscju authored
      Before this patch revert interactive mode unconditionally forgets
      added files. This patch fixes this by asking user if he wants
      to forget added file. If user doesn't want to forget given file,
      it is added to matcher_opts exclude list, to not reviewing it
      later with other modified files.
  14. 14 Feb, 2018 1 commit
    • Denis Laxalde's avatar
      revert: use an exact matcher in interactive diff selection (issue5789) · 39b3aab6231e
      Denis Laxalde authored
      When going through _performrevert() in the interactive case, we build a
      matcher with files to revert and pass it patch.diff() for later
      selection of diff hunks to revert. The files set used to build the
      matcher comes from dirstate and accounts for patterns explicitly passed
      to revert ('hg revert -i <file>') and, in case of nonexistent pattern,
      this set is empty (which is expected). Unfortunately, the matcher built
      from scmutil.match(ctx, []) is wrong as it leads patch.diff() to rebuild
      a 'changes' tuple with dirstate information, ignoring user-specified
      pattern. This leads to the situation described in issue5789, where
      one gets prompted about reverting files unrelated to specified patterns
      because they made a typo or so.
      We fix this by building an exact matcher with the correct set of file
      paths (built earlier). Thanks to Yuya Nishihara for suggesting the
      correct fix.
  15. 11 Feb, 2018 1 commit
  16. 11 Apr, 2015 1 commit
  17. 25 Mar, 2015 1 commit
  18. 17 Oct, 2016 1 commit
  19. 06 Mar, 2017 1 commit
    • Denis Laxalde's avatar
      revert: always display hunks reversed when reverting to parent · 3af9a9628ecf
      Denis Laxalde authored
      When reverting to the parent of working directory, operation is "discard" so
      we want hunks to be presented in the same order as the diff (i.e. "reversed").
      So we do not query the experimental.revertalternateinteractivemode option in
      this case and always set "reversehunks" to True.
  20. 21 Mar, 2015 1 commit
    • Matt Harbison's avatar
      test-interactive: use stable EOL in various file generating routines · f169405c03ab
      Matt Harbison authored
      The seq.py and shell echo redirected to a file ends up with platform
      specific EOL, which throws off the hash when the file is committed to
      the test repo on Windows. The other option is to glob the hashes, but
      the ability to see if they have changed might point out problems that
      would otherwise be missed.
  21. 19 Mar, 2015 1 commit
  22. 18 Mar, 2015 1 commit
  23. 16 Mar, 2015 1 commit
  24. 23 Jun, 2015 2 commits
    • Laurent Charignon's avatar
      revert: change the direction of revert -i · dcc56e10c23b
      Laurent Charignon authored
      After the discussion on the list about hg revert -i, it seems like we are
      satisfied with what we called proposition 2. It shows the changes to revert in
      the same direction as hg diff. This patch makes it the default option.
      It changes all the + in - and vice versa in the tests for revert -i.
    • Laurent Charignon's avatar
      revert: change a test to make the change of direction of revert -i easier · 88d244f4edfd
      Laurent Charignon authored
      Currently we are handling editing of newly-added files with the interactive
      interface. We are not handling editing of deleted files. In the test for revert,
      we were editing a newly-added file. Since we want to change the direction of
      revert -i, this editing of a newly-added file will become editing of a deleted file.
      Since we don't support that, this patch changes the test to make the rest of
      the series cleaner.
  25. 29 May, 2015 2 commits
  26. 27 May, 2015 1 commit
  27. 21 May, 2015 2 commits