Commit Graph

20731 Commits

Author SHA1 Message Date
Pierre-Yves David
9e7aaa60ee bundle2: read the whole bundle from stream on abort
When the bundle processing abort on unknown mandatory parts, we now makes sure
all the bundle content is read. This avoid leaving the communication channel in
an unrecoverable state.
2014-03-24 17:20:15 -07:00
Pierre-Yves David
d0833349ae bundle2: add some distinction between mandatory and advisory part
Mandatory part cannot be ignored when unknown. We raise a simple KeyError
exception when this happen.

This is very early version of this logic, see inline comment for future
improvement lead.
2014-03-24 13:02:02 -07:00
Pierre-Yves David
074a113388 bundle2: introduce a parthandler decorator
Simple syntax sugar to register an handler for a new part type.
2014-03-24 15:51:00 -07:00
Pierre-Yves David
61eb0495c2 bundle2: first version of a bundle processing
We now have a function that interpret part content.

This is a version early version of this function. It'll see major changes in
scope and API in future development. As for previous I'm just focussing on
getting minimal logic setup. Refining will happen with real world usage.
2014-03-24 12:25:33 -07:00
Pierre-Yves David
c06a07b852 bundle2: rename unbundle2 test command to statbundle2
We will introduce object to actually process the bundle, we need to keep the
simplistic unbundle around for the test.
2014-03-24 11:27:00 -07:00
Pierre-Yves David
6c017016a8 bundle2: safely read unpack data from part header
We use the same approach that the other unpack, as function is given the struct
format and his both responsible for reading the right amount of data from the
header and unpack the struct.

This give use flexibility if we decide to change the size of something in the
format before the release.
2014-04-01 00:08:15 -07:00
Matt Mackall
2cef67b922 transaction: drop extra import caught by pyflakes 2014-04-02 13:41:23 -05:00
Durham Goode
3075ab82ec fncache: clean up fncache during strips
Previously the fncache was cleaned up at read time by noticing when it was out
of sync. This caused writes to happen outside the scope of transactions and
could have caused race conditions. With this change, we'll keep the fncache
up-to-date as we go by removing old entries during repair.strip.
2014-03-24 15:43:15 -07:00
Durham Goode
b9e3b76bea caches: invalidate store caches when lock is taken
The fncache was not being properly invalidated each time the lock was taken, so
in theory it could contain old data from prior to the caller having the lock.
This changes it to be invalidated as soon as the lock is taken (same as all our
other caches).
2014-03-24 15:35:07 -07:00
Durham Goode
950d3b4dd3 fncache: move fncache writing to be in a transaction
Previously the fncache was written at lock.release time. This meant it was not
tracked by a transaction, and if an error occurred during the fncache write it
would fail to update the fncache, but would not rollback the transaction,
resulting in an fncache that was not in sync with the files on disk (which
causes verify to fail, and causes streaming clones to not copy all the revlogs).

This uses the new transaction backup mechanism to make the fncache transacted.
It also moves the fncache from being written at lock.release time, to being
written at transaction.close time.
2014-03-24 15:42:13 -07:00
Durham Goode
1fd6146a66 transaction: add support for non-append files
This adds support for normal, non-append-only files in transactions.  For
example, .hg/store/fncache and .hg/store/phaseroots should be written as part of
the transaction, but are not append only files.

This adds a journal.backupfiles along side the normal journal. This tracks which
files have been backed up as part of the transaction.  transaction.addbackup()
creates a backup of the file (using a hardlink), which is later used to recover
in the event of the transaction failing.

Using a seperate journal allows the repository to still be used by older
versions of Mercurial. A future patch will use this functionality and add tests
for it.
2014-03-24 15:21:51 -07:00
Durham Goode
503655f175 transaction: add onclose/onabort hook for pre-close logic
Adds an optional onclose parameter to transactions that gets called just before
the transaction is committed. This allows things that build up data over the
course of the transaction (like the fncache) to commit their data.

Also adds onabort. It's not used, but will allow extensions to hook into onclose
and onabort to provide transaction support.
2014-03-24 15:57:47 -07:00
Durham Goode
4964eadcf8 clone: put streaming clones in a transaction
Streaming clones were writing to files outside of a transaction. Soon the
fncache will be written at transaction close time, so we need streaming clones
to be in a transaction.
2014-03-24 15:38:20 -07:00
Durham Goode
2f98d8b12a fncache: remove the rewriting logic
The fncache could rewrite itself during a read operation if it noticed any
entries that were no longer on disk. This was problematic because it caused
Mercurial to perform write operations outside the scope of a lock or
transaction, which could interefere with any other pending writes.

