Commit Graph

116 Commits

Author SHA1 Message Date
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
Augie Fackler
2ad9623e97 color: accept usual boolean values as synonyms for always and never 2010-08-28 21:57:36 -05:00
Martin Geisler
c3c7fa090f Merge with stable 2010-08-30 13:00:22 +02:00
Steve Borho
17ad59ab74 color: handle more Windows console errors
If your application is being built as a non-console application,
stdout is not a valid handle and raises an exception:

pywintypes.error: (6, 'DuplicateHandle', 'The handle is invalid.')

Alternatively, non-console applications launched outside of a
console will return None from GetStdHandle instead of raising an
exception.
2010-08-27 22:24:47 -05:00
Brodie Rao
203cf2fbd9 cleanup: remove unused imports 2010-08-27 13:32:38 -04:00
Jeremy Whitlock
0a6d3a397f color: enable branches support
This commit updates the branches command to use ui.label for the branch names
and the changeset.  This implementation allows assigning colors to the four
states of a branch: active, closed, current and inactive.  While you can
configure color for the four states, only current and closed have default colors
of green and black bold respectively.
2010-07-28 23:05:03 -06:00
Brodie Rao
0f7e715bdb hgcia/color: remove star imports
This plays nicer with demandimport and allows pyflakes to detect undefined
names.
2010-08-03 13:02:11 -04:00
Brodie Rao
6d1ff05d76 color: call correct superclass method in write_err
Without this fix, any calls to write_err would go to stdout instead of
stderr, and calls during pushbuffer would cause unpack ValueErrors on
popbuffer.
2010-08-02 10:48:31 -04:00
Brodie Rao
52fb27575c color: pass write/write_err to win32print correctly (issue2312) 2010-08-01 16:26:02 -04:00
Brodie Rao
6f58bfc15e color/progress: subclass ui instead of using wrapfunction (issue2096)
This resolves the issue of hg cmd --mq not being colorized. This was due
to color wrapping only the instance of ui passed to dispatch._runcommand(),
which isn't the same ui object that mq.mqcommand() receives. After dispatch
calls extensions.loadall(), it makes sure any changes to ui.__class__ in
uisetup are propagated.

progress is updated to wrap ui in the same manner because wrapfunction
doesn't play well when ui.__class__ has been replaced by another extension
(orig will point to the old class method instead of color's).
2010-07-01 19:23:26 -05:00