Commit Graph

9656 Commits

Author SHA1 Message Date
Mads Kiilerich
d98fa22802 commandserver: report capabilities sorted 2012-12-12 02:38:14 +01:00
Mads Kiilerich
c4b6cff1d3 bisect: store state sorted 2012-12-12 02:38:14 +01:00
Mads Kiilerich
641f4b8a6c localrepo: store branchheads sorted 2013-01-15 02:59:12 +01:00
Mads Kiilerich
26b3c84619 localrepo: store requirements sorted 2012-12-12 02:38:14 +01:00
Mads Kiilerich
ff0cc1a7f9 copies: make the loss in _backwardcopies more stable
A couple of tests shows slightly more correct output. That is pure coincidence.
2013-01-15 02:59:12 +01:00
Mads Kiilerich
3cb021c3b0 serve: use chunked encoding in hgweb responses
'hg serve' used to close connections when sending a response with unknown
length ... such as a bundle or archive.

Now chunked encoding will be used for responses with unknown length, and the
connection do thus not have to be closed to indicate the end of the response.

Chunked encoding is only used if the length is unknown, if the connection
wouldn't be closed for other reasons, AND if it is a HTTP 1.1 request.

This will not benefit other users of hgweb ... but it can serve as an example
that it can be done.
2013-01-15 01:10:08 +01:00
Mads Kiilerich
df2c27e00a serve: remove connection close hack for Python 2.3
Introduced in 172ac22869f4 and no longer needed - BaseHTTPServer handles
connection closing just fine if we don't mess with its internals.
2013-01-15 01:10:08 +01:00
Mads Kiilerich
202753eeb5 hgweb: pass the actual response body to request.response, not just the length
This makes it less likely to send a response that doesn't match Content-Length.
2013-01-15 01:07:03 +01:00
Mads Kiilerich
e3bf5c6dbe hgweb: don't pass empty response chunks on
hgweb internals will often produce empty writes - especially when returning
compressed data.  hgweb is no middleware application and there is thus no
reason to pass them on to be processed in other layers.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
00d7d25679 hgweb: remove handling of any else than strings from request.write
Iterators should be returned WSGI style, not written. And apparently all of
hgweb do that.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
01096c5713 serve: send response headers even if response has no body
The headers would usually be sent anyway because the app did a number of writes
of empty strings.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
ab33fcb117 hgweb: simplify wsgirequest header handling
Remove leaky header abstraction and prepare for other encodings.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
5b3ff65d9e hgweb: make type a mandatory parameter to request.respond
There will thus always be headers and the runtime check can be removed.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
87b39b3461 hgweb: use Content-Length for pushres
This prevents some unnecessary http connection close.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
14dc808b35 hgweb: send Content-Length 0 for zero length response
Before, Content-Length wasn't sent for 0 length responses. Now it is.

This could in principle prevent some unnecessary http connection close.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
b66ec06f79 archival: tarit should never close the dest passed to it
Some archive types closed the open file passed to it, some didn't.

This could cause either missing or duplicate close and cause problems in hgweb.

The fix in 4f98880c1b4e should only have closed the compressors and archivers -
not the underlying file itself if no compressor is used.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
5af2faad25 log: make log work even if first parameter doesn't exist
A slowpath optimization kicked in too often because of wrong indentation.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
60e6a66d4b merge: remove "case" comments
The comments introduced in a1723fcd2b2d seems important ... but the context has
apparently been lost and they do not have any value now.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
37a2d73d5e merge: merge file flags together with file content
The 'x' flag and the 'l' flag are very different. It is usually not a problem
to change the 'x' flag of a normal file independent of the content, but one
does not simply change the type of a file to 'l' independent of the content.

This removes the fmerge function that merged both 'x' and 'l' independent of
content early in the merge process. This correctly introduces some conflicts
instead of silent incorrect merges. 3-way flag merge will now be done in the
resolve process, right next to file content merge. Conflicts can thus be
resolved with (slightly inconvenient) resolve commands like 'resolve f --tool
internal:other'. It thus brings us closer to be able to re-solve manifest merge
after the merge and avoid prompts during merge.

