Commit Graph

28922 Commits

Author SHA1 Message Date
Pulkit Goyal
91f9f5358d py3: make i18n/posplit use absolute_import 2016-05-13 03:08:46 +05:30
Augie Fackler
6a7aaa4bf4 wireproto: optimize handling of large batch responses
Now that batch can be used by remotefilelog, the quadratic string
copying this was doing was actually disastrous. In my local testing,
fetching a 56 meg file used to take 3 minutes, and now takes only a
few seconds.
2016-05-12 09:39:14 -04:00
Pierre-Yves David
47ac7dc0f8 cleanup: replace False identity testing with an explicit token object
The recommended way to check default value (when None is not as option) is a
token object. Identity testing to integer is less explicit and not guaranteed to
work in all implementations.
2016-05-05 19:32:51 +02:00
Pierre-Yves David
917636e516 devel: officially deprecate dirstate.write without transaction argument
When we introduce the develwarning, we did not had an official deprecation API
and infrastructure. We can now officially deprecate the old way with a version
deadline.
2016-05-11 09:31:47 +02:00
Pierre-Yves David
f6e86ab7ff devel: officially deprecate update without destination
When we introduce the develwarning, we did not had an official deprecation API
and infrastructure. We can now officially deprecate the old way with a version
deadline.
2016-05-11 09:31:47 +02:00
Pierre-Yves David
efaf172347 devel: fix a typo in a deprecation warning
Credit goes to Sean Farley for spotting it.
2016-05-11 09:34:59 +02:00
Pierre-Yves David
4bd2f39b1d devel: officially deprecate old style revset
When we introduce the develwarning, we did not had an official deprecation API
and infrastructure. We can now officially deprecate the old way with a version
deadline.
2016-05-11 09:31:47 +02:00
timeless
1ba2701c7e check-code: handle py3 open divergence
open() really wants an encoding attribute
2016-05-11 01:46:11 +00:00
timeless
fad5dd9e3e check-code: switch to opener 2016-05-11 01:44:39 +00:00
timeless
9bdcc0acc5 check-code: handle range/xrange divergence 2016-05-11 01:39:07 +00:00
timeless
afe01e4291 check-code: fix py3 complaint about \NNN being invalid unicode 2016-05-11 01:56:08 +00:00
timeless
979ecf4dce hghave: switch from iteritems to items
With this, test-hghave.t passes on python 3.

Four features fail because mercurial still is not py3 safe:
absimport
cacheable
hardlink
defaultcacerts

But that will be resolved automatically eventually.
2016-05-05 09:12:26 +00:00
timeless
223ed96d6d hghave: matchoutput needs to use bytes for regexp
file output is bytes in py3, so we need each regexp to be bytes
2016-05-05 09:07:01 +00:00
Yuya Nishihara
2644883398 revset: make dagrange preserve order of input set
Unlike range, dagrange has no inverted range (such as '10:0'). So there should
be no practical reason to keep dagrange as a function that forces its own
ordering.

No performance regression is spotted in contrib/base-revsets.txt.
2016-05-03 12:36:44 +09:00
timeless
9978c7c07e tests: mark test-check-pyflakes.t as requiring hg1.0+
hg does not yet run with py3, so if you try:
./run-tests.py --local test-check-pyflakes.t

... it will try to run the local hg, which does not work
and thus, hg locate will return no output to stdout (and
stderr is sent to /dev/null).

If you do:
./run-tests.py --with-hg=~/bin/hg test-check-pyflakes.t
Then it should work, if your hg is new enough to have
a locate command (hg0.6 does not have locate).
2016-05-05 09:26:09 +00:00
Mateusz Kwapich
fc3f152c3e dirstate: make backup methods public
They are called from outside of dirstate anyway and I want the localrepo to
use them too.
2016-05-05 17:06:54 -07:00
Kevin Bullock
2224f08289 check-code: add a rule banning env -u 2016-05-06 08:45:56 -05:00
Kevin Bullock
73ec31db86 subrepo: use unset instead of env -u to fix test on BSDs (issue5229) 2016-05-06 08:41:24 -05:00
Martijn Pieters
66e28b5732 graphmod: partial edge styling
Allow for a style to only apply to the last N lines (for positive N) or
everything but the first N lines (for negative N) of the section along the
current node. This allows for more subtle grandparent styling.

