magit-discard: act on staged hunks despite unstaged changes

`git apply --index' refuses to apply any patches if the file to be
patched is not up-to-date.  But in many cases that would work without
any conflicts.  So when there are both stages as well as unstaged
changes and the user requests that a staged change is discarded,
first discard it in the index only using `--cached' and then also
attempt to do so to the working tree.  If the second step fails
due to conflicts, then the result is equivalent to unstaging,
which isn't so bad.
magit-{file-tracked-p,{,un}tracked-files}: new functions
magit-{headish,{modified,staged}-files}: new functions
allow inhibiting refreshes

Add new variable `inhibit-magit-refresh'.
When it is non-nil `magit-refresh' now does nothing.
magit-git-repo-p: new function

This function used to exist before but was removed because it did
neither do what its name suggests nor what its only caller expected
(which wasn't the same).  Now this function returns t for any Git
repository and it also has a doc-string.
improve magit-submodule-popup and its commands

Rename `magit-submodule-update-init' to `magit-submodule-setup',
change order of command definitions and of actions in the popup,
and improve doc-strings.
magit-submodule-add: new command
magit-unstage-1: new function
magit-{,un}stage-file: new commands

Remove the ability to stage something other than the change at point
from `magit-stage' and instead add the new command `magit-stage-file',
which stages the file at point, if any, and else prompts for one.

Likewise create `magit-unstage-file'.  (Since `magit-unstage' never
allowed picking a file in the minibuffer, we don't have to touch that.)
reduce nesting inside "Apply" section

Section "Apply" is itself a subsection of toplevel "Porcelain", and was
previously divided into "Apply Commands" and "Apply Core".  This soon
won't make sense anymore, since many functions that were located inside
the latter will be turned into commands.

Move the definition of `magit-apply' next to the other functions that
are used for "applying, in the strict *and* loose sense" (other
functions, in other subsections do e.g. "stage" changes, which isn't the
same as applying in the strict sense, but is implemented by using the
low-level "apply" functions never-the-less.  These generic apply
functions were previously located in the "Apply Core" subsection).
Also move the definition of `magit-discard-diff'.
magit-{apply-{diff,hunk},insert-{*}}: name argument SECTION

Rename the arguments DIFF and HUNK of `magit-apply-diff',
`magit-apply-hunk', and the related `magit-insert-{*}'s to SECTION.

It isn't obvious that these functions expect section objects (strings
would also make sense).  However once we know that some kind of section
is expected, it is obvious what kind of section that is.
replace section types `file', `diff', and `diffstat' with just `file'
add support for per-section-type keymaps

Teach `magit-insert-section' to detect whether a keymap is defined
for the section being inserted and if so propertize the section's text
accordingly using the `keymap' text property.  The keymap variable has
to be named `magit-TYPE-section-map'.

Also define several such section keymaps.  The bindings will be added
in subsequent commits, when we move away from `magit-section-action',
which provides a similar but less flexible and more complicated way to
accomplish the same.
magit-hunk-section-map: add binding for magit-commit-add-log

Bind `magit-commit-add-log' in `magit-hunk-section-map' instead
of `magit-status-mode-map', because it only works on hunks.
bind magit-{,un}stage{,-file} in the appropriate keymaps

In the most useful spots for un-/staging (i.e. "inside diffs") act
on the change at point using `magit-{,un}-stage'. Elsewhere give
the user the opportunity to stage arbitrary files.
drop support for overloading magit-dired-jump

In `magit-dired-jump' use `magit-section-case' instead of
`magit-section-action'.  In the unlikely case that a third-party
extension needs to use the same binding to do something on a
section type unknown to us, section text property keymaps are
an option.
drop support for overloading magit-copy-as-kill

In `magit-copy-as-ill' use `magit-section-when instead of
`magit-section-action'.  In the unlikely case that a third-party
extension needs to use the same binding to do something with a
section type unknown to us, section text property keymaps are
an option.
no longer overload magit-cherry-pick

Previously `magit-cherry-pick' did cherry-pick the commit at point, or
if the section at point was a stash it did pop that stash.  Popping a
stash has nothing to do with cherry-picking, and since the name of this
function rather explicitly says that it does cherry-pick it should not
pop stashes too.  But it does indeed make sense to use the same key to
invoke these two technically unrelated actions, because from a user
perspective they do something "similar".

Replace the old `magit-cherry-pick' with what `magit-cherry-pick-commit'
used to do, but be a bit smarter about it.  Remove the latter.

Use the new "section keymap" functionality added in the previous commit
a first time.  Pressing "A" on a stash no longer uses the buffer-wide
binding `magit-cherry-pick' but instead uses `magit-stash-pop', as bound
in the new `magit-stash-section-map'.  Also bind `magit-cherry-pick' in
the new `magit-commit-section-map', but that is actually redundant.
remove magit-rename in favor of section keymaps
remove magit-visit in favor of section keymaps

Also turn `magit-visit-file' into a command, which now knows
how to do the right thing with the file or hunk at point.