Commit Graph

16 Commits

Author SHA1 Message Date
Yuya Nishihara
ed7051c6c7 tests: write hgrc of more than two lines by using shell heredoc
Here document should be readable than repeating echo commands.
2014-11-04 23:41:46 +09:00
Mads Kiilerich
29285eb86d ui: show prompt choice if input is not a tty but is forced to be interactive
The tests often set ui.interactive to control normally interactive prompts from
stdin. That gave an output where it was non-obvious what prompts got which
which response, and the output lacked the newline users would see after input.

Instead, if the input not is a tty, write the selection and a newline.
2014-10-01 01:04:18 +02:00
Jordi Gutiérrez Hermoso
60df7a50e9 patch: enable diff.tab markup for the color extension
The following patch splits up changed lines along tabs (using
re.findall), and gives them a "diff.tab" label. This can be used by
the color extension for colorising tabs, like it does right now with
trailing whitespace.

I also provide corresponding tests.
2014-08-20 15:15:50 -04:00
Simon Heimberg
09ff06d669 tests: remove glob lines which unnecessary match / for \ on windows
This lines were reported as unnecessary when running the tests on windows
because the path was already printed with a slash and not a backslash.
2013-02-23 22:54:57 +01:00
Mads Kiilerich
24be691647 tests: fix windows test failures 2012-12-28 14:10:35 +01:00
FUJIWARA Katsunori
b81a7802fd subrepo: add argument to "diff()" to pass "ui" of caller side (issue3712) (API)
Color extension achieves colorization by overriding the class of
"ui" object just before command execution.

Before this patch, "diff()" of abstractsubrepo and classes
derived from it has no "ui" argument, so "diff()" of hgsubrepo
uses "self._repo.ui" to invoke "cmdutil.diffordiffstat()".

For separation of configuration between repositories, revision
1498948ee815 changed the initialization source of "self._repo.ui"
from "ui"(overridden) to "baseui"(plain) of parent repository.
And this caused break of colorization.

This patch adds "ui" argument to "diff()" of abstractsubrepo and
classes derived from it to pass "ui" object of caller side.
2012-11-30 00:43:55 +09:00
Mads Kiilerich
fa1c4e5ebe tests: add missing trailing 'cd ..'
Many tests didn't change back from subdirectories at the end of the tests ...
and they don't have to. The missing 'cd ..' could always be added when another
test case is added to the test file.

This change do that tests (99.5%) consistently end up in $TESTDIR where they
started, thus making it simpler to extend them or move them around.
2012-06-11 01:40:51 +02:00
Mads Kiilerich
4f14a0a969 tests: convert some 'hghave execbit' to #if
This enables some new tests for running on windows.
2012-06-10 14:14:05 +02:00
A. S. Budden
285680e0f0 record: allow splitting of hunks by manually editing patches
It is possible that unrelated changes in a file are on sequential lines.  The
current record extension does not allow these to be committed independently.

An example use case for this is in software development for deeply embedded
real-time systems.  In these environments, it is not always possible to use a
debugger (due to time-constraints) and hence inline UART-based printing is
often used.  When fixing a bug in a module, it is often convenient to add a
large number of 'printf's (linked to the UART via a custom fputc) to the module
in order to work out what is going wrong.  printf is a very slow function (and
also variadic so somewhat frowned upon by the MISRA standard) and hence it is
highly undesirable to commit these lines to the repository.  If only a partial
fix is implemented, however, it is desirable to commit the fix without deleting
all of the printf lines.  This is also simplifies removal of the printf lines
as once the final fix is committed, 'hg revert' does the rest.  It is likely
that the printf lines will be very near the actual fix, so being able to split
the hunk is very useful in this case.

There were two alternatives I considered for the user interface.  One was to
manually edit the patch, the other to allow a hunk to be split into individual
lines for consideration.  The latter option would require a significant
refactor of the record module and is less flexible.  While the former is
potentially more complicated to use, this is a feature that is likely to only
be used in certain exceptional cases (such as the use case proposed above) and
hence I felt that the complexity would not be a considerable issue.

I've also written a follow-up patch that refactors the 'prompt' code to base
everything on the choices variable.  This tidies up and clarifies the code a
bit (removes constructs like 'if ret == 7' and removes the 'e' option from the
file scope options as it's not relevant there.  It's not really a necessity, so
I've excluded it from this submission for now, but I can send it separately if
there's a desire and it's on bitbucket (see below) in the meantime.

Possible future improvements include:

* Tidying up the 'prompt' code to base everything on the choices variable.
  This would allow entries to be removed from the prompt as currently 'e' is
  offered even for entire file patches, which is currently unsupported.
* Allowing the entire file (or even multi-file) patch to be edited manually:
  this would require quite a large refactor without much benefit, so I decided
  to exclude it from the initial submission.
* Allow the option to retry if a patch fails to apply (this is what Git does).
  This would require quite a bit of refactoring given the current 'hg record'
  implementation, so it's debatable whether it's worth it.

Output is similar to existing record user interface except that an additional
option ('e') exists to allow manual editing of the patch.  This opens the
user's configured editor with the patch.  A comment is added to the bottom of
the patch explaining what to do (based on Git's one).

A large proportion of the changeset is test-case changes to update the options
reported by record (Ynesfdaq? instead of Ynsfdaq?).  Functional changes are in
record.py and there are some new test cases in test-record.t.
2012-03-30 22:08:46 +01:00
Mads Kiilerich
adfff587c7 tests: use 'hghave execbit' for tests that manipulate x bit in file system 2011-11-07 03:14:54 +01:00
Mads Kiilerich
6260903881 tests: cleanup of echo statements left over from test conversion 2011-10-13 04:27:49 +02:00
Danek Duvall
e826f21afa color: add support for terminfo-based attributes and color
Using terminfo instead of hard-coding ECMA-48 control sequences provides a
greater assurance that the terminal codes are correct for the current
terminal type; not everything supports the ANSI escape codes.

It also allows us to use a wider range of colors when a terminal emulator
supports it (such as 16- or 256-color xterm), and a few more non-color
attributes, such as the ever-popular blink.
2011-04-21 13:47:45 -07:00
Martin Geisler
73d96c7696 ui: label prompts, default to yellow prompts 2011-03-27 12:59:25 +02:00
Gilles Moris
dcdc58f0a5 rollback: clarifies the message about the reverted state (issue2628)
Previously, when rolling back a transaction, some users could be confused
between the level to which the store is rolled back, and the new parents
of the working directory.

  $ hg rollback
  rolling back to revision 4 (undo commit)

With this change:
  $ hg rollback
  repository tip rolled back to tip revision 4 (undo commit)
  working directory now based on revision 2 and 1

So now the user can realize that the store has been rolled back to an older
tip, but also that the working directory may not on the tip (here we are
rolling back the merge of the heads 2 and 1)
2011-02-10 09:03:06 +01:00
Mads Kiilerich
635406bf76 tests: use (esc) for all non-ASCII test output 2010-11-08 01:41:41 +01:00
Matt Mackall
6c4eda22f1 tests: unify test-diff-color 2010-09-26 13:41:32 -05:00