So from the default:

  $ hg log -G ...
  o    Lorem ipsum dolor sit
  :\   amet, consectetur
  : :  adipiscing elit, sed
  : :  do eiusmod tempor
  : :
  o :  incididunt ut labore
  | :  et dolore magna
  | :  aliqua. Ut enim ad
  | :  minim veniam, quis
  |/
  o  nostrud exercitation
  :  ullamco laboris nisi
  :  ut aliquip ex ea
  :  commodo consequat.
  :
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu

to

  $ hg log -G --config "experimental.graphstyle.grandparent=2." ...
  o    Lorem ipsum dolor sit
  |\   amet, consectetur
  | |  adipiscing elit, sed
  . .  do eiusmod tempor
  . .
  o |  incididunt ut labore
  | |  et dolore magna
  | |  aliqua. Ut enim ad
  | |  minim veniam, quis
  |/
  o  nostrud exercitation
  |  ullamco laboris nisi
  |  ut aliquip ex ea
  .  commodo consequat.
  .
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu

or

  $ hg log -G --config "experimental.graphstyle.grandparent=1:" ...
  o    Lorem ipsum dolor sit
  |\   amet, consectetur
  | |  adipiscing elit, sed
  | |  do eiusmod tempor
  : :
  o |  incididunt ut labore
  | |  et dolore magna
  | |  aliqua. Ut enim ad
  | |  minim veniam, quis
  |/
  o  nostrud exercitation
  |  ullamco laboris nisi
  |  ut aliquip ex ea
  |  commodo consequat.
  :
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu

or

  $ hg log -G --config "experimental.graphstyle.grandparent=-2!" ...
  o    Lorem ipsum dolor sit
  |\   amet, consectetur
  ! !  adipiscing elit, sed
  ! !  do eiusmod tempor
  ! !
  o |  incididunt ut labore
  | |  et dolore magna
  | |  aliqua. Ut enim ad
  | |  minim veniam, quis
  |/
  o  nostrud exercitation
  |  ullamco laboris nisi
  !  ut aliquip ex ea
  !  commodo consequat.
  !
  o  Duis aute irure dolor
  |  in reprehenderit in
  ~  voluptate velit esse
     cillum dolore eu
