Commit Graph

31782 Commits

Author SHA1 Message Date
Pierre-Yves David
c2a0c2ab4e obsolescence: add test for the "branch replacement" logic during push, case A3
Mercurial checks for the introduction of new heads on push. Evolution comes
into play to detect if existing branches on the server are being replaced by
some of the new one we push.

The current code for this logic is very basic (eg: issue4354) and was poorly
tested. We have a better implementation coming in the evolve extension fixing
these issues and with more serious tests coverage. In the process of upstreaming
this improved logic, we start with adding the test case that are already passing
with the current implementation. Once they are all in, we'll upstream the better
implementation and the extra test case.

See inline documentation for details about the test case added in this
changeset.
2017-04-13 16:23:18 +02:00
Pierre-Yves David
c9e28b626c obsolescence: add test for the "branch replacement" logic during push, case A2
Mercurial checks for the introduction of new heads on push. Evolution comes
into play to detect if existing branches on the server are being replaced by
some of the new one we push.

The current code for this logic is very basic (eg: issue4354) and was poorly
tested. We have a better implementation coming in the evolve extension fixing
these issues and with more serious tests coverage. In the process of upstreaming
this improved logic, we start with adding the test case that are already passing
with the current implementation. Once they are all in, we'll upstream the better
implementation and the extra test case.

See inline documentation for details about the test case added in this
changeset.
2017-04-13 16:23:01 +02:00
Pierre-Yves David
f9a960461d obsolescence: add test for the "branch replacement" logic during push, case A1
Mercurial checks for the introduction of new heads on push. Evolution comes
into play to detect if existing branches on the server are being replaced by
some of the new one we push.

The current code for this logic is very basic (eg: issue4354) and was poorly
tested. We have a better implementation coming in the evolve extension fixing
these issues and with more serious tests coverage. In the process of upstreaming
this improved logic, we start with adding the test case that are already passing
with the current implementation. Once they are all in, we'll upstream the better
implementation and the extra test case.

See inline documentation for details about the test case added in this
changeset.
2017-04-13 16:22:46 +02:00
Pierre-Yves David
fbe2618d84 obsolescence: add test utility for the "branch replacement" logic during push
Mercurial checks for the introduction of new heads on push. Evolution comes
into play to detect if existing branches on the server are being replaced by
some of the new one we push.

The current code for this logic is very basic (eg: issue4354) and was poorly
tested. We have a better implementation coming in the evolve extension fixing
these issues and with more serious tests coverage. In the process of upstreaming
this improved logic, we start with adding the test case that are already passing
with the current implementation. Once they are all in, we'll upstream the better
implementation and the extra test case.

This changeset introduce the common setup script used by these tests.
2017-04-13 16:22:25 +02:00
Pierre-Yves David
a4b7024c9e obsolescence: add test case D-4 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce case D-4: unknown changeset in between known on

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:55:16 +02:00
Pierre-Yves David
3b805f9100 obsolescence: add test case D-3 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce case D3: missing prune target (prune not in "pushed set")

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:54:43 +02:00
Pierre-Yves David
7e2f6acfa3 obsolescence: add test case D-2 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce D-2: missing prune target (prune in "pushed set")

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:54:19 +02:00
Pierre-Yves David
3806b5c8c2 obsolescence: add test case D-1 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce case D-1:

    Pruned changeset based on missing precursor of something not present

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:53:37 +02:00
Pierre-Yves David
6517738b79 obsolescence: add test case C-4 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce C.4: multiple successors, one is pruned

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:53:12 +02:00
Pierre-Yves David
cae090bfcc obsolescence: add test case C-3 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce case C-3:

    Pruned changeset on precursors of another pruned one

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:52:25 +02:00
Pierre-Yves David
cfb3fe673f obsolescence: add test case C-2 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce C-2: Pruned changeset on precursors

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:51:06 +02:00
Pierre-Yves David
b0872c4678 obsolescence: add test case C-1 for obsolescence markers exchange
About 3 years ago, in August 2014, the logic to select what markers to select on
push was ported from the evolve extension to Mercurial core. However, for some
unclear reasons, the tests for that logic were not ported alongside.
I realised it a couple of weeks ago while working on another push related issue.
I've made a clean up pass on the tests and they are now ready to integrate the
core test suite. This series of changesets do not change any logic. I just adds
test for logic that has been around for about 10 versions of Mercurial.

They are a patch for each test case. It makes it easier to review and postpone
one with documentation issues without rejecting the wholes series.

