Commit Graph

101 Commits

Author SHA1 Message Date
Pierre-Yves David
f14b79a23f localrepo: move the changegroupsubset method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had few callers, not enough to be kept in local repo.

The peer API remains unchanged.
2014-04-01 14:25:03 -07:00
Pierre-Yves David
c6617aef8a wireproto: use decorator for the ubundle command 2014-03-28 14:43:30 -07:00
Pierre-Yves David
04af30a7a2 wireproto: use decorator for the stream command 2014-03-28 14:43:11 -07:00
Pierre-Yves David
5dd8ba7d3d wireproto: use decorator for the pushkey command 2014-03-28 14:42:55 -07:00
Pierre-Yves David
99c03cd1e0 wireproto: use decorator for the lookup command 2014-03-28 14:42:38 -07:00
Pierre-Yves David
fe6ed0903b wireproto: use decorator for the listkeys command 2014-03-28 14:42:21 -07:00
Pierre-Yves David
32d30d0970 wireproto: use decorator for the known command 2014-03-28 14:42:06 -07:00
Pierre-Yves David
8a8b960d73 wireproto: use decorator for the hello command 2014-03-28 14:40:44 -07:00
Pierre-Yves David
997e84e937 wireproto: use decorator for the heads command 2014-03-28 14:40:31 -07:00
Pierre-Yves David
73981cbf16 wireproto: use decorator for the getbundle command 2014-03-28 14:40:07 -07:00
Pierre-Yves David
a82db7631c wireproto: use decorator for the debugwireargs command 2014-03-28 14:39:06 -07:00
Pierre-Yves David
d39b82219d wireproto: use decorator for the changegroupsubset command 2014-03-28 14:38:40 -07:00
Pierre-Yves David
3b0626a933 wireproto: use decorator for the changegroup command 2014-03-28 14:38:19 -07:00
Pierre-Yves David
69ae194532 wireproto: use decorator for the capabilities command 2014-03-28 14:37:28 -07:00
Pierre-Yves David
d4a7f403ed wireproto: use decorator for the branches command 2014-03-28 14:37:02 -07:00
Pierre-Yves David
a0ec15e813 wireproto: use decorator for the branchmap command 2014-03-28 14:36:41 -07:00
Pierre-Yves David
16cb37a2d5 wireproto: use decorator for the between command 2014-03-28 14:36:05 -07:00
Pierre-Yves David
0797e04e6b wireproto: use decorator for the batch command 2014-03-28 14:35:36 -07:00
Pierre-Yves David
705b90da7b wireproto: add decorator for wire protocol command
Move move in the same direction we took for command line commands. each wire
protocol function will be decorated with its name and arguments.

Beside beside easier to read, this open the road to easily adding more metadata
(like security level or return type)
2014-03-28 14:30:11 -07:00
Pierre-Yves David
e3dee4d3e4 wireproto: drop the _decompress method in favor a new call type
We already have multiple call function for multiple return type. The
`_decompress` function is only used for http and seems like a layer violation.
We drop it in favor of a new call type dedicated to "stream that may be useful to
compress".
2014-03-28 14:24:13 -07:00
Pierre-Yves David
7d748aed99 wireproto: document protocol specific function of wirepeer
Those function are explicitly declared and documented now.
2014-03-28 12:29:34 -07:00
Pierre-Yves David
5d414d928b wireproto: introduce an abstractserverproto class
sshserver and webproto now inherit from an abstractserverproto class. This class
is introduced for documentation purpose.
2014-03-28 11:10:33 -07:00
Pierre-Yves David
271bd25192 wireproto: document possible return type
The wireprotocole command use a small set of class as return value. We document
the meaning of each of them.

AS my knowledge of wire protocol is fairly shallow, the documentation can
probably use improvement. But this is a better than nothing.
2014-03-28 11:37:42 -07:00
Pierre-Yves David
cae4a1d18a wireproto: move wireproto capabilities computation in a subfunction
It will help people that need to add capabilities (in a more subtle was that
just adding some to the list) in multiple way:

1. This function returns a list, not a string. Making it easier to look at,
   extend or alter the content.