2016-05-04 20:11:59 +01:00
Maciej Fijalkowski
f3ac5246cf pure: write a really lazy version of pure indexObject
On PyPy this version performs reasonably well compared to C version.
Example command is "hg id" which gets faster, depending on details
of your operating system and hard drive (it's bottlenecked on stat mostly)
There is potential for improvements by storing extra as a condensed struct too.
2016-04-24 14:21:38 +03:00
Jun Wu
ad658fc71c dispatch: always load extensions before running shell aliases (issue5230)
Before this patch, we may or may not load extensions for shell aliases
depending on whether the command is abbreviated or not.

Loading extensions may have useful side effects to shell aliases. For example,
the pager extension does not work for shell aliases.

This patch removes the code checking shell aliases before loading extensions
to give the user a more consistent experience. It may hurt performance for
shell aliases a bit without chg but the correctness seems worth it. It will
also make the behavior consistent with chg since chg will always load all
extensions before running commands.
2016-05-07 14:12:23 +01:00
Augie Fackler
31c27da2fc httpclient: update to upstream revision 2995635573d2
This is mostly Python 3 compat work thanks to timeless.
2016-05-09 21:13:50 -04:00
Anton Shestakov
98e687e2c1 crecord: call prevsibling() and nextsibling() directly
The 3 classes for items used in crecord (uiheader, uihunk, uihunkline) all have
prevsibling() and nextsibling() methods. The two methods are used to get the
previous/next item of the same type of the same parent element as the current
one: when `a` is a uihunkline instance, a.nextsibling() returns the next line
in this hunk (or None, if `a` is the last line).

There are also two similar methods: previtem() and nextitem(). When called with
constrainlevel=True (the default) they simply returned the result of
prevsibling()/nextsibling(). Only when called with constrainlevel=False they
did something different: they returned previous/next item regardless of its
type (so if `a` is the last line in a hunk, a.nextitem(constrainlevel=False)
could return the next hunk or the next file -- something that is not a line).

Let's simplify this logic and make code call -sibling() methods when only
siblings are needed and -item() methods when any item would do, and then remove
the constrainlevel argument from previtem() and nextitem().
2016-05-06 19:52:21 +08:00
Jordi Gutiérrez Hermoso
dc2068ce42 dispatch: add fail-* family of hooks
The post-* family of hooks will not run in case a command fails (i.e.
raises an exception). This makes it inconvenient to hook into events
such as doing something in case of a failed push.

We catch all exceptions to run the failure hook. I am not sure if this
is too aggressive, but tests apparently pass.
2016-04-28 10:37:47 -04:00
Pulkit Goyal
58d8791d2b py3: make hgext/rebase.py use absolute_import 2016-05-06 22:21:32 +05:30
Pulkit Goyal
336149484f py3: make hgext/mq.py use absolute_import 2016-05-06 21:54:31 +05:30
Pulkit Goyal
8d03cfe483 py3: make hgext/hisedit.py use absolute_import 2016-05-06 21:52:26 +05:30
Pulkit Goyal
770fabee34 py3: make hgext/hgk.py use absolute_import 2016-05-06 21:50:40 +05:30
Pulkit Goyal
21822d329b py3: make hgext/gpg.py use absolute_import 2016-05-06 21:46:17 +05:30
Pulkit Goyal
c83d2f743d py3: make hgext/graphlog.py use absolute_import 2016-05-06 21:48:17 +05:30
liscju
1283887937 import-checker: recognize relative imports from parents of current package
So far fromlocal recognizes relative imports of the form:
from . import D
from .. import E

It wasn't prepared for recognizing relative imports like:
from ..F import G

The bug was not found so far because all relative imports starting
from the parent was in the list of allowsymbolicimports like:
from ..i18n import
from ..node import
2016-05-07 19:59:30 +02:00
Pulkit Goyal
5d5b487562 py3: make hgext/fetch.py use absolute_import 2016-05-06 21:44:41 +05:30
Pulkit Goyal
1a2e0875a2 tests: test-check-py3-compat.t output updated
The test output was not updated as the lower section of the test updates
with python3.5, so it might be the case that people have updated the modules
but the test was left as it was. So this patch updates the test output.
2016-05-06 21:41:25 +05:30
Yuya Nishihara
d1b0332b16 revset: factor out public optimize() function from recursion
New optimize() hides internal arguments and return values. This makes it easy
to add more parameters and return values to _optimize().
2016-05-02 12:09:00 +09:00
Yuya Nishihara
f18ad29e0a revset: introduce temporary variables in optimize() where they look better 2016-05-02 12:47:09 +09:00
Yuya Nishihara
3a2b799928 revset: construct arguments of only() against matched tree
Since _isonly() knows the structure of 'revs' and 'bases', it should be
slightly easier to understand than destructuring 'ta' and 'tb'.
2016-05-02 11:50:48 +09:00
Yuya Nishihara
dff8edf1fe revset: unnest isonly() closure from optimize()
There were no variables to be captured.
2016-05-02 11:27:26 +09:00
Gregory Szorc
baf0fdcf97 sslutil: stop checking for web.cacerts=! (BC)
The previous patch stopped setting web.cacerts=! to indicate
--insecure.

That left user configs as the only source that could introduce
web.cacerts=!.

The practical impact of this patch is we no longer honor
web.cacerts=! in configs. Instead, we always treat web.cacerts
as a path. The patch is therefore technically BC. However,
since I don't believe web.cacerts=! is documented, it should be
safe to remove. 358b7bec186f (which introduced --insecure) has
no indication that web.cacerts=! is anything but an implementation
detail, reinforcing my belief it can be removed without major
debate.
2016-05-05 00:46:31 -07:00
Gregory Szorc
d5340c808d dispatch: stop setting web.cacerts=! to indicate --insecure
Consumers needing to know if --insecure was used have already
transitioned to using ui.insecureconnections. The previous
patch removed the last meaningful consumer looking for
web.cacerts=!.
2016-05-05 00:40:01 -07:00
Gregory Szorc
9295bebb69 sslutil: use CA loaded state to drive validation logic
Until now, sslkwargs may set web.cacerts=! to indicate
that system certs could not be found. This is really
obtuse because sslkwargs effectively sets state on a global
object which bypasses wrapsocket() and is later consulted
by validator.__call__. This is madness.

This patch introduces an attribute on the wrapped socket
instance indicating whether system CAs were loaded. We
can set this directly inside wrapsocket() because that
function knows everything that sslkwargs() does - and more.

With this attribute set on the socket, we refactor
validator.__call__ to use it.

Since we no longer have a need for setting web.cacerts=!
in sslkwargs, we remove that.

I think the new logic is much easier to understand and will
enable behavior to be changed more easily.
2016-05-05 00:38:18 -07:00
Gregory Szorc
7b654a4277 sslutil: handle ui.insecureconnections in validator
Right now, web.cacerts=! means one of two things:

1) Use of --insecure
2) No CAs could be found and were loaded (see sslkwargs)