This also removes the "conflicting flags for a - (n)one, e(x)ec or sym(l)ink?"
prompt that nobody could answer and that made it easy to mix symlink targets
and file contents up. Instead it will give a file merge where a sufficiently
clever merge tool can help resolving the issue.
2013-01-09 02:02:45 +01:00
Mads Kiilerich
befdd21355 merge: remove old pre-audit code checking for absolute paths
Audit will handle this in a more elegant way.
2013-01-10 03:40:45 +01:00
Mads Kiilerich
233c071ef3 merge: drop reference to file contents immediately after write
Like 6c6ada8fd4c5 this reduces memory usage on large merges.
2013-01-10 00:45:51 +01:00
Mads Kiilerich
a09e5b862c merge: changing the mode of a file is also an update
It was a change in the file system that wasn't reported in the summaries.
2013-01-10 00:44:23 +01:00
Mads Kiilerich
b4877a560f merge: use util.unlinkpath for removing moved files
- more like how removed files are removed.
2013-01-15 01:05:12 +01:00
Mads Kiilerich
39b66595ef merge: .hgsubstate is special as merge destination, not as merge source 2013-01-15 01:05:12 +01:00
Mads Kiilerich
360ab16fc3 merge: remove redundant unlink after merge
The early prescan for move/remove and removal of moved files in applyupdates
was introduced with mergestate 5ff549be1f0c and rendered this chunk of code
irrelevant.

The impact of the chunk was reduced in 0309b0586c65 - but it could have been
removed completely.
2013-01-09 00:01:33 +01:00
Mads Kiilerich
106702cb3a merge: rename list of actions from action to actions 2013-01-09 00:01:33 +01:00
Mads Kiilerich
2c466c126f merge: consistently use "x" instead of 'x' for internal action types
This makes it simpler to search for places where the action types are handled.
2013-01-09 00:01:33 +01:00
Mads Kiilerich
0fea0bfee8 merge: consistently use repo.wopener.audit instead of creating a new auditor 2013-01-09 00:01:33 +01:00
Mads Kiilerich
0d0f5ceab6 scmutil: simplify vfs.audit - drop wrapped vfs.auditor 2013-01-09 00:01:33 +01:00
Mads Kiilerich
33393d7e47 util: copyfile: remove dest before copying
This prevents spurious problems writing to locked files on Windows.
2013-01-10 00:44:23 +01:00
Mads Kiilerich
4d69012587 merge: warn when internal:merge cannot merge symlinks
A follow-up to 6847621b4da6.

internal:merge should never be picked for merging symlinks ... but in the test
suite we have HGMERGE="internal:merge" which bypasses all the usual merge-tool
cleverness. Without any output it can be hard to figure out what happened and
where the problem is.
2013-01-15 01:05:11 +01:00
Pierre-Yves David
e4fab34c27 hgweb: document the revnavgen function 2013-01-13 21:36:35 +01:00
Pierre-Yves David
8f71cbe4e1 hgweb: no do not use listinsert(0, ...)
This is not efficient. We now append element and either reverse the list or
iterate in reverse order.
2012-12-19 19:06:50 +01:00
Idan Kamara
ddb5b141cc localrepo: drop unnecessary check on wlock unlock
Calling out to dirstate one line before guarantees that it'll be in the filecache.
2013-01-10 23:57:03 +02:00
Idan Kamara
dd240808d9 dirstate: refresh _branch cache entry after writing it 2012-12-16 20:33:00 +02:00
Idan Kamara
ad6fc4bb63 filecache: create an entry in _filecache when __set__ is called for a missing one
Preserve the invariant that if P is a filecached property on X then
P in X.__dict__ => P in X._filecache.

Previously, it was possible for a filecached property to become out of sync
with the filesystem if it was set before getting it first, since the initial
filecacheentry was created in __get__.

Old behaviour:

  repo.prop = x
  repo.invalidate() # prop has no entry in _filecache, it's not removed
                    # from __dict__
  repo.prop         # returns x like before without checking with the
                    # filesystem

New:

  repo.prop = x     # an empty entry is created in _filecache
  repo.invalidate() # prop is removed from __dict__
  repo.prop         # recreates prop
2012-12-17 15:25:45 +02:00
Idan Kamara
542705b00a filecache: allow filecacheentry to be created without stating in __init__
Will be used for properties that are set without getting them first.
2013-01-10 23:54:53 +02:00
Idan Kamara
dc1e34eda3 rollback: don't clear the filecache
This was an old workaround to force the filecache to reload everything. Now
that the syncing issue is fixed, we no longer need it.
2013-01-09 20:36:53 +02:00
Idan Kamara
ca54b38975 destroyed: keep the filecache in sync with __dict__ (issue3335) (issue3693) (issue3743)
We need to make sure that if X is in the filecache then it's also in the
filecache owner's __dict__, otherwise it will go out of sync:

repo.X                  # first access to X, records stat info in
                        # filecache and updates __dict__
repo._filecache.clear() # removes X from _filecache but it's still in __dict__
repo.invalidate()       # iterates over _filecache and removes entries
                        # from __dict__, but X isn't in _filecache, so
                        # it's kept in __dict__
