Commit Graph

28864 Commits

Author SHA1 Message Date
timeless
109fcbc79e pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
timeless
7816ecf261 pycompat: add util.urlerr util.urlreq classes for py3 compat
python3 url.request and url.error are mapped as util.urlreq/util.urlerr
python2 equivalents from urllib/urllib2 are mapped according to the py3
hierarchy
2016-04-07 00:05:48 +00:00
Yuya Nishihara
805fdba29f test-progress: disable mocking-time tests on chg
It's hard to make these tests compatible with chg because a mocked time.time()
is recorded and accessed by progbar at random timing. I don't think it's worth
fixing this test as it is considered a unit test of time estimates, so just
ignores on chg.
2016-03-20 16:49:56 -07:00
Yuya Nishihara
87bcd87c28 hghave: add "chg" flag to skip tests that can't be compatible with chg
Several tests fail with chg for several reasons such as loaded chgserver
extension, running uisetup() per server instead of per runcommand, etc.
Since these tests can't/shouldn't be changed to be chg friendly, we need
a flag to skip them.

This patch explicitly drops CHGHG environment if chg isn't involved. This
way, hghave can just check if CHGHG exists.
2016-03-20 14:55:56 -07:00
timeless
e22da4a832 tests: add new test for #! shebang lines
* use #!/bin/sh not e.g. #!/usr/bin/sh
* use #!/usr/bin/env python not e.g. #!/usr/bin/python
2016-04-06 19:09:12 +00:00
Mads Kiilerich
069bac6a3e largefiles: introduce push --lfrev to control which revisions are pushed
The default of pushing all largefiles referenced in outgoing revisions is safe,
but also expensive and sometimes not what is needed. We thus introduce a
--lfrev option, similar to what pull already has.

By specifying an empty set of revisions (or null), it is possible to get lazy
(and insecure!) pushes of revisions without referenced largefiles, similar to
how pull works.
2016-03-27 13:00:28 -07:00
Mads Kiilerich
66a29f6996 largefiles: don't access repo.changelog directly in getlfilestoupload
Make it possible to pass both nodes and revisions to getlfilestoupload.
2016-04-13 01:45:45 +02:00
Mads Kiilerich
940d175900 localrepo: refactor prepushoutgoinghook to take a pushop
prepushoutgoinghook was introduced in 8dfcd476a7f7 and largefiles is the only
in-tree use of it. Refactor it to be more useful for other use cases in
largefiles.
2016-04-13 01:09:11 +02:00
Yuya Nishihara
2e16bca7bf parser: unify parser function of alias declaration and definition
We no longer have to keep them separately.
2016-03-29 00:08:25 +09:00
Yuya Nishihara
06651e61a2 revset: unify function that parses alias declaration and definition
We no longer need separate parsers. Only difference between _parsealiasdecl()
and _parsealiasdefn() is whether or not to flatten 'or' tree. Since alias
declaration should have no 'or' operator, there was no practical difference.
2016-03-29 00:05:14 +09:00
Yuya Nishihara
5392dbd7d3 parser: move alias definition parser to common rule-set class
The original _parsealiasdefn() function is split into common _builddefn()
and revset-specific _parsealiasdefn(). revset._relabelaliasargs() is removed
as it is no longer used.

The doctests are ported by using the dummy parse().
2016-02-29 18:10:07 +09:00
Yuya Nishihara
188dee35c2 parser: move _relabelaliasargs() to common rule-set class
This has no doctest because it will be covered by _builddefn() introduced
by the next patch.

revset._relabelaliasargs() will be removed soon.
2016-02-29 18:00:51 +09:00
Yuya Nishihara
6b447db164 parser: move alias declaration parser to common rule-set class
The original _parsealiasdecl() function is split into common _builddecl()
and revset-specific _parsealiasdecl(). And the original _parsealiasdecl()
call is temporarily replaced by rules._builddecl(), which should be eliminated
later.

The doctests are mostly ported by using the dummy parse(), but the test for
'foo bar' is kept in _parsealiasdecl() as it checks if "pos != len(decl)" is
working. Also, 'foo($1)' test is added to make sure the alias tokenizer can
handle '$1' symbol, which is the only reason why we need _parsealiasdecl().
2016-02-29 17:54:03 +09:00
Yuya Nishihara
c51267a286 parser: add stub class that will host alias parsing and expansion
This class will keep syntax rules that are necessary to parse and expand
aliases. The implementations will be extracted from the revset module. In
order to make the porting easier, this class keeps parsedecl and parsedefn
separately, which will be unified later. Also, getlist and funcnode will
be refactored by future patches for better handling of the template aliases.