This patch introduce C-1: Multiple pruned changeset atop each other

Each test case comes it in own test file. It help parallelism and does not
introduce a significant overhead from having a single unified giant test file.
Here are timing  to support this claim.

# Multiple test files version:
# run-tests.py --local -j 1 test-exchange-*.t
53.40s user 6.82s system 85% cpu 1:10.76 total
52.79s user 6.97s system 85% cpu 1:09.97 total
52.94s user 6.82s system 85% cpu 1:09.69 total

# Single test file version:
# run-tests.py --local -j 1 test-exchange-obsmarkers.t
52.97s user 6.85s system 85% cpu 1:10.10 total
52.64s user 6.79s system 85% cpu 1:09.63 total
53.70s user 7.00s system 85% cpu 1:11.17 total
2017-04-10 16:50:41 +02:00
Bryan O'Sullivan
cb19aa07d3 stdio: add Linux-specific tests for error checking 2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
60b68c00eb stdio: raise StdioError if something goes wrong in ui.flush
The prior code used to ignore all errors, which was intended to
deal with a decade-old problem with writing to broken pipes on
Windows.

However, that code inadvertantly went a lot further, making it
impossible to detect *all* I/O errors on stdio ... but only sometimes.

What actually happened was that if Mercurial wrote less than a stdio
buffer's worth of output (the overwhelmingly common case for most
commands), any error that occurred would get swallowed here.  But
if the buffering strategy changed, an unhandled IOError could be
raised from any number of other locations.

Because we now have a top-level StdioError handler, and ui._write
and ui._write_err (and now flush!) will raise that exception, we
have one rational place to detect and handle these errors.
2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
dd48bd8237 stdio: raise StdioError if something goes wrong in ui._write_err
The prior code used to ignore certain classes of error, which was
not the right thing to do.
2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
7b0fee3bf9 stdio: raise StdioError if something goes wrong in ui._write 2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
ebffdb4558 stdio: catch StdioError in dispatch.run and clean up appropriately
We attempt to report what went wrong, and more importantly exit the
program with an error code.

(The exception we catch is not yet raised anywhere in the code.)
2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
84ac0ade7c stdio: add machinery to identify failed stdout/stderr writes
Mercurial currently fails to notice failures to write to stdout or
stderr. A correctly functioning command line tool should detect
this and exit with an error code.

To achieve this, we need a little extra plumbing, which we start
adding here.
2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
287bd28acf atexit: switch to home-grown implementation 2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
2579347008 atexit: test failing handlers 2017-04-11 14:54:12 -07:00
Bryan O'Sullivan
0c663fe04d ui: add special-purpose atexit functionality
In spite of its longstanding use, Python's built-in atexit code is
not suitable for Mercurial's purposes, for several reasons:

* Handlers run after application code has finished.