repo.X                  # X is fetched from __dict__, bypassing the filecache
2013-01-09 20:37:44 +02:00
Idan Kamara
b367739fa0 localrepo: write the phasecache when destroying nodes 2013-01-11 00:05:52 +02:00
Idan Kamara
a5fb16be88 localrepo: update the branchmap when destroying nodes
This was previously called directly during strip. Moving it to destroying
also means that it'll be called through _rollback, which seems harmless.
2013-01-05 16:50:12 +02:00
Idan Kamara
bd84da5670 localrepo: introduce destroying function 2012-12-15 20:08:13 +02:00
Idan Kamara
7b192e750c localrepo: don't refresh filecache entries that aren't in __dict__
We call invalidate to remove properties from __dict__ because they're
possibly outdated and we'd like to check for a new version. Next time
the property is accessed the filecache mechanism checks the current stat
info with the one recorded at the last time the property was read, if
they're different it recreates the property.

Previously we refreshed the stat info on all properties in the filecache
when the lock is released, including properties that are missing from
__dict__. This is a problem because:

  l = repo.lock()
  repo.P          # stat info S for P is recorded in _filecache
  <changes are made to repo.P indirectly, e.g. underlying file is replaced>
                  # P's new stat info = S'
  l.release()     # filecache refreshes, records S' as P's stat info

At this point our filecache contains P with stat info S', but P's
version is from S, which is outdated.

The above happens during _rollback and strip. Currently we're wiping the
filecache and forcing everything to reload from scratch which works but
isn't the right solution.
2012-12-16 23:13:02 +02:00
Mads Kiilerich
d8671137d4 changelog: please check-code and remove tabs
Tabs were introduced in 972c32f23691.
2013-01-12 16:04:29 +01:00
Pierre-Yves David
77db5734c1 branchmap: Save changectx creation during update
The newly introduced `branchmap` function allows us to skip the
creation of changectx objects. This speeds up the construction of
the branchmap.

On the mozilla repository (117293 changesets, 15490 mutable)

Before:
  ! impactable 19.9
  ! mutable 0.576
  ! unserved 3.16

After:
  ! impactable 7.03 (2.8x faster)
  ! mutable 0.352 (1.6x)
  ! unserved 1.15 (2.7x)

On the cpython repository (81418 changesets, 6418 mutable)

Before:
  ! impactable 15.9
  ! mutable 0.451
  ! unserved 0.861

After:
  ! impactable 6.55 (2.4x faster)
  ! mutable 0.170 (2.6x faster)
  ! unserved 0.289 (2.9x faster)

On the pypy repository (58852 changesets)

Before:
  ! impactable 13.6

After:
  ! impactable 6.17 (2.2x faster)

On my Mercurial repository (18295 changesets, 2210 mutable)

Before:
  ! impactable 23.9
  ! mutable 0.368
  ! unserved 0.057

After:
  ! impactable 1.31 (18x faster)
  ! mutable 0.042 (8.7x)
  ! unserved 0.025 (2.2x)
2013-01-11 18:47:42 +01:00
Pierre-Yves David
a99d835522 changelog: add a branch method, bypassing changectx
The only way to access the branch of a changeset is currently to
create a changectx object and access its `branch()` method. Creating
a new Python object is costly and has a huge impact on code doing
heavy access to `branch()` (like branchmap).

This change introduces a new method on changelog that allows direct
access to the branch of a revision. See the next changeset for impact.
2013-01-10 00:41:40 +01:00
Pierre-Yves David
4bd2fce08b branchmap: pass revision insteads of changectx to the update function
Creation of changectx objects is very slow, and they are not very
useful. We are going to drop them. The first step is to change the
function argument type.
2013-01-08 01:28:39 +01:00
Pierre-Yves David
4e9586f18e clfilter: enforce hidden filtering on all repository accesses
We ensure all repositores created through `mercurial.hg.repository`
are "hidden" filtered. This is an even stronger enforcement than
86530c899687.

Citing Matt's response to changeset 86530c899687 installing filtering
in dispatch:

> Unfortunately, this means that code that doesn't go through dispatch (ie all
> those crazy misguided people using Mercurial as a library) are going to see
> these hidden changesets.
>
> Might be better to instead install the filter in localrepo construction by
> default and disable it in dispatch.
2013-01-11 20:34:54 +01:00
Mads Kiilerich
bd884d9410 archival: avoid touching deprecated gzip name attribute
The existing workaround didn't work when no filename was specified.

If running in a context with warnings enabled and subsecond mtime it gave a
warning:
  DeprecationWarning: use the name attribute
2013-01-03 21:07:04 +01:00
Mads Kiilerich
959c978f9d archival: pass integer to struct.pack int field instead of float
If running in a context with warnings enabled and subsecond mtime it gave a
warning:
  DeprecationWarning: integer argument expected, got float
2013-01-03 21:07:04 +01:00