The following public functions will be added:

  aliasrules.build(decl, defn) -> aliasobj
    parse decl and defn into an object that keeps alias name, arguments
    and replacement tree.
  aliasrules.buildmap(aliasitems) -> aliasdict
    helper to build() a dict of alias objects from a list of (decl, defn)
  aliasrules.expand(aliasdict, tree) -> tree
    expand aliases in tree recursively

Because these functions aren't introduced by this series, there would remain
a few wrapper functions in the revset module. These ugly wrappers should be
eliminated by the next series.

This class is considered an inheritable namespace, which will host only
class/static methods. That's because it won't have no object-scope variables.
I'm not a big fan of using class as a syntax sugar, but I admit it can improve
code readability at some level. So let's give it a try.
2016-04-03 16:55:23 +09:00
Yuya Nishihara
76a8e3fd6c revset: narrow scope of "except ParseError" block in _parsealiasdecl()
This helps to factor out a common function. "if True" will be removed soon.
2016-02-29 17:43:39 +09:00
Kostia Balytskyi
47727221bc obsstore: move delete function from obsstore class to repair module
Since one of the original patches was accepted already and people on the
mailing list still have suggestions as to how this should be improved, I'm
implementing those suggestions in the following patches (this and the ones that
might follow).
2016-04-12 04:06:50 -07:00
Kostia Balytskyi
ab0e2307c2 debugobsolete: style fixes to debugobsolete that slipped from original commit 2016-04-12 03:40:53 -07:00
Matt Mackall
d6208af0bb import: document --exact behavior in more detail 2016-03-09 10:47:33 -05:00
Adrian Buehlmann
86883218e1 util: add doctest to datestr() 2016-04-11 19:46:50 +02:00
Florent Gallaire
ecd665adf8 date: fix boundary check of negative integer 2016-04-12 00:30:28 +02:00
Jun Wu
63d1d02bc9 chg: server exited with code 0 without being connectable is an error
Before this patch, if the server started by chg has exited with code 0 without
creating a connectable unix domain socket at the specified address, chg will
exit with code 0, which is not the correct behavior. It can happen, for
example, CHGHG is set to /bin/true.

This patch addresses the issue by checking the exit code of the server and
printing a new error message if the server exited normally but cannot be
reached.
2016-04-10 22:00:34 +01:00
Oleg Afanasyev
2f8e102f8e shelve: refactor directory name into constant
Shelve directory name extracted into constant to avoid typos/duplication.
2016-04-08 23:33:28 -07:00
timeless
f77cdcd3b1 pycompat: switch to util.stringio for py3 compat 2016-04-10 20:55:37 +00:00
timeless
2c70418b6c py3: use multi-line import in test-wireproto.py
The reason I did it is that I had a later commit that was adding to the list.
2016-04-10 21:32:08 +00:00
timeless
912b0a1260 py3: use absolute_import in test-hgweb-non-interactive.t 2016-04-10 21:32:05 +00:00
timeless
f31f0d17f5 py3: use absolute_import in test-hgweb-no-request-uri.t 2016-04-10 21:32:01 +00:00
timeless
51821ef823 py3: use absolute_import in test-hgweb-no-path-info.t 2016-04-10 21:31:58 +00:00
Jun Wu
fda8134cfd chg: use fsetcloexec instead of closing lockfd manually
Since we have the fsetcloexec utility function, use it instead of closing
lockfd manually.
2016-04-11 00:18:27 +01:00
Jun Wu
f8e2eeaa6b chg: extract the logic of setting FD_CLOEXEC to a utility function
Setting FD_CLOEXEC is useful for other fds such like lockfd and sockdirfd,
move the logic from hgc_open to util.
2016-04-11 00:17:17 +01:00
Jun Wu
b8937b0692 chg: add fchdirx as a utility function
As part of the series to support long socket paths, we need to use fchdir and
check its result in several places. Make it a utility function.
2016-04-10 03:14:32 +01:00
Jun Wu
bfa0407ff7 chg: check lockfd at freecmdserveropts
We check for sockdirfd at freecmdserveropts but not lockfd, which is a bit
strange to people new to the code. Add a comment and an assert to make it
clear that lockfd should be closed earlier.
2016-04-10 22:58:11 +01:00
Jun Wu
625c1b8ab3 chg: add sockdirfd to cmdserveropts
As part of the series to support long socket paths, we need to add the fd of
the directory to the cmdserveropts structure so we can use basenames instead
of full paths for sockname, redirectsockname, and lockfile.
2016-04-10 23:56:00 +01:00
Jun Wu
29846cf694 chg: fix spelling in the error message about error waiting for cmdserver
This is a trivial spelling and grammar fix.
2016-04-10 21:56:05 +01:00
Gregory Szorc
cec8c17960 sslutil: document and slightly refactor validation logic
This main purpose of this patch is to make it clearer that fingerprint
pinning takes precedence over CA verification. This will make
subsequent refactoring to the validation code easier to read.
2016-04-10 11:02:58 -07:00
Gregory Szorc
a8d6c2d5ca sslutil: require a server hostname when wrapping sockets (API)
All callers appear to be passing the hostname. So this shouldn't
break anything. By specifying the hostname, more validation options
from the ssl module are available to us. Although this patch stops
short of using them.
2016-04-10 11:00:41 -07:00
Gregory Szorc
fb3741de9b sslutil: move and document verify_mode assignment
Consolidating all the SSLContext options setting makes the code a
bit easier to read.
2016-04-10 10:59:45 -07:00
Gregory Szorc
6f997a4c95 tests: use --insecure instead of web.cacerts=!
--insecure is the proper and documented way to do this. The end result
is the same: dispatch will set web.cacerts to ! when --insecure is
passed.