* Because of this, the code that runs handlers swallows exceptions
  (since there's no possible stacktrace to associate errors with).
  If we're lucky, we'll get something spat out to stderr (if stderr
  still works), which of course isn't any use in a big deployment
  where it's important that exceptions get logged and aggregated.

* Mercurial's current atexit handlers make unfortunate assumptions
  about process state (specifically stdio) that, coupled with the
  above problems, make it impossible to deal with certain categories
  of error (try "hg status > /dev/full" on a Linux box).

* In Python 3, the atexit implementation is completely hidden, so
  we can't hijack the platform's atexit code to run handlers at a
  time of our choosing.

As a result, here's a perfectly cromulent atexit-like implementation
over which we have control.  This lets us decide exactly when the
handlers run (after each request has completed), and control what
the process state is when that occurs (and afterwards).
2017-04-11 14:54:12 -07:00
Denis Laxalde
761577866a context: follow all branches in blockdescendants()
In the initial implementation of blockdescendants (and thus followlines(...,
descend=True) revset), only the first branch encountered in descending
direction was followed.

Update the algorithm so that all children of a revision ('x' in code) are
considered. Accordingly, we need to prevent a child revision to be yielded
multiple times when it gets visited through different path, so we skip 'i'
when this occurs. Finally, since we now consider all parents of a possible
child touching a given line range, we take care of yielding the child if it
has a diff in specified line range with at least one of its parent (same logic
as blockancestors()).
2017-04-14 08:55:18 +02:00
Jun Wu
dcf42da6e9 pager: set some environment variables if they're not set
Git did this already [1] [2]. We want this behavior too [3].

This provides a better default user experience (like, supporting colors) if
users have things like "PAGER=less" set, which is not uncommon.

The environment variables are provided by a method so extensions can
override them on demand.

[1]: 6a5ff7acb5/pager.c (L87)
[2]: 6a5ff7acb5/Makefile (L1545)
[3]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/094780.html
2017-04-13 08:27:19 -07:00
Augie Fackler
fe10e9b912 sshpeer: fix docstring typo 2017-04-13 14:48:18 -04:00
Augie Fackler
6278186d0b util: pass sysstrs to warnings.filterwarnings
Un-breaks the Python 3 build.
2017-04-13 13:12:49 -04:00
Pierre-Yves David
dc3a34b74e vfs: deprecate all old classes in scmutil
Now that all vfs class moved to the vfs module, we can deprecate the old one.
2017-04-03 14:21:38 +02:00
Pierre-Yves David
a185960897 util: add a way to issue deprecation warning without a UI object
Our current deprecation warning mechanism relies on ui object. They are case
where we cannot have access to the UI object. On a general basis we avoid using
the python mechanism for deprecation warning because up to Python 2.6 it is
exposing warning to unsuspecting user who cannot do anything to deal with them.

So we build a "safe" strategy to hide this warnings behind a flag in an
environment variable. The test runner set this flag so that tests show these
warning.  This will help us marker API as deprecated for extensions to update
their code.
2017-04-04 11:03:29 +02:00
Denis Laxalde
160d0b298e gitweb: plug followlines UI in filerevision view
Mostly copy CSS rules from style-paper.css into style-gitweb.css. The only
modification is addition of !important on "background-color" rule for
"pre.sourcelines > span.followlines-selected" selector as the background color
is otherwise overriden by "pre.sourcelines.stripes > :nth-child(4n+4)" rule.
2017-04-13 09:49:48 +02:00
Denis Laxalde
14cc343c76 gitweb: handle "patch" query parameter in filelog view
As for paper style, in d9b8811bed4a, we display "diff" data as an additional
row in the table of revision entries for the gitweb template.
Also, as these additional diff rows have a white background, they may be
confused with log entry rows ("age", "author", "description", "links") of even
parity (parity0 also have a white background). So we disable parity colors for
log entry rows when diff is displayed and fix the color to the
"dark" parity (i.e. parity1 #f6f6f0) so that it's always distinguishable from
2017-04-13 10:04:09 +02:00
Denis Laxalde
8806e20e50 gitweb: add information about "linerange" filtering in filelog view
As for paper style, in a58e79a03a6e, we display a "(following lines
<fromline>:<toline> <a href='...'>back to filelog</a>)" message alongside the
file name when "linerange" query parameter is present.
2017-04-13 09:59:58 +02:00
Gábor Stefanik
387861cc38 util: fix human-readable printing of negative byte counts
Apply the same human-readable printing rules to negative byte counts as to
positive ones. Fixes output of debugupgraderepo.
2017-04-10 18:16:30 +02:00
Ryan McElroy
7959f776d3 show: make template option actually show up in help
Previously, the --template/-T option didn't show up in help because it's marked
as experimental. It's not really experimental for show, and its quite important
for show's funcationality, so let's make sure it always shows up.
2017-04-13 03:17:53 -07:00
Gregory Szorc
6c7c4762ec show: implement underway view
This is the beginning of a wip/smartlog view. It is basically a manually
constructed (read: fast) revset function to collect "relevant"
changesets combined with a custom template and a graph displayer.
It obviously needs a lot of work.

I'd like to get *something* usable in 4.2 so `hg show` has some value
to end-users.

Let the bikeshedding begin.
2017-04-12 20:31:15 -07:00
Gregory Szorc
a7217ac0ec show: fix formatting of multiple commands
Because we're formatting to RST, short lines wrap and there
needs to be an extra line break between paragraphs to prevent
that.

In addition, the indentation in the old code was a bit off.

Refactor the code to a function (so we don't leak variables outside
the module) and modify it so it renders more correctly.
2017-04-12 20:28:44 -07:00
Gregory Szorc
e9dd2f7a3f pycompat: import correct cookie module on Python 3
http.cookielib doesn't exist. http.cookiejar does and it contains the
symbols we need. This fixes test failures on Python 3.
2017-04-12 18:42:20 -07:00
Jun Wu
488ba17f87 chg: respect environment variables for pager
Previously chg runs the pager command without respecting its environment
variables being told to use. This patch makes it so.
2017-04-12 16:50:23 -07:00
Denis Laxalde
5544045959 hgweb: add a link to followlines in descending direction
We change the content of the followlines popup to display two links inviting
to follow the history of selected lines in ascending (as before) and
descending directions. The popup now renders as:

  follow history of lines <fromline>:<toline>:
  <a href=...>ascending</a> / <a href=...>descending</a>
2017-04-10 17:36:40 +02:00
Denis Laxalde
bd52f5d831 hgweb: handle a "descend" query parameter in filelog command
When this "descend" query parameter is present along with "linerange"
parameter, we get revisions following line range in descending order. The
parameter has no effect without "linerange".
2017-04-10 16:23:41 +02:00
Denis Laxalde
779e08447b revset: add a 'descend' argument to followlines to return descendants
This is useful to follow changes in a block of lines forward in the history
(for instance, when one wants to find out how a function evolved from a point
in history).

We added a 'descend' parameter to followlines(), which defaults to False. If
True, followlines() returns descendants of startrev.

Because context.blockdescendants() does not follow renames, these are not
followed by the revset either, so history will end when a rename occurs (as
can be seen in tests).
2017-01-16 09:24:47 +01:00
Denis Laxalde
d7409a0458 context: add a blockdescendants function
This is symmetrical with blockancestors() and yields descendants of a filectx
with changes in the given line range. The noticeable difference is that the
algorithm does not follow renames (probably because filelog.descendants() does
not), so we are missing branches with renames.
2017-04-10 15:11:36 +02:00
Gregory Szorc
ef4d6a1617 url: support auth.cookiesfile for adding cookies to HTTP requests
Mercurial can't currently send cookies as part of HTTP requests.
Some authentication systems use cookies. So, it seems like adding
support for sending cookies seems like a useful feature.

This patch implements support for reading cookies from a file
and automatically sending them as part of the request. We rely
on the "cookiejar" Python module to do the heavy lifting of
parsing cookies files. We currently only support the Mozilla
(really Netscape-era) cookie format. There is another format
supported by cookielib and we may want to consider using that,
especially since the Netscape cookie parser can't parse ports.
It wasn't immediately obvious to me what the format of the other
parser is, so I didn't know how to test it. I /think/ it might
be literal "Cookie" header values, but I'm not sure. If it is
more robust than the Netscape format, we may want to just
support it.
2017-03-09 22:40:52 -08:00
Gregory Szorc
bd7f2afe30 httpconnection: allow a global auth.cookiefile config entry
This foreshadows support for defining a cookies file.
2017-03-09 22:35:10 -08:00
Gregory Szorc
3c5a0a039c util: make cookielib module available
In preparation for supporting sending cookies on HTTP requests.
2017-03-09 21:35:21 -08:00
Pierre-Yves David
010d017cdd crecord: avoid setting non-existing SIGTSTP signal on windows (issue5512)
Windows do not have a SIGTSTP so we avoid setting the handler if the signal is
unknown.
2017-04-06 11:28:25 +02:00
Pierre-Yves David
5a12bd8592 crecord: ensure we reinstall the SIGTSTP handler
Previous, exceptions would prevent the reinstallation of the
signal.
2017-04-06 11:25:13 +02:00
Pierre-Yves David
6ab2d25fb5 crecord: avoid setting non-existing signal SIGWINCH on windows
Windows do not have a SIGWINCH so we avoid setting the handler if the signal is
unknown.
2017-04-06 11:25:33 +02:00
Pierre-Yves David
75f4f604c1 crecord: ensure we reinstall the SIGWINCH handler
Previous, exception in _main(...) would prevent the reinstallation of the
signal.
2017-03-26 15:06:09 +02:00
Pierre-Yves David
83f005a5e4 crecord: extract most of 'main' into a sub function
There are some setup and cleanup necessary around the main code, that
setup/cleanup code needs multiple adjustments so we extract the core code into
its own function first for clarity.
2017-03-26 15:05:12 +02:00
Yuya Nishihara
35d42be491 templater: add shorthand for building a dict like {"key": key}
Like field init shorthand of Rust. This is convenient for building a JSON
object from selected keywords.

This means dict() won't support Python-like dict(iterable) syntax because
it's ambiguous. Perhaps it could be implemented as 'mapdict(xs % (k, v))'.
2017-04-03 23:13:49 +09:00
Yuya Nishihara
d86057a7bc templater: find keyword name more thoroughly on filtering error
Before, it could spill an internal representation of compiled template such
as [(<function runsymbol at 0x....>, 'extras'), ...]. Show less cryptic
message if no symbol found.

New findsymbolicname() function will be also used by dict() constructor.
2017-04-08 23:33:32 +09:00