color: consolidate cut-and-paste code
This fixes a mild case of cut-and-paste code regarding failing to set
terminal modes. This is evident in the win32 comment that is misplaced
for the terminfo mode since cset
ad6ad51cc0dd.
Instead, we refactor this C&P into a small local function.
record: move parsepatch from record to patch
Part of a series of patches to move record from hgext to core
record: move scanpatch from record to patch
Part of a series of patches to move record from hgext to core
record: move hunk class from record to patch
Part of a series of patches to move record from hgext to core
record: move countChanges in the hunk class
Part of a series of patches to move record from hgext to core
record: move header class from record to patch
Part of a series of patches to move record from hgext to core
cmdutil.tryimportone: allow importing relative patches into the working dir
This makes hg import --prefix dir/ (without bypass) work.
commands.import: accept a prefix option
The --prefix option is meant to be relative to the root rather than the current
working directory. This is for consistency with the rest of 'hg import' --
paths in patches are otherwise considered to be relative to the root.
In upcoming patches we'll hook this option up to the patch functions.
--exact with --prefix is currently disallowed because I can't really come up
with sensible semantics for it, especially when only part of the patch is
preserved.
test: make version based test-extensions failure more explanatory
A buggy __version__ content (usually from setup.py's hg being unable to read the
repo) can make this test fails in an obscure manner. We make the root of the
failure more explicit.