Commit Graph

28849 Commits

Author SHA1 Message Date
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
timeless
29cb0c1fb2 pycompat: fix demand import handling of Queue
When demandimport is enabled, simply importing a non existent module does
not trigger ImportError, a property access is necessary.
2016-04-08 14:03:05 +00:00
timeless
bf94a35755 util: use __code__ (available since py2.6) 2016-03-29 17:43:23 +00:00
Yuya Nishihara
d6788adafc templater: give better error message for invalid engine type
Before, KeyError was caught at changeset_templater._show(), which said "no
key named '%s'" as it was intended to catch the KeyError of unknown map key.
Instead, we should catch KeyError explicitly for better error indication.

For those who don't know what the template engine is (read "everyone"), it is
hidden extension feature that allows switching template syntax in map file.
See b901d7e82888 for details.
2016-04-03 11:20:50 +09:00
Durham Goode
67594c134c transaction: allow running file generators after finalizers
Previously, transaction.close would run the file generators before running the
finalizers (see the list below for what is in each). Since file generators
contain the bookmarks and the dirstate, this meant we made the dirstate and
bookmarks visible to external readers before we actually wrote the commits into
the changelog, which could result in missing bookmarks and missing working copy
parents (especially on servers with high commit throughput, since pulls might
fail to see certain bookmarks in this situation).

By moving the changelog writing to be before the bookmark/dirstate writing, we
ensure the commits are present before they are referenced.

This implementation allows certain file generators to be after the finalizers.
We didn't want to move all of the generators, since it's important that things
like phases actually run before the finalizers (otherwise you could expose
commits as public when they really shouldn't be).

For reference, file generators currently consist of: bookmarks, dirstate, and
phases. Finalizers currently consist of: changelog, revbranchcache, and fncache.
2016-04-07 14:10:49 -07:00
timeless
78312b6131 run-tests: move install.err into test area
Without this, sometimes installerrs generated errors
about no such file. It also did not work well when you
had multiple tests runners running around.

It also did not make sense to pollute the repository test
directory with the log file.
2016-04-07 11:11:55 +00:00
timeless
4fdfca9cff help: report source of aliases 2016-04-08 18:35:49 +00:00
timeless
d34897fb75 compact: add color labels to -Tcompact 2016-04-08 16:05:52 +00:00
Adrian Buehlmann
0262d50094 util: fix doc for datestr()
timezone parameter was removed with f88c82e9a297
2016-04-08 22:15:06 +02:00
Florent Gallaire
478ac5c37a date: reallow negative timestamp, fix for Windows buggy gmtime() (issue2513)
DVCS are very useful to store various texts (as legislation) written before
Unix epoch. Fri, 13 Dec 1901 is a nice gain over Thu, 01 Jan 1970.
Revert 856a0e92d107 and b47a679b4e83, fix b2228cbaa635. Add tests.
2016-04-08 14:11:03 +02:00
timeless
a863e51d9a tests: use /usr/bin/env python for test-status-inprocess.py
everyone else uses it, and the next commit will add a rule for it
2016-04-06 19:08:04 +00:00
Augie Fackler
e02a696ec8 run-tests: fix broken regular expression
The regular expression in use passed tests because the test repo only
has single-digit changesets present. When I tried to use this for real
today, it broke, because the regular expression would only match a
single digit.

https://xkcd.com/1171/, or something like that.
2016-04-06 22:26:47 -04:00
Pierre-Yves David
375f437d35 test: don't rely on __del__ in test-devel-warnings.t
Whatever the future of __del__ in Mercurial is, that devel-warning test is not
about testing the automatic transaction rollback and we should explicitly call
release.

This change make this tests pass with pypy, as pypy try less hard to call
__del__ at program exit.
2016-04-05 12:19:45 -07:00
Martijn Pieters
b0b9bca0ca dispatch: split out warning message generation to separate function
Allow for patching warning message generation, or for patching out the ui.log /
ui.warn behaviour (but still generate the warning message).
2016-04-05 20:01:23 +01:00
timeless
bc7ecb0989 check-code: reject import Queue, suggest util.queue class for py3 compat 2016-04-06 20:08:18 +00:00
timeless
85b96c6915 scmutil: use util.queue/util.empty for py3 compat 2016-04-06 20:07:51 +00:00