This isn't very obvious and makes changing behavior of these
different scenarios independent of the other impossible.

This patch changes the validator code to explicit handle the
case of --insecure being used.

As the inline comment indicates, there is room to possibly change
messaging and logic here. For now, we are backwards compatible.
2016-05-05 00:37:28 -07:00
Gregory Szorc
efcc52cbeb sslutil: check for ui.insecureconnections in sslkwargs
The end result of this function is the same. We now have a more
explicit return branch.

We still keep the old code looking at web.cacerts=! a few lines
below because we're still setting web.cacerts=! and need to react
to the variable. This will be removed in an upcoming patch.
2016-05-05 00:35:45 -07:00
Gregory Szorc
afd3cdf559 dispatch: set ui.insecureconnections when --insecure is used 2016-05-05 00:34:22 -07:00
Gregory Szorc
df3e0225af ui: add an instance flag to hold --insecure bit
Currently, when --insecure is used we set web.cacerts=! and
socket validation takes this value into account. web.cacerts=!
is not documented AFAICT and is purely an internal implementation
detail.

Let's be more explicit about what is going on by introducing a
dedicated variable outside of the config values to track that
--insecure is used.
2016-05-05 00:33:38 -07:00
Gregory Szorc
b7af0f8d55 sslutil: make sslkwargs code even more explicit
The ways in which this code can interact with socket wrapping
and validation later are mind numbing. This patch helps make it
even more clear.

The end behavior should be identical.
2016-05-05 00:32:43 -07:00
Gregory Szorc
051832cb8b sslutil: move code examining _canloaddefaultcerts out of _defaultcacerts
Before, the return of _defaultcacerts() was 1 of 3 types. This was
difficult to read. Make it return a path or None.

We had to update hghave.py in the same patch because it was also
looking at this internal function. I wasted dozens of minutes
trying to figure out why tests were failing until I found the
code in hghave.py...
2016-05-04 23:38:34 -07:00
Gregory Szorc
8bc014a599 sslutil: further refactor sslkwargs
The logic here and what happens with web.cacerts is mind numbing.
Make the code even more explicit.
2016-05-04 23:01:49 -07:00
Gregory Szorc
4bc1239076 sslutil: document and slightly refactor sslkwargs
This will help me and any reviewers keep sane as this code
is refactored.
2016-05-05 00:31:11 -07:00
Augie Fackler
c5874833d2 localrepo: remove a couple of local type aliases
The local aliases are unused now, and were confusing mypy's type
checker.
2016-05-06 11:31:29 -04:00
Augie Fackler
1ed59ab50e cmdutil: typo fix in comment 2016-05-06 14:22:17 -04:00