shelve: remove useless and incorrect code paths for file access
This patch removes code paths in "shelvedfile.opener()", because:
- explicit "vfs.mkdir()" invocation is useless
"vfs.__call__()" for modes other than "read" creates parent
directory of target file automatically by "util.ensuredirs()".
- mode checking in "except IOError" code path is useless
ENOENT occurs only for "read" mode, because target file is
created forcibly for other modes.
- there is no explicit "return" statement in the code path for
"except IOError" if "mode[0] in 'wa'"
this is incorrect, because None may be returnd unexpectedly,
even though it seems the EEXIST case in the directory creation
race for ".hg/shelved" and is very rare.
this directory creation race is also treated in
"util.ensuredirs()".
shelve: disallow commit while unshelve is in progress
Before this patch, commit is allowed even while unshelve is in
progress.
In the other hand, "hg unshelve --abort" and "hg unshelve --continue"
check whether parent revisions of the working directory have changed
or not since last "hg unshelve", and abort without clearing state for
unshelve in progress if they have.
This causes that accidental commit makes clearing state for unshelve
difficult in ordinary ways.
This patch disallows commit while unshelve is in progress for
consistency.
shelve: use rebase instead of merge (
issue4068)
Previously, shelve used merge to unshelve things. This meant that if you shelved
changes on one branch, then unshelved on another, all the changes from the first
branch would be present in the second branch, and not just the shelved changes.
The fix is to use rebase to pick the shelve commit off the original branch and
place it on top of the new branch. This means only the shelved changes are
brought across.
This has the side effect of fixing several other issues in shelve:
- you can now unshelve into a file that already has pending changes
- unshelve a mv/cp now has the correct dirstate value (A instead of M)
- you can now unshelve to an ancestor of the shelve
- unshelve now no longer deletes untracked .orig files
Updates tests and adds a new one to cover the issue. The test changes fall into
a few categories:
- I removed some excess output
- The --continue/--abort state is a little different, so the parents and
dirstate needed updating
- Removed some untracked files at certain points that cluttered the output
doc: put text into header of 1st column in table to generate page correctly
>From the table without header text of 1st column, docutils generates
the table with fully empty header row.
doc: use double quotation mark to quote arguments in examples for Windows users
On Windows, only double quotation mark can quote command line
arguments.
So, this patch uses double quotation mark to quote command line
arguments in all examples of online help document.