run-test: restore the -i prompt by write .err before checking if it exists

The `--interactive` flag workis by overwriting the original test file by its
`.err` version. So we need to write it before calling `self.fail`. Otherwise the
`.err` file does not exists and `--interactive` is ignored.

We can move that block code around because it is dedicated to write changed
output and we moves it in the try-except dedicated to handling changed output.

Note that the flog is still badly broken after this change. But at least it crash
instead of being ignored.

--HG--
extra : rebase_source : a50df474719c4b63aebe7b52ba53655f8601c267
extra : histedit_source : 7ecfa82cd4ff0d1bef80417b2ec5e2b2541871bb
run-test: fix AttributeError in the --interactive prompt

One must choose between ``"y yes".split()`` and ``('y', 'yes')``. I choose the
later.

The feature still crash when you answer "yes" to use it. But at least, the
prompt itself works.

--HG--
extra : rebase_source : 1872923689b4c0569ec45b23affa2a30a5456060
extra : histedit_source : b5987f330398ee6023f9945b75e1178579f72bc5
run-tests: fix --interactive option

``TTest._testpath`` never existed. This must be the remain of some contributors
side refactoring.

--HG--
extra : rebase_source : 48801e59935ac12053eb69bf1c696e9596fa791a
extra : histedit_source : 3b2588de542e3888f52b84e28bab354960f1fe8b
merge: change priority / ordering of merge actions

The ordering of actions matters. Normal file system semantics is that files
have to be removed before a directory with the same name can be created.

Before the first ordering key was to have 'r' and 'f' actions come first,
secondary key was the filename.

Because of future refactorings we want to consistently have all action types
(with a sensible priority) as separate first keys. Grouped by action type, we
sort by filename.

Not processing in strict filename order could give worse performance,
especially on spinning disks. That is however primarily an issue in the cases
where "all" actions are of the same kind and will be grouped together anyway.

--HG--
extra : rebase_source : 59434bf94cac42ee10f2712551402a75f6f15bf2
extra : histedit_source : b96e2333c6f319aed2da2f65950d153c36dd3275
merge: move constant assignments a bit and use them more

--HG--
extra : rebase_source : af17ef66941a8b4c1289080e9ad7c614f6727380
extra : histedit_source : 70ec86ad69b9e7f7888b7dcc8e20f6f3a1d1d061
merge: change debug logging - test output changes but no real changes

Preparing for action list split-up, making sure the final change don't have any
test changes.

The patch moves debug statements around without really changing anything.
Arguably, it temporarily makes the code worse. The only justification is that
it makes it easier to review the test changes ... and in the end the big change
will not change test output at all.

The changes to test output are due to changes in the ordering of debug output.
That is mainly because we now do the debug logging for files when we actually
process them. Files are also processed in a slightly different but still
correct order. It is now primarily ordered by action type, secondarily by
filename.

The patch introduces some redundancy. Some of it will be removed again, some of
it will in the end help code readability and efficiency. It is possible that we
later on could introduce a "process this action list and do some logging and
progress reporting and apply this function".

The "preserving X for resolve" debug statements will only have single space
indentation. It will no longer have a leading single space indented "f: msg ->
m" message. Having this message double indented would thus no longer make
sense.

The bid actions will temporarily be sorted using a custom sort key that happens
to match the sort order the simplified code will have in the end.

--HG--
extra : rebase_source : c374c16f2685d647a4b999b8921cc4ab2d0deeea
extra : histedit_source : fb8b0edda8e78826a0ed26738510df4bf7dff772
merge: separate worker functions for batch remove and batch get

The old code had one function that could do 2 different things. First,
is was called a bunch of times to do one thing. Next, it was called a
bunch of times to do the other thing. That gave unnecessary complexity
and a dispatch overhead. Having separate functions is "obviously" better
than having a function that can do two things, depending on its parameters.
It also prepares the code for the next refactorings.

--HG--
extra : rebase_source : c30bd524031b095b9d2d5adf1a0211db72d54c2e
extra : histedit_source : 789cf8c49759bcdf6e66eed3e34f0cebc95e98f7
localrepo: move symlink logic to workingctx

