Commit Graph

29480 Commits

Author SHA1 Message Date
Yuya Nishihara
6c0a0f348a chg: just take it as EOF if recv() returns 0
hgc->sockfd is a blocking stream socket. recv() should never return 0 other
than EOF.

See 4ff8628991ea for the original problem.
2016-08-05 21:21:33 +09:00
Pierre-Yves David
afdcdcbe8e vfs: use propertycache for open
The current open method is currently behaving like a property cache. We use our
utility decorator to make this explicit.
2016-08-04 16:56:50 +02:00
Augie Fackler
127114bb19 check-commit: allow underbars in cffi_-prefix function names
It seems reasonable to give cffi functions slightly more verbose names
in some circumstances, given the way they interface with C.
2016-08-05 17:27:51 -04:00
Augie Fackler
ba4d11b62e bundlerepo: add support for treemanifests in cg3 bundles
This is a little messier than I'd like, and I'll probably come back
and do some more refactoring later, but as it is this unblocks
narrowhg. An alternative approach (which I may do as part of the
mentioned refactoring) would be to construct *all* dirlog instances up
front, so that we don't have to keep track of the linkmapper
method. This would avoid a reference cycle between the bundlemanifest
and the bundlerepository, but I was hesitant to do all the work up
front like that.

With this change, it's possible to do 'hg incoming' and 'hg pull' from
bundles in .hg/strip-backup in a treemanifest repository. Sadly, this
doesn't make it possible to 'hg clone' one of those (if you do 'hg
strip 0'), because the cg3 in the bundle gets written without a
treemanifest flag. Since that's going to be an involved refactor in a
different part of the code (which I *suspect* won't touch any of the
code I've just written here), let's leave it as an idea for Later.
2016-08-05 13:08:11 -04:00
Augie Fackler
7e6d830e94 auditvfs: forward options property from nested vfs
This was breaking my ability to use treemanifests in bundlerepos, and
was deeply mysterious. We should probably just make the options
property a formal part of the vfs API, and make it a required
construction parameter. Sadly, I don't have time to dive into that
refactor right now.
2016-08-05 11:19:22 -04:00
Augie Fackler
7b4dc2c6d6 bundlerepo: use supportedincomingversions instead of allsupportedversions
Since bundlerepo is really a pull-like operation, this is the correct
method to use here.
2016-08-04 14:13:35 -04:00
Augie Fackler
7c233d9381 bundlerepo: introduce method to find file starts and use it
This moves us to the modern iter() technique instead of the `while
True` pattern since it's easy. Factored out as a function because I'm
about to need this in a second place.
2016-08-05 13:07:58 -04:00
Augie Fackler
ce135bfec2 bundlerevlog: use for loop over iterator instead of while True
The iter() builtin has a neat pattern where you give it a callable of
no arguments and a sentinel value, and you can then loop over the
function calls like a normal iterator. This cleans up the code a
little.
2016-08-05 13:09:50 -04:00
Augie Fackler
3bb87a6688 bundlerepo: use for loop over iterator instead of while True
The iter() builtin has a neat pattern where you give it a callable of
no arguments and a sentinel value, and you can then loop over the
function calls like a normal iterator. This cleans up the code a
little.
2016-08-05 13:09:24 -04:00
Augie Fackler
aa68b8b2d6 localrepo: jettison now-unused dirlog() method from localrepo 2016-08-05 12:47:03 -04:00
Augie Fackler
cc39e93327 repair: build dirlogs using manifest, rather than repo shortcut method
As before, this was rarely used, so let's get rid of the convenience method.
2016-08-05 13:01:01 -04:00
Augie Fackler
b5edcbb2f6 cmdutil: open dirlogs via manifest property, not via repo
This was a convenience method that was rarely used, so let's get rid of it.
2016-08-05 13:00:33 -04:00
Augie Fackler
d19a4d923c wirepeer: rename confusing source parameter
It's named "url" everyplace else this method is defined, so let's be
consistent.
2016-08-05 16:34:30 -04:00
Pierre-Yves David
15e8baf199 develwarn: use the lock helper in local repo
We have a helper function to know if a lock is taken. When checking lock usage
we now use it instead of manually accessing the locks.
2016-08-05 13:44:17 +02:00
Yuya Nishihara
dbb4c18c54 debugextension: change "testedwith" to a list (BC)
It wasn't a list since the formatter couldn't process a list. We have no
such problem now and the -T option is experimental, so we can change it.
2016-03-19 17:19:03 -07:00
Yuya Nishihara
de8bc280b9 debugextensions: unindent nested if 2016-07-10 22:07:34 +09:00
Yuya Nishihara
fc753f3836 debugextensions: give short name to util.version() 2016-07-10 22:06:13 +09:00
Yuya Nishihara
c68b0f691e debugextensions: simply keep testedwith variable as a list
There should be no need to distinguish [] and None.
2016-07-10 21:59:43 +09:00
Augie Fackler
a445a45d1d test-treemanifest: ensure manifest command isn't broken
I realized we weren't testing this while hunting a broken manifest
command bug that ended up being narrowhg's fault.
2016-07-28 16:27:35 -04:00
Pulkit Goyal
7a4ee4f18a py3: use unicode literals in pure/osutil.py
The first element of _fields_ tuples must be a str in Python 3.
Also fix some function calls that were also expecting str.
2016-08-04 00:32:19 +05:30
Pulkit Goyal
d6e3ff1be2 py3: use unicode literals in crecord.py 2016-08-04 00:21:14 +05:30
Pulkit Goyal
5ea942af2d py3: use unicode literals in changelog.py
collections.namedtuple type and field names must be str in Python 3.
Our custom module importer was rewriting them to bytes literals,
making this fail.

In addition, __slots__ values must also be unicode.
2016-08-04 00:15:39 +05:30
Maciej Fijalkowski
c98b11e3dd mpatch: write a cffi version of mpatch.patches 2016-07-25 15:10:52 +02:00
Maciej Fijalkowski
8d7ca5fe20 mpatch: remove dependency on Python.h in mpatch.c
Now all the CPython-related stuff are referenced only from
mpatch_module.c with mpatch.c being freely usable from
a future cffi module
2016-07-22 17:28:05 +02:00
Maciej Fijalkowski
3bdeeb5959 mpatch: split mpatch into two files 2016-07-18 19:02:30 +02:00
Maciej Fijalkowski
3d64f15242 mpatch: provide things that will be exported later with a prefixed name
For cffi a bunch of mpatch functions need to be visible through a .h file.
This change renames them so it won't create potential c namespace conflicts.
2016-07-18 16:25:14 +02:00
Maciej Fijalkowski
43e619711a mpatch: change Py_ssize_t to ssize_t in places that will be later copied 2016-07-18 15:14:40 +02:00
Gregory Szorc
9f5f743c8a discovery: move code to create outgoing from roots and heads
changegroup.changegroupsubset() contained somewhat low-level code for
constructing an "outgoing" instance from a list of roots and heads
nodes. It feels like discovery.py is a more appropriate location for
this code.

This code can definitely be optimized, as outgoing.missing will
recompute the set of changesets we've already discovered from
cl.between(). But code shouldn't be refactored during a move, so
I've simply inserted a TODO calling attention to that.
2016-08-03 22:07:52 -07:00
Pierre-Yves David
000dd50a40 bundle2: remove 'experimental.bundle2-exp' boolean config (BC)
All users are migrated to 'devel.legacy.exchange', we can clean up the
experimental namespace.

Marking as (BC) because I know some large installation have bundle2 off and I
want to make sure they notice the change.
2016-08-03 16:23:26 +02:00
Pierre-Yves David
a8616bb250 tests: remove all remaining usage of experimental.bundle2-exp
The only remaining usage of the experimental config were enforcing bundle2 on.
These are very old remains of when bundle2 was off by default. This was also
useful to highlight the fact that this was a bundle2 run and that a bundle1 one
was nearby. However, we want a future developer working on bundle3 to notice
possible output/behavior change on these tests and take them in account.  So we
do not enforce bundle2 for these runs. We leave a comment around to make sure
dev still notice the bundle1 version.
2016-08-03 15:52:11 +02:00
Pierre-Yves David
69f1aa48c0 tests: use 'legacy.exchange' option in various mixed tests
The new option will stay around. The experimental option was only meant to be
temporary. We update various tests that validate both bundle1 and bundle2
version side by side. This changeset only takes care of enforcing bundle1. The
other use of 'experimental.bundle2-exp=True' will be taken care of in the next
changeset.
2016-08-03 15:39:55 +02:00
Pierre-Yves David
bc402d96c6 tests: use 'legacy.exchange' option in various bundle1 tests
The new option will stay around. The experimental option was only meant to be
temporary.
2016-08-03 15:34:03 +02:00
Pierre-Yves David
1ba19266a7 tests: use 'legacy.exchange' option in 'test-bundle2-exchange.t'
The new option will stay around. The experimental option was only meant to be
temporary.
2016-08-02 15:23:03 +02:00
Pierre-Yves David
6236bcaa4b bundlerepo: also read the 'devel.legacy.exchange' config
Bundlerepo does its own bundle2 related logic.
2016-08-03 16:42:10 +02:00
Pierre-Yves David
d98d072a06 bundle2: add a devel option controling bundle version used for exchange
We need an official way to force bundle1 to be used in test. We introduce a new
option 'devel.legacy.exchange' to control this. When specified, this option
will control the list of bundle version Mercurial consider when exchanging with
a peer. Current valid value are 'bundle1' and 'bundle2'.

Using this option in all tests will allow us to remove the
'experimental.bundle2-exp' option. We will simplify the code once the
experimental option is dropped.
2016-08-02 14:48:21 +02:00
Pierre-Yves David
732a3dd97c bundle2: rename the _canusebundle2 method to _forcebundle1
We rename and invert the logic of the _canusebundle2 utility. The idea here is
that we need to have a way to enforce the use of bundle1 in the tests. The
Mercurial philosophy is to try to use the best method available. Currently that
best method is bundle2, but this might change in the future. Therefore expressing
"do not use bundle2" is a loosy way to say "use bundle 1" and will likely create
issue in the future. As the config option will be explicitly about bundle1, we
rename the function beforehand to align with this. This will make the life of a
future developer working on bundle3 easier.
2016-08-03 15:01:23 +02:00
Pierre-Yves David
beb086d931 tests: remove bundle2 activation from test-bookmark-pushpull.t
This is an old config that predate bundle2 on by default. This should have been
remove after Mercurail 3.6 got released.
2016-08-03 14:24:09 +02:00
Anton Shestakov
f6519368e1 tests: update bugzilla link in test-issue1175.t 2016-08-04 19:51:03 +08:00
Yuya Nishihara
7c8b72638d journal: use fm.formatdate() to pass date tuple in appropriate type (BC) 2016-07-31 17:11:48 +09:00
Yuya Nishihara
bcdd7c502f formatter: add function to convert date tuple to appropriate format 2016-07-31 17:07:29 +09:00
Yuya Nishihara
431f6e2124 journal: use fm.formatlist() to pass hashes in appropriate type (BC) 2016-07-31 16:56:26 +09:00
Yuya Nishihara
f449ec5977 formatter: add function to convert list to appropriate format (issue5217)
Before, it wasn't possible for formatter to handle array structure other
than date tuple. We've discussed that at the last sprint, which ended we
would probably want to allow only templatable data structure, i.e. a list
of dicts:

  data(tags=[{'tag': a}, {'tag': b}, ...])

Unfortunately, it turned out not working well with template functions:

  "{ifcontains(a, tags, ...)}"
    ^^^^^^^^^^^^^^^^^^
    "a in tags", where tags should be a plain list/set of tags

So the formatter must at least know if the type [{}] was constructed from
a plain list or was actually a list of dicts.

This patch introduces new explicit interface to convert an array structure
to an appropriate data type for the current formatter, which can be used
as follows:

  fm.write('tags', _('tags: %s\n'), fm.formatlist(tags, name='tag'))

No separate fm.data() call should be necessary.
2016-07-10 21:03:06 +09:00
Yuya Nishihara
df734a45ca journal: use fm.hexfunc() to get full hash in JSON/template output (BC)
We generally do that.
2016-07-31 16:38:16 +09:00
Pulkit Goyal
b12e59d025 py3: update test-check-py3-compat.t output
The lower part of test-check-py3-compat.t runs only on py3 and hence its
 remain unchanged. Hence this patch updates the output so that change in output
 in the next patches will be only related to the change in the patch.
2016-08-04 00:04:48 +05:30
Pierre-Yves David
9652a8ad03 deprecation: enforce thew 'tr' argument of 'dirstate.write' (API)
Compatibility was meant to be drop after 3.9 is released.
2016-08-02 16:51:27 +02:00
Pierre-Yves David
a7ac53500f tests: remove initial bundle2 enabling in various bundle2 tests
Bundle 2 is enable by default since 3.6 so we don't need this anymore.

The remaining use of 'experimental.bundle2-exp' are there to test legacy behavior
with bundle 1. Future patches will introduce a way outside of experimental to
test that.
2016-08-02 14:54:06 +02:00
Pierre-Yves David
f1d1e225a0 tests: remove bundle2 activation from test-largefiles.t
This is an old config that predate bundle2 on by default. This should have been
remove after Mercurail 3.6 got released.
2016-08-02 15:44:51 +02:00
Pierre-Yves David
a4d5cee7ca tests: remove bundle2 activation from test-tags.t
This is an old config that predate bundle2 on by default. This should have been
remove after Mercurail 3.6 got released.
2016-08-02 15:05:57 +02:00
Yuya Nishihara
bd360299a6 templatekw: change joinfmt to a mandatory argument of _hybrid object
We've fixed several bugs caused by the misuse of the default joinfmt. Make
it more explicit to prevent future bugs.

dict.values()[0] is replaced by dict[element] as showlist() knows what the
key is.
2016-07-23 13:08:43 +09:00
Yuya Nishihara
24e1889328 url: drop compatibility wrapper of socket.create_connection()
It should be available on Python 2.6+.
2016-07-18 23:12:09 +09:00