Commit Graph

8588 Commits

Author SHA1 Message Date
Matt Mackall
bd7c2104ff match: fix _patsplit breakage with drive letters 2009-05-24 16:37:34 -05:00
Patrick Mezard
945857d352 statichttprepo: handle remote not supporting Range headers
- If remote does not support Range header, 200 is answered instead of 206. The
  HTTPRangeHandler left these responses unchanged, so the data has to be sliced
  by the receiver.
- httprangereader file pointer was not updated.
2009-05-24 18:31:01 +02:00
Patrick Mezard
64fcf86ad8 convert: better feedback when filtering out empty revisions
Original patch by Herbert Griebel <herbertg@gmx.at>
2009-05-24 18:30:59 +02:00
Nicolas Dumazet
582e6f20e6 inotify: server: use a common 'pollable' interface for server & repowatcher
Mainly for documentation purposes: it easily explains the role of handle_event
and handle_timeout, and why both server & repowatcher implement those methods.
2009-05-21 17:09:12 +09:00
Nicolas Dumazet
1cf7198203 inotify: process all inotify events in one batch
When several inotify events happen, we don't have to process each event
separately, calling everytime repowatcher.read_events() to fetch events from
the underlying watcher: it is sufficient to call once read_events, to fetch
all the events from the watcher.
2009-05-21 19:26:15 +09:00
Nicolas Dumazet
08b9ba447b inotify: rename handle_event to handle_pollevent to avoid confusion
event here refers to poll events, and are different from events read in
server.read_events for example, where those events are inotify events.
2009-05-21 19:22:29 +09:00
Nicolas Dumazet
4ae3c9eabb inotify: handle_event: do not use event and fd parameters.
event is particularly confusing given the context (is it an inotify event?
a polling event?) and is never used. Remove it.
fd has very little use, and it gives the false impression that event handling
depends on fd. It's wrong: the same behavior is triggered, for all events.
2009-05-21 16:54:05 +09:00
Nicolas Dumazet
bf53b0a777 inotify: use a decorator instead of dispatching calls 2009-05-22 10:26:56 +09:00
Nicolas Dumazet
de0c07524f inotify: do not defer inotify events processing
Doing a part of the event processing and deferring the rest is a bad
habit: it complexifies the code, and it does not respect event ordering!
Moreover, there is already a timeout handling, so that inotify events are
only processed when a treshold is exceeded: there is no requirement to
delay anymore the events processing.
2009-05-22 09:57:53 +09:00
Nicolas Dumazet
3ae7c6e00c inotify: do not recurse in handle_timeout(): call it explicitely, not in scan()
When in handle_timeout, scan() is called when a repertory is created/modified.
But the first line of scan calls handle_timeout.
This had the consequence of calling recursively handle_timeout:
* several calls to read_events (but only the first one retrieves events)
* every time that an event is queued for a deferred action, the next time that
  scan() is called, handle_timeout is called, the event queue is treated,
  even if all the events haven't been read/queued yet. This could lead to
  inconsistencies
2009-05-21 15:55:58 +09:00
Henrik Stuart
1da4923acd i18n-da: typo 2009-05-24 17:07:27 +02:00
Benoit Boissinot
9ad2c4fd5b merge with crew 2009-05-24 16:33:22 +02:00
Patrick Mezard
82ffe82eb9 convert: deprecate external cvsps, to be removed in 1.4 2009-05-24 16:27:56 +02:00
Patrick Mezard
c51f73163e osutil: silence uninitialized variable warning 2009-05-24 16:27:50 +02:00
Patrick Mezard
c9834814d1 convert/hg: update documentation 2009-05-24 16:27:37 +02:00
Henrik Stuart
d300d070aa i18n-da: better word for "check" 2009-05-24 16:16:46 +02:00
Henrik Stuart
033abc3cf6 i18n-da: fixed use of plural form for parent 2009-05-24 16:14:32 +02:00
Henrik Stuart
6ac5caaeab i18n-da: better Danish word for "entry" 2009-05-24 15:20:04 +02:00
Simon Heimberg
293c5101a0 runtest: do not start testing when there is no test 2009-05-19 09:36:20 +02:00
Henrik Stuart
01c54d72e3 templatefilters: add filter to convert date to local date (issue1674)
Issue1674 suggests the localdate filter be applied as default to log,
but this patch only introduces the filter, not the changed default
behaviour.
2009-05-24 11:41:07 +02:00
Henrik Stuart
a79a5a1a15 url: use CONNECT for HTTPS connections through HTTP proxy (issue967)
urllib2 and httplib does not support using CONNECT proxy requests, but
only regular requests over the proxy. This does not work with HTTPS
requests as they typically require that the client issues a CONNECT to
the proxy to give a direct connection to the remote HTTPS server.