This will be replaced in a future patch by logic that cleans up the fncache
as files are deleted during strips.
2014-03-24 15:31:47 -07:00
Pierre-Yves David
a4638e445b pull: prevent duplicated entry in op.pulledsubset
In the bare pull case we could add the same node multiple time to the
`pulloperation.pulledsubset`. Beside being a bit wrong this confused the new
revset implementation of `revset._revancestor` into giving bad result.

This changeset fix the pull operation part. The fix for the revset itself will
come in another changeset.
2014-03-26 15:55:32 -07:00
Pierre-Yves David
d9d35475e7 bundle2: part params 2014-03-20 01:24:45 -07:00
Pierre-Yves David
307f4468ab bundle2: support for bundling and unbundling payload
We add the ability to bundle and unbundle a payload in parts. The payload is the
actual binary data of the part. It is used to convey all the applicative data.
For now we stick to very simple implementation with all the data fit in single
chunk. This open the door to some bundle2 testing usage. This will be improved before
bundle2 get used for real. We need to be able to stream the payload in multiple
part to exchange any changegroup efficiently. This simple version will do for
now.

Bundling and unbundling are done in the same changeset because the test for
parts is less modular. However, the result is not too complex.
2014-03-19 23:36:15 -07:00
Matt Mackall
1e3dcd8d35 merge with stable 2014-04-01 17:59:06 -05:00
Matt Mackall
71fa6b44a6 Added signature for changeset bced32a3fd6c 2014-04-01 17:57:04 -05:00
Matt Mackall
c9eb4517fa merge with stable 2014-04-01 15:11:19 -05:00
FUJIWARA Katsunori
0eed53de6c i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that format string consists of multiple string
components concatenated implicitly or explicitly,

This patch does below for that regexp pattern to detect "% inside _()"
problems in such case.

  - put "+" into separator part ("[ \t\n]") for explicit concatenation
    ("...." + "...." style)

  - enclose "component and separator" part by "(?:....)+" for
    concatenation itself ("...." "...." or "...." + "....")
2014-04-01 02:46:03 +09:00
FUJIWARA Katsunori
01d8b27701 i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that the format string and "%" aren't placed in the
same line.

This patch replaces "\s" in that regexp pattern with "[ \t\n]" to
detect "% inside _()" problems in such case.

"[\s\n]" can't be used in this purpose, because "\s" is automatically
replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes
nested "[]" unexpectedly.
2014-04-01 02:46:03 +09:00
FUJIWARA Katsunori
e0d81db88f merge: fix lack of "%s" in format string causing TypeError at runtime 2014-04-01 02:46:03 +09:00
Wagner Bruna
a79773afe1 i18n-pt_BR: synchronized with a61616787725 2014-04-01 13:27:12 -03:00
FUJIWARA Katsunori
c4397fd764 i18n-ja: synchronized with 53c6e4195bb0 2014-03-31 21:03:39 +09:00
Sean Farley
04ea4eb32d tests: use TESTTMP instead of TESTDIR
In d87f1c1d18fa, be4d37a43992, 394118f2cf71, and 7594c2ea371e, new tests were
added that used TESTDIR instead of TESTTMP thereby leading to polluting the
working directory with these temporary files. Now, we use TESTTMP so that they
will be cleaned up properly.
2014-03-28 14:33:27 -05:00
FUJIWARA Katsunori
920a8f861c hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109)
Since changeset a8955c4d9ef5, "reposetup()" of each extensions is
invoked only on repositories enabling corresponded extensions.

This causes that largefiles specific interactions between the
repository enabling largefiles locally and remote (wire) peer fail,
because there is no way to know whether largefiles is enabled on the
remote repository behind the wire peer, and largefiles specific
"wireproto functions" are not given to any wire peers.

To avoid this problem, largefiles should be enabled in wider scope
than each repositories (e.g. user-wide "${HOME}/.hgrc").

This patch introduces "wirepeersetupfuncs" to setup wire peer by
extensions already enabled. Functions registered into
"wirepeersetupfuncs" are invoked for all wire peers.

This patch uses plain list instead of "util.hooks" for
"wirepeersetupfuncs", because the former allows to control order of
function invocation by order of extension enabling: it may be useful
for workaround of problems with combination of enabled extensions
2014-03-29 01:20:07 +09:00
Sean Farley
029b060498 templater: raise error for unknown func
Previously, if a template '{foo()}' was given, the buildfunc would not be able
to match it and hit a code path that would not return so it would error out
later in the templater stating that NoneType was not iterable. This patch makes
sure that a proper error is raised so that the user can be informed.

Tests have been updated.
2014-03-27 17:21:27 -05:00
Pierre-Yves David
875acaf161 bundle2: support unbundling empty part
We augment the unbundler to make it able to unbundle the empty part we are now
able to bundle.
2014-03-19 23:04:03 -07:00
Pierre-Yves David
3a1c934d6a revset: raise ValueError when calling min or max on empty smartset
min([]) raise a ValueError, we do the same thing in smartset.min() and
smartset.max() for the sake of consistency.

