Commit Graph

125 Commits

Author SHA1 Message Date
Mads Kiilerich
99c7bacd5e color: don't fail on error messages when no curses (issue4237)
The error only occured when Python didn't have curses - such as on Windows and
when Python was built without curses support.

No curses can also be emulated by (re)moving .../lib/python2.7/curses/ from the
Python installation.

It is left as an exercise to figure out exactly what changed in Mercurial that
triggered this error.
2014-05-03 03:29:30 +02:00
Yuya Nishihara
178ed58ae3 color: add missing handling of stderr capture introduced by 1428763bd397
It wouldn't raise exception without this change, but _bufferstates was wrong
because of missing _bufferstates.pop() in colorui.popbuffer().
2014-04-27 15:09:48 +09:00
Sean Farley
52b090aab5 color: add effect to the template symbol table
Previously, words like 'red' had to be protected by quotes before passing to
the label template function. Now, we add color effects to the symbol table so
that commands like,

$ hg log -r . -T "{label(red, node|short)}\n"

can work without the need for quoting.
2014-04-14 18:21:26 -05:00
Mads Kiilerich
0e8795ccd6 spelling: fixes from spell checker 2014-04-13 19:01:00 +02:00
Sean Farley
7e42d683fc color: fallback and test label as an effect
With this changeset, we can now send a color name directly to the label
function, e.g.

$ hg log -r . -T "{label('red', node|short)}\n"
2014-04-07 15:37:27 -05:00
Sean Farley
cd91f87125 color: extract method for determining a valid effect
This patch is just setup work so that we can reduce code duplication and have
one place to define a valid effect.
2014-04-07 15:33:46 -05:00
Matt Mackall
3672c23fd5 merge with stable 2014-03-11 16:19:08 -05:00
FUJIWARA Katsunori
7a7d1bc22c templater: avoid recursive evaluation of string literals completely
Changeset c84f81c3e120 (released with 2.8.1) fixed "recursively
evaluate string literals as templates" problem (issue4103) by
introducing "_evalifliteral()".

But some parts in template expressions below are still processed by
the combination of "compiletemplate()" and "runtemplate()", and may
cause same problem unexpectedly.

  - 'init' and 'hang' of 'fill(text, width, init, hang)'
  - 'expr' of 'sub(pat, repl, expr)'
  - 'label' of 'label(label, expr)'

This patch processes them by "_evalifliteral()" instead of the
combination of "compiletemplate()" and "runtemplate()" to avoid
recursive evaluation of string literals completely.
2014-03-10 01:01:42 +09:00
Olle Lundberg
06c09b1727 color: add debugcolor command (issue4094)
This patch adds a debugcolor command that prints all
colors that the extension knows about.
2014-02-12 01:00:51 +01:00
Matt Mackall
52dafe7a2a templater: only recursively evaluate string literals as templates (issue4103) 2013-11-18 15:37:09 -05:00
David Soria Parra
72600cc4d7 shelve: add a shelve extension to save/restore working changes
This extension saves shelved changes using a temporary draft commit,
and bundles the temporary commit and its draft ancestors, then
strips them.

This strategy makes it possible to use Mercurial's bundle and merge
machinery to resolve conflicts if necessary when unshelving, even
when the destination commit or its ancestors have been amended,
squashed, or evolved. (Once a change has been unshelved, its
associated unbundled commits are either rolled back or stripped.)

Storing the shelved change as a bundle also avoids the difficulty
that hidden commits would cause, of making it impossible to amend
the parent if it is a draft commits (a common scenario).

Although this extension shares its name and some functionality with
the third party hgshelve extension, it has little else in common.
Notably, the hgshelve extension shelves changes as unified diffs,
which makes conflict resolution a matter of finding .rej files and
conflict markers, and cleaning up the mess by hand.