--HG--
extra : rebase_source : 75380e47bc4cd94456e09c1040963c9797a2ec1e
extra : source : 5be2f3f0d4707877ced3fc9868764e9149082915
extra : histedit_source : ecb63d97d274557a58218dc335c30b318c4211af
localrepo: improve dirstate.normal lookup by cacheing the function

--HG--
extra : rebase_source : 5a3cd65e58b8454a77e9da325d723f2eb4261e8a
extra : amend_source : 3c01e6c09a521af38eae45c30817f481c3f322cd
extra : source : f097790c8ed6784d6635483d88b4a3f396396218
extra : histedit_source : d8182ac599ab911f96449392355522cbb559b607
localrepo: factor out parentworking logic for comparing files

We will temporarily call a private method of the context class while we are in
the process of removing the need of having localrepo.status.

--HG--
extra : rebase_source : 85e05973ce3df0b93d1b5e3d3945a21411f09fa4
committablectx: move status to workingctx

This method was accidentally placed into the committablectx class. It contains
logic for querying the dirstate so we move it to the correct class.

--HG--
extra : rebase_source : 098d52c6dcb8993118f7e385a231ff4b5363bafa
context: add private _dirstatestatus method

This patch is a step forward in getting rid of needing to check 'parentworking'
throughout the status method. Eventually, we will use the power of inheritance
to do the correct thing when comparing the working directory with its parent.

This method is mostly a copy from localrepo.status. The custom status method of
workingctx will eventually be absorbed by the refactoring of localrepo.status
to context.status but unfortunately we can't do it in one step.

--HG--
extra : rebase_source : 9d4662fa3ede191accee9fcf135d50e3580623b9
workingctx: call _dirstatestatus in status

Rip out the call from workingctx.status to localrepo.status.

--HG--
extra : rebase_source : 303fff80c30cdf7547b29e9e892749722999dca5
localrepo: call _dirstatestatus instead of duplicating logic

--HG--
extra : rebase_source : 02c9f9dc512d9e397b1f42579dec3d27a795dfd0
subrepo: add shortid() method to subrepo classes

This method takes an "id" (e.g. a revision id) and returns a "short" version
(e.g. a short revision id).

This will be used on the next revision to fix a small bug in the way that the
text on the promptchoice shown when a subrepo diverges is generated.

--HG--
extra : rebase_source : b6d20e942c07e0bcf47a8ae502628004e7038f69
subrepo: use subrepo shortid method to generate subrepo diverged promptchoice

We were always using only the first 12 characters of the subrepo revision id
when generating the "subrepo diverged" promptchoice. This is not necessarily
correct for non mercurial subrepos.

--HG--
extra : rebase_source : a40f1f60ed88bf5d8b34d7227a83406b63170c20
help: add additional information in the merge-tools section of config help

The merge tool configuration in general has always been a confusing topic for
user. We add mention of:
- possible pre-existing configuration,
- way to look at it,
- the more detailed help topic about how merge-tools configuration works.

This should help users find they way.

--HG--
extra : rebase_source : b007e00ece8e8e0ccb31bc6a94664b4332d0eac2
doc: improves merge-tools example with an overwrite of existing config

We highlight the fact that a user hgrc can overwrite the system wide
preconfiguration. As other benefit we show priority value other than 1 and shows
vimdiff configuration is usually directly available. This is valuable as vimdiff
is (surprisingly) a common request from user.

--HG--
extra : rebase_source : 38ec5ab9d3c3e406d09b9eeb3957b262bf0a9559
update: when deactivating a bookmark, print a message

This helps prevent user confusion when innocent-seeming commands like
'hg update -C .' are run.

--HG--
extra : rebase_source : c5d6bf2080ea2b1d846ed5f7e71346cbfffe17d1
cmdutil: introduce "getcommiteditor()" to simplify code paths to choose editor

"getcommiteditor()" can simplify code paths to choose commit editor
according to '--edit' option as below:

    before:
        editor = cmdutil.commiteditor # or editor = None/False
        if opts.get('edit'):
            editor = cmdutil.commitforceeditor

    after:
        editor = cmdutil.getcommiteditor(**opts)

"getcommiteditor()" accepts option arguments not in "opts" style but
in "**opts" style, because some code paths want to invoke it with just
explicit "edit=True" argument (building dictionary is redundant).

--HG--
extra : rebase_source : 026c09ca9c732c4feb15cb36181e4a207bcfe924