2. The original capabilities function will be store in the dictionary of wire
   protocol command. So extension that wrap this function also need to update
   the dictionary entry.

   Both wrapping and update of the dictionary entry are needed because the
   `hello` wire protocol use the function itself. This is specifically sneaky for
   extension writer as ssh use the `hello` command while http use the
   `capabilities` command.

   With this new `_capabilities` function there is one and only one obvious
   place to wrap when needed.
2014-03-12 14:46:41 -07:00
Pierre-Yves David
342e942953 wireproto: extract capabilities list in outside the wireproto function
Before that it was over complicated to add capabilities from an extension.

This mimic was is done for capabilities in localrepo.
2014-03-11 01:38:02 -07:00
Augie Fackler
d394c651c2 wireproto: remove todict() and use {} literals instead 2014-03-12 13:00:51 -04:00
Benoit Boissinot
a898b587b8 bundle-ng: add bundlecaps argument to getbundle() command 2013-02-09 23:42:03 +01:00
Durham Goode
799e15746f clone: move file stream walk to a separate function
Moves the file walk out of the stream method so that extensions can override it.

This allows an extension to decide what files should be streamed, and in
particular allows a stream without filelogs.
2013-05-01 10:38:41 -07:00
Mads Kiilerich
bdab228647 wireproto: clarify cryptic 'remote: unsynced changes' error message on push
The message was not very much to the point and did not in any way help an
ordinary user.

'repository changed while preparing/uploading bundle - please try again'
is more correct, gives the user some understanding of what is going on, and
tells how to 'recover' from the situation.

The 'bundle' aspect could be seen as an implementation detail that shouldn't be
mentioned, but I think it helps giving an exact error message.

The message could still leave the user wondering why Mercurial doesn't lock the
repo and how unsafe it thus is. Explaining that is however too much detail.
2013-04-11 14:54:18 +02:00
Kevin Bullock
93f9cb7f25 filtering: rename filters to their antonyms
Now that changelog filtering is in place, it's become evident that
naming the filters according to the set of revs _not_ included in the
filtered changelog is confusing. This is especially evident in the
collaborative branch cache scheme.

This changes the names of the filters to reflect the revs that _are_
included:

  hidden -> visible
  unserved -> served
  mutable -> immutable
  impactable -> base

repoview.filteredrevs is renamed to filterrevs, so that callers read a
bit more sensibly, e.g.:

  filterrevs('visible') # filter revs according to what's visible
2013-01-13 01:39:16 -06:00
Mads Kiilerich
3ab92babe1 clone: don't include empty revlogs in stream 2013-01-15 20:55:47 +01:00
Pierre-Yves David
cfd0b99b67 clfilter: drop extra filtering in wireprotocol
The repository used by wireprotocol is already filtered. We no
longer need to call special functions.
2013-01-06 04:36:30 +01:00
Pierre-Yves David
96045ebc98 clfilter: filter "unserved" on all wireprotocol command calls
This ensures that unserved changesets are not exposed through the
wire protocol.
2013-01-06 04:37:33 +01:00
Wagner Bruna
795c3947e9 wireproto: fix pushkey hook failure and output on remote http repo
Over http, a failed pushkey hook simply crashed the server, and
successful hook output was never sent to the client.
2012-10-15 18:37:34 -03:00
Thomas Arendsen Hein
41c1ca4d45 wireproto: workaround for yield inside try/finally incompatible with python2.4 2012-09-18 17:00:58 +02:00
Patrick Mezard
ed389c0023 wireproto: fix check-code.py breakage introduced by 6e0f31b6f59a 2012-09-15 08:38:02 +02:00
Bryan O'Sullivan
10380b320f wireproto: don't format a debug string inside a hot loop
This improves stream_out performance by about 5%.
2012-09-14 12:06:40 -07:00
Bryan O'Sullivan
55e3685d62 wireproto: bypass filechunkiter for small files when streaming
Merely creating and using a generator has a measurable impact,
particularly since the common case for stream_out is generators that
yield just once. Avoiding generators improves stream_out performance
by about 7%.
2012-09-14 12:05:37 -07:00
Bryan O'Sullivan
0b5b186a96 wireproto: don't audit local paths during stream_out
Auditing at this stage is both pointless (paths are already trusted by
the local repo) and expensive. Skipping the audits improves stream_out
performance by about 15%.
2012-09-14 12:05:12 -07:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Pierre-Yves David
a4bba98ab8 pushkey: add more verbose debug output regarding pushkey
Very few data are displayed now, making it hard to debug phases and obsolete
related issues.
2012-07-28 12:28:35 +02:00
Pierre-Yves David
afa28ff113 repo: move visibleheads and visiblebranchmap logic in discovery
They were previously inside the mercurial.phases module, but obsolete
logic will need them to exclude `extinct` changesets from pull and
push.