This patch is necessary to refactor handling of web.cacerts in upcoming
patches.
2016-04-10 10:54:53 -07:00
Gregory Szorc
12984d10a8 help: remove references to "Python 2.6 or later"
We require Python 2.6. So there is no value to these docs.
2016-04-10 10:58:47 -07:00
Kostia Balytskyi
500aca2389 commands: make --rev and --index compatible in debugobsolete 2016-04-04 02:05:10 -07:00
Yuya Nishihara
806f7d15b4 tests: enable import checker for tests/**.py files
Several known-bad files are excluded as they couldn't be trivially fixed.
In principle, we should fix them first, however, it would have more risk
to keep Py3k porting going without the test coverage.

Still contrib/**.py aren't covered, which needs another round.
2016-04-03 19:38:57 +09:00
Yuya Nishihara
741cba12b5 tests: stop direct symbol import of mercurial modules in test-status-inprocess 2016-04-05 23:38:00 +09:00
Yuya Nishihara
8f06b9b68a tests: alias ui as uimod in test-revlog-ancestry/test-ui-verbosity 2016-04-05 23:35:45 +09:00
Yuya Nishihara
a84aaf0da5 tests: move stdlib imports before mercurial modules in test-parseindex2 2016-04-05 23:23:43 +09:00
Yuya Nishihara
6952398f8b tests: stop direct symbol import of pprint.pprint in tests-minirst 2016-04-05 23:22:38 +09:00
Yuya Nishihara
e9c97cfd36 tests: import mercurial modules by name in test-propertycache
This is our convention, and silences import-checker.py that would say
imports weren't lexically sorted.
2016-04-05 23:30:18 +09:00
Yuya Nishihara
c2a5918b06 tests: remove unused import of mercurial.repoview from test-propertycache
I don't see any reason to import it, but if there is a reason, please disregard
this and the next patch.
2016-04-05 23:33:55 +09:00
Yuya Nishihara
72e05b7594 templater: drop deprecated handling of KeyError from changeset_templater
It's been superseded by 50f9d20d4c27 and the previous patch. templater.mapfile
is no longer used and removed.
2016-04-03 11:23:31 +09:00
timeless
edef054d1b test-commandserver: handle cStringIO.StringIO/io.StringIO divergence 2016-04-06 20:34:34 +00:00
timeless
26ef04b4e1 pycompat: add util.stringio to handle py3 divergence
util.stringio = cStringIO.StringIO / io.StringIO
2016-04-06 20:31:31 +00:00
timeless
10677b7ace pycompat: alias xrange to range in py3 2016-04-06 22:35:52 +00:00