The min/amax test are greatly improved in the process to prevent this familly
of regression
2014-03-28 17:00:13 -07:00
Pierre-Yves David
ce5b702bdf revpair: smartset compatibility
Since recent revset changes, revrange now return a smartset. This smart set
probably does not support indexing (_addset does not). This led to crash.
Instead when the smartset is ordered we use the `min` and `max` method of
smart set. Otherwise we turn is into a list and use indexing on it.

The tests have been updated to catch such regression.
2014-03-20 18:44:25 -07:00
Gregory Szorc
f89981fba5 revsetbenchmark: add entry for ::rev::
Revsets of the form ::rev:: were identified as the source behind the
regressions in issue 4201. Ensure we have explicit coverage of that
revset.
2014-03-28 16:12:05 -07:00
Kevin Bullock
c63d1fcf68 merge with stable
This should correct an earlier couple of bad merges (5433856b2558 and
596960a4ad0d, now pruned) that accidentally brought in a change that had
been marked obsolete (244ac996a821).
2014-03-31 10:12:07 -05:00
Pierre-Yves David
72d1282e60 bundle2: support bundling of empty part (with a type)
Here start the work on bundle2 parts. Our first step is to be able to bundle a simplistic
part that just have a type, no parameters, empty payload.
2014-03-18 14:29:33 -07:00
Pierre-Yves David
2df0f51a30 revsetbenchmark: add a summary at the end of execution
The summary list timing per revset making it much more easier to compare
revision to each other.
2014-03-26 18:51:49 -07:00
Pierre-Yves David
63b573d0ad revsetbenchmark: retrieve the benchmark value in python
We retrieve the output of the perf extension and print it ourself. This open the
door to processing of this data in the script.
2014-03-26 18:39:56 -07:00
Pierre-Yves David
b9be167079 revsetbenchmark: get revision to benchmark in a function
And move it to proper subprocess call.
2014-03-26 18:36:19 -07:00
Pierre-Yves David
9aaf552368 revsetbenchmark: convert revision display to proper subprocesscall 2014-03-26 18:27:17 -07:00
Pierre-Yves David
9af19c7201 revsetbenchmark: convert performance call to proper subprocess call 2014-03-26 18:26:18 -07:00
Pierre-Yves David
2214b66655 revsetbenchmark: convert update to proper subprocess call 2014-03-26 18:14:15 -07:00
Matt Mackall
cf6b799f9a revsetbenchmark: fix semicolon 2014-03-27 16:52:24 -05:00
Pierre-Yves David
05c4763edb revsetbenchmark: simplify and convert the script to python
The script is now in python. That translation is very raw, more improvement to
comes:

The "current code" and "base" entry have been dropped.  This is trivial to get
same result using a tagged revision or "." in the list of benchmarked revision.
2014-03-26 18:03:30 -07:00
Pierre-Yves David
258f4d6aa6 revsetbenchmapi: fix template
The revision description missed an \n
2014-03-26 16:38:08 -07:00
Pierre-Yves David
8dd85d0996 perf: unroll the result in perfrevset
With the new lazy revset implementation, we need to actually read all elements
to trigger all the computations. Otherwise a no-op if of course much faster than
the full work.
2014-03-26 17:25:11 -07:00
Pierre-Yves David
4e0cea0c36 _addset: add a __len__ method
Back in the time where repo.revs(...) returned a list, calling `len(...)` on the
result was quite common. We reinstall this on _addset.

There is absolutely no easy way to test this from the command line. The commands
using this in the evolve extension will eventually land into core.
2014-03-20 18:55:28 -07:00
Pierre-Yves David
63355bceee bundle2: implement the mandatory/advisory logic for parameter
Parameter starting with an upper case are mandatory, the one starting with a
lower case are advisory and may be ignored.
2014-03-19 17:53:45 -07:00
Pierre-Yves David
335e57b78f bundle2: print debug information during unbundling
The unbundler class is now feed with an ui object and use it to transmit data
about the unbundling process.
2014-03-19 17:11:49 -07:00
Pierre-Yves David
9f528702b6 bundle2: print debug information during bundling
The bundler class is now feed with an ui object and use it to transmit data
about the bundling process.
2014-03-18 19:07:10 -07:00
Pierre-Yves David
9339c0db4d bundle2: add ability to write to a file to the test
Next changesets are about improving debug output during bundling. We won't be
able to simply bundle to stdin in this case. The bundle2 stream would be
interleaved with debug output.
2014-03-19 02:36:21 -07:00
Siddharth Agarwal
cb8e8f55a1 subrepo: factor out Git version check to add doctests
Followup to 80233b59577b::49a2288fb74f.
2014-03-21 16:09:17 -07:00