We do not yet allow hunk-level choosing of changes to record.
Compared to the hgshelve extension, this is a small regression in
usability, but we hope to integrate that at a later point, once the
record machinery becomes more reusable and robust.
2013-08-29 09:22:13 -07:00
Simon Heimberg
a9f4d5238f color: use pythons isinstance method instead of reprogramming it 2013-06-05 22:06:16 +02:00
Simon Heimberg
ece17e9392 color: only provide the required opt to _modesetup 2013-06-05 22:06:02 +02:00
Bryan O'Sullivan
fdf311e2c6 summary: add a histedit hook 2013-05-14 11:23:18 -07:00
Bryan O'Sullivan
33e74866b9 summary: indicate if a rebase is underway 2013-05-14 11:23:17 -07:00
Siddharth Agarwal
dd5ad83252 color: set _colormode to None when mode is unset (issue3895)
Previously, colorui assumed that it would only be called when mode wasn't
None. 255b770b2eff changed that, so now colorui needs to care about whether it
should colorize output.
2013-04-19 16:57:10 -07:00
Siddharth Agarwal
423eaf6e61 color: turn colorui functions into forwards when color is None
colorui will be set to None as necessary in an upcoming patch.
2013-04-19 16:57:20 -07:00
Simon Heimberg
7edcf8a9d5 color: set the ui class in reposetup, before a repo is created
Previously only the class of repo.ui was set. The class was set in the wrapper
of dispatch._runcommand. But this is called after the repo is created. Only
the class of repo.ui is set because repo.baseui already exists and is not
accessible.
We now set the class in uisetup because this is called before repo creation.
This is also the place suggested in the wiki for modifying classes.
2013-04-18 23:53:24 +02:00
Bryan O'Sullivan
cb3da91764 color: add missing import of error
Found using Cython.
2013-04-12 17:27:09 -07:00
Simon Heimberg
0f30974d2c color: drop unnecessary global statement 2013-03-21 18:16:49 +01:00
Sean Farley
96729d25e1 color: add template label function 2012-12-28 19:25:10 -06:00
Idan Kamara
1d290d6e7b grep: colorize all fields
Colors were picked in accordance to GNU grep.
2012-10-14 20:27:55 +02:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Augie Fackler
68654a2ef6 color: Use the same GPL boilerplate as most hg files 2012-01-02 19:30:21 -06:00
Marc Simpson
90aacaccca color: add styles for tags 2011-08-21 20:40:10 +01:00
Andrei Vermel
13bbba1de3 color.py - clear _terminfo_params in win32 mode 2011-07-29 15:36:27 +04:00
Brodie Rao
e231f6710d color: for the sake of "less -R", default to ansi in auto mode (issue2792)
less with the -R option only supports ANSI color codes, and terminfo
mode issue non-ANSI color codes (depending on the database). The -r
option can work around this, but there are users currently using the
-R option, and defaulting to terminfo would break colorization in less
for them without warning.
2011-06-29 13:20:40 -04:00
Brodie Rao
5123ea27df color: fix TypeError with auto mode on win32 when colors aren't available (issue2871)
This can happen when stdout isn't a terminal (e.g., it's being piped).
2011-06-29 13:20:39 -04:00
Danek Duvall
748bbc348d color: be silent when falling back to ECMA-48 mode if "auto" mode was desired
Don't warn about missing setab/setaf terminfo entries unless we explicitly
asked for terminfo mode; fallback to ECMA-48 mode silently.
2011-06-27 11:36:42 -07:00
Idan Kamara
2b3f15b0fa color: check if ui is already a subclass of colorui before wrapping it
since it's possible to reuse the ui object (see 6772a32edec7)
between dispatch calls, the ui might have been wrapped already.

we could probably move this test up a bit but leaving it here
allows updates to take effect by extstyles() and configstyles().
2011-06-02 00:43:34 +03:00
Peter Arrenbrecht
421dba9540 color: fix --color=always when output is piped
Also restructures the mode determination as discussed on IRC.
I tried to simplify the code too, while keeping the original
semantics except for the case of --color=always.
2011-05-25 18:48:00 +02:00
Dan Villiom Podlaski Christiansen
261e0642d3 color: fix using multiple effects 2011-05-01 16:54:48 +02:00
timeless
ab34ee7694 remove unused imports 2011-05-01 15:21:57 +02:00
Brodie Rao
5a336c7b00 color: use ui.formatted() to test TTYness, not sys.stdout.isatty()
This fixes the color extension not working with pager (broken in
cab5f9b68e3a). The pager extension already sets ui.formatted=True to
allow this use case.
2011-05-01 12:14:22 +02:00
Augie Fackler
720e112a65 color: verify stdout is a tty before using curses
Without this change, curses complains when invoked in certain contexts
because stdout isn't a tty (such as emacs integration) but we ask it
to check for various bits of information from terminfo.
2011-04-30 11:18:43 -05:00
Patrick Mezard
44388c0fa1 color: code simplification 2011-04-24 23:06:19 +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
Idan Kamara
35892dd390 color: reset win32 console color in a finally block 2011-04-09 23:53:23 +03:00
Martin Geisler
73d96c7696 ui: label prompts, default to yellow prompts 2011-03-27 12:59:25 +02:00
Matt Mackall
a1c69b99f5 merge with stable 2011-03-14 15:59:44 -05:00
Martin Geisler
2009744e21 color: wrap lines in docstring 2011-03-14 15:19:58 +01:00
Martin Geisler
e450b1ed50 color: don't mention internal function in docstring
The render_text function actually never existed, the docstring
probably meant the render_effects function instead.
2011-03-14 13:54:25 +01:00
Adrian Buehlmann
62ca9f7af6 color: port to using ctypes (issue2687)
replacing usage of pywin32, which was removed for Mercurial 1.8
2011-03-11 11:14:21 +01:00
Matt Mackall
574616ca42 bookmarks: move color style to color 2011-02-10 13:46:28 -06:00
Martin Geisler
f260637139 color: give hint to translators about untranslated keywords 2010-10-22 16:34:38 +02:00
Brodie Rao
32f9e577c3 color: add global option in extsetup() instead of globally
This prevents side effects from occurring when importing the color
extension.
2010-10-10 12:21:36 -05:00
Sune Foldager
060a59a3cc merge with stable 2010-09-13 16:25:13 +02:00
Sune Foldager
cd1204adbe color: add win32 support for non-black background
This complicates the code a bit, since attributes need to be masked together
correctly before they are applied. Perhaps the code should be redesigned at
some point, but this works well for now.
2010-09-13 16:12:25 +02:00
Brodie Rao
5a1e1994ac help: refer to user configuration file more consistently
Currently, a number of commands and help topics mention the user hgrc
file in different ways. Among these are following:

1. .hgrc - "please specify your commit editor/username in your .hgrc
file", bookmarks, color, hgk, pager, hg help environment

2. $HOME/.hgrc - hg help paths, hgrc(5), hg(1)

3. ~/.hgrc - hgrc(5)

In addition to being inconsistent, none of these make sense on
Windows. This patch replaces the above with a more general term of
"[your] configuration file".
2010-08-27 22:36:35 -04:00