This is solved by duplicating some of the httplib functionality and
tying it together with the keepalive library such that a HTTPS
connection that need to be proxied can be proxied by letting a
connection be established to the proxy server and then subsequently
performing the normal request to the specified server through the
proxy server.

As it stands, the code also purports to support HTTPS proxies, i.e.
proxies that you connect to using SSL. These are extremely rare and
nothing is done to ensure that CONNECT requests can be made to these
as that would require multiple SSL handshakes. This use case is also
not supported by most other contemporary web tools like curl and
Firefox3.
2009-05-22 08:56:43 +02:00
Simon Heimberg
4b2cc385e8 dirstate: skip step 3 in walk if nothing new will match
nothing will ever match on match.never
nothing new will match on match.exact (all found in step 1)
nothing new will match on match.match when
  there is no pattern and
  there is no direcory in pats
2009-05-14 19:54:26 +02:00
Simon Heimberg
3a8453f88a dirstate: set more states in step 1 of walk 2009-05-14 10:50:45 +02:00
Matt Mackall
f1416e098e match: fold match into _match base class 2009-05-24 02:56:22 -05:00
Matt Mackall
50be99f7cb match: add exact flag to match() to unify all match forms 2009-05-24 02:56:20 -05:00
Matt Mackall
e8c6616c42 match: redefine always and never in terms of match and exact 2009-05-24 02:56:14 -05:00
Matt Mackall
dad8161beb match: fold _globprefix into _roots 2009-05-24 02:56:14 -05:00
Matt Mackall
870bafcadb match: optimize escaping in _globre
- localize re.escape
- fastpath escaping of non-special characters
2009-05-24 02:56:14 -05:00
Matt Mackall
fb6d5f4ec6 match: remove head and tail args from _globre 2009-05-24 02:56:14 -05:00
Matt Mackall
6cec04c6af match: fold _matcher into match.__init__ 2009-05-24 02:56:14 -05:00
Matt Mackall
0b844e4b36 match: rename _matchfn to _buildmatch 2009-05-24 02:56:14 -05:00
Matt Mackall
64e6241687 match: optimize _patsplit 2009-05-24 02:56:14 -05:00
Matt Mackall
8ba6e48c01 match: tweak some names 2009-05-24 02:56:14 -05:00
Matt Mackall
cb5cd35394 match: simplify _matcher
- get rid of special case
- simplify anypats logic
- fold inckinds and exckinds
2009-05-24 02:56:14 -05:00
Matt Mackall
d9e0a2ed6d match: split up _normalizepats 2009-05-24 02:56:14 -05:00
Matt Mackall
3d1ba9cdd7 match: optimize _globprefix 2009-05-24 02:56:14 -05:00
Matt Mackall
e01c72ad8b match: unnest functions in _matcher 2009-05-24 02:56:14 -05:00
Matt Mackall
556e496bdb match: kill unused defaults on _globre 2009-05-24 02:56:14 -05:00
Matt Mackall
85df20c19d match: kill test in matchfn 2009-05-24 02:56:14 -05:00
Matt Mackall
d65d73641a match: refactor matchfn generation 2009-05-24 02:56:14 -05:00
Matt Mackall
f1f37a33cf match: move util match functions over 2009-05-24 02:56:14 -05:00
Matt Mackall
2658db5c8c util: privatize globre 2009-05-24 02:56:14 -05:00
Matt Mackall
b287cf72fe match: refactor patkind
add patkind(pat) to match
change external users
change util.patkind to _patsplit
2009-05-24 02:56:14 -05:00
Matt Mackall
89c18ad8ce match: add some default args 2009-05-24 02:56:14 -05:00
Matt Mackall
532c58d931 match: change all users of util.matcher to match.match 2009-05-24 02:56:14 -05:00
Sune Foldager
13556c33e2 tests: add tests for new pre-push logic (issue736)
Co-contributor: Henrik Stuart <henrik.stuart@edlund.dk>
2009-05-23 17:04:41 +02:00
Sune Foldager
2161b139a6 named branches: improve pre-push logic (issue736)
Each named branch is considered separately, and the push is allowed if
no new branch heads are created for any named branch to be pushed.

Due to some tests's use of --debug, their output will change after this
addition. This has been fixed as well.

Co-contributor: Henrik Stuart <henrik.stuart@edlund.dk>
2009-05-23 17:04:31 +02:00
Henrik Stuart
a4975b3627 named branches: client branchmap wire protocol support (issue736)
Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-23 17:03:51 +02:00
Henrik Stuart
e3379206dc named branches: server branchmap wire protocol support (issue736)
The repository command, 'branchmap', returns a dictionary, branchname
-> [branchheads], and will be implemented for localrepo, httprepo and
sshrepo.

The following wire format is used for returning data:

branchname1 branch1head2 branch1head2 ...
branchname2 ...
...

Branch names are URL encoded to escape white space, and branch heads
are sent as hex encoded node ids. All branches and all their heads are
sent.

The background and motivation for this command is the desire for a
richer named branch semantics when pushing changesets. The details are
explained in the original proposal which is included below.


1. BACKGROUND

The algorithm currently implemented in Mercurial only considers the
graph theoretical heads when determining whether new heads are
created, rather than using the branch heads as a count (the algorithm
considers a branch head effectively closed when it is merged into
another branch or a new named branch is started from that point
onward).

Our particular problem with the algorithm is that we'd like to see the
following case working without forcing a push:

Upsteam has:

(0:dev) ---- (1:dev)
\
 `--- (2:stable)

Someone merges stable into dev:

(0:dev) ---- (1:dev) ------(3:dev)
\                         /
 `--- (2:stable) --------´

This can be pushed without --force (as it should).
Now someone else does some coding on stable (a bug fix, say):

(0:dev) ---- (1:dev) ------(3:dev)
\                          /
 `--- (2:stable) ---------´---------(4:stable)

This time we need --force to push.

We allow this to be pushed without using --force by getting all the
remote branch heads (by extending the wire protocol with a new
function).

We would, furthermore, also prefer if it is impossible to push a new
branch without --force (or a later --newbranch option so --force isn't
shoe-horned into too many disparate functions, if need be), except of
course in the case where the remote repository is empty.

This is what our patches accomplish.


2. ALTERNATIVES

We have, of course, considered some alternatives to reconstructing
enough information to decide whether we are creating new remote branch
heads, before we added the new wire protocol command.

2.1. LOOKUP ON REMOTE

The main alternative is to use the information from remote.heads() and
remote.lookup() to try to reconstruct enough graph information to
decide whether we are creating new heads. This is not adequate as
illustrated below.

Remember that each lookup is typically a request-response pair over
SSH or HTTP(S).

If we have a simple repository at the remote end like this:

(0:dev) ---- (1:dev) ---- (3:stable)
\
 `--- (2:dev)

then remote.heads() will yield [2, 3]. Assume we have nodes [0, 1, 2]
locally and want to create a new node, 4:dev, as a descendant from
(1:dev), which should be OK as 1:dev is a branch head.

If we do remote.lookup('dev') we will get [2]. Thus, we can get
information about whether a branch exists on the remote server or not,
but this does not solve our problem of figuring out whether we are
creating new heads or not.

Pushing 4:dev ought to be OK, since after the push, we still only have
two heads on branch a.

Using remote.lookup() and remote.heads() is thus not adequate to
consistently decide whether we are creating new remote heads (e.g. in
this situation the latter would never return 1:dev).

2.2. USING INCOMING TO RECONSTRUCT THE GRAPH

An alternative would be to use information equivalent to hg incoming
to get the full remote graph in addition to the local graph.

To do this, we would have to get a changegroup(subset) bundle
representing the remote end (which may be a substantial amount of
data), getting the branch heads from an instantiated bundlerepository,
deleting the bundle, and finally, we can compute the prepush logic.

While this is backwards compatible, it will cause a possibly
substantial slowdown of the push command as it first needs to pull in
all changes.


3. FURTHER ARGUMENTS IN FAVOUR OF THE BRANCHMAP WIRE-PROTOCOL EXTENSION

Currently, the commands incoming and pull, work based on the tip of a
given branch if used with "-r branchname", making it hard to get all
revisions of a certain branch only (if it has multiple heads). This
can be solved by requesting the remote's branchheads and letting the
revisions to be used with the command be these heads. This can be done
by extending the commands with a new option, e.g.:

hg pull -b branchname

which will be turned into the equivalent of:

hg pull -r branchhead1 -r branchhead2 -r branchhead3

We have a simple follow-up patch that can do this ready as well
(although not submitted yet as it is pending the acceptance of the
branch patch).


4. WRAP-UP

We generally find that the branchmap wire protocol extension can
provide better named branch support to Mercurial. Currently, some
things, like the initial push scenario in this mail, are fairly
counter-intuitive, and the more often you have to force push, the more
it is likely you will get a lot of spurious and unnecessary merge
nodes. Also, restricting incoming and pull to all changes on a branch
rather than changes on the tip-most head would be a sensible extension
to making named branches a first class citizen in Mercurial.
Currently, named branches sometimes feel like a late-coming unwanted
step-child.

We have run it in a production environment for a while, with fewer
multiple heads occurring in our repositories and fewer confused users
as a result.

Also, it fixes the long-standing issue 736.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-23 17:02:49 +02:00
Matt Mackall
620ef41579 Merge with -stable 2009-05-24 02:56:03 -05:00