The proper and planned way to implement such filtering is still to apply a
changelog level filtering. But we are far to late in the cycle to implement and
push such a critical piece of code (changelog filtering). With Matt Mackall
approval I'm extending this quick and dirty mechanism for obsolete purpose.

Changelog level filtering should come during the next release cycle.
2012-07-17 01:22:31 +02:00
Peter Arrenbrecht
ef7b77046e peer: introduce real peer classes
This change separates peer implementations from the repository implementation.
localpeer currently is a simple pass-through to localrepository, except for
legacy calls, which have already been removed from localpeer. This ensures that
the local client code only uses the most modern peer API when talking to local
repos.

Peers have a .local() method which returns either None or the underlying
localrepository (or descendant thereof). Repos have a .peer() method to return
a freshly constructed localpeer. The latter is used by hg.peer(), and also to
allow folks to pass either a peer or a repo to some generic helper methods.
We might want to get rid of .peer() eventually.

The only user of locallegacypeer is debugdiscovery, which uses it to pose as a
pre-setdiscovery client. But we decided to leave the old API defined in
locallegacypeer for clarity and maybe for other uses in the future.

It might be nice to actually define the peer API directly in peer.py as stub
methods. One problem there is, however, that localpeer implements
lock/addchangegroup, whereas the true remote peers implement unbundle.
It might be desireable to get rid of this distinction eventually.
2012-07-13 21:47:06 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Pierre-Yves David
c37b1089b6 branchmap: server should not advertise secret changeset in branchmap (Issue3303)
Discovery now use an overlay above branchmap to prune invisible "secret"
changeset from branchmap.

To minimise impact on the code during the code freeze, this is achieve by
recomputing non-secret heads on the fly when any secret changeset exists. This
is a computation heavy approach similar to the one used for visible heads. But
few sever should contains secret changeset anyway.  See comment in code for more
robust approach.

On local repo the wrapper is applied explicitly while the wire-protocol take
care of wrapping branchmap call in a transparent way. This could be unified by
the Peter Arrenbrecht and Sune Foldager proposal of a `peer` object.

An inappropriate `(+i heads)` may still appear when pushing new changes on a
repository with secret changeset. (see Issue3394 for details)
2012-04-24 16:32:44 +02:00
Pierre-Yves David
7d0ee06c06 wireprotocol: use visibleheads as reference while unbundling (issue 3303)
The `repo` object here is *always* local. Using `repo.heads()` ensure we will
reject push if any secret changeset exists.

During discovery, `visibleheads` were sent to the peer. So we can only expect it
to send us `visibleheads` back. If any secret changeset exists::

    visibleheads != repo.heads()

This fix server side part of issue 3303 when pushing over the wire.
2012-04-26 03:47:17 +02:00
Benoit Allard
ed90b14694 protocol: Add the stream-preferred capability
This makes the client use the uncompressed protocol.
2012-04-04 00:00:47 +02:00
Matt Mackall
464b6bafef wireproto: refuse to lookup secret csets 2012-01-18 20:00:48 -06:00
Pierre-Yves David
8abd0aa7c9 phases: do not exchange secret changesets
Any secret changesets will be excluded from pull and push. Phase data are
properly synchronized on pull and push if a changeset is seen as secret locally
but is non-secret remote side.

This patch does not handle the case of a changeset secret on remote but known
locally.
2011-12-22 00:42:25 +01:00
Pierre-Yves David
3f5fbfb66a wireproto: handle other server output in pushkey
Remote side may add useful information alongside failure return code. For
example "ssl is required". This patch mirror what is done for the unbundle
command.
2011-12-12 15:16:58 +01:00