Commit Graph

9179 Commits

Author SHA1 Message Date
Bryan O'Sullivan
024c511c7b store: refactor hashed encoding into its own function 2012-09-18 14:37:32 -07:00
Adrian Buehlmann
fc4c657eab store: reuse direncoded path in _hybridencode
For a netbeans clone on Windows 7 x64:

  Before:
    $ hg perffncacheencode
    ! wall 3.516000 comb 3.525623 user 3.525623 sys 0.000000 (best of 3)

  After:
    $ hg perffncacheencode
    ! wall 3.443000 comb 3.447622 user 3.447622 sys 0.000000 (best of 3)
2012-09-18 19:51:59 +02:00
Adrian Buehlmann
6935b60c2a store: extract functions _encodefname and _decodefname 2012-09-18 19:51:48 +02:00
Adrian Buehlmann
6123a70068 store: use fast C implementation of encodedir() if it's available
For a netbeans clone on Windows 7 x64:

  Encoding all paths in the fncache:

    Before:
      $ hg perffncacheencode
      ! wall 3.639000 comb 3.634823 user 3.634823 sys 0.000000 (best of 3)
    After:
      $ hg perffncacheencode
      ! wall 3.470000 comb 3.463222 user 3.463222 sys 0.000000 (best of 3)

  Writing fncache:

    Before:
      $ hg perffncachewrite
      ! wall 0.103000 comb 0.093601 user 0.093601 sys 0.000000 (best of 95)
    After:
      $ hg perffncachewrite
      ! wall 0.081000 comb 0.078001 user 0.062400 sys 0.015600 (best of 100)
2012-09-18 11:44:16 +02:00
Adrian Buehlmann
fd6785ba1c pathencode: new C module with fast encodedir() function
Not yet used (will be enabled in a later patch).

This patch is a stripped down version of patches originally created by
Bryan O'Sullivan <bryano@fb.com>
2012-09-18 11:43:30 +02:00
Adrian Buehlmann
2dfd0c409a store: add multiline doctest case for encodedir()
a followup to 7090b12b599b
2012-09-18 07:58:50 +02:00
Adrian Buehlmann
7bf349fd77 store: optimize fncache._load a bit by dirdecoding the contents in one go
For a netbeans clone on Windows 7 x64:

  Before:
    $ hg perffncacheload
    ! wall 0.124000 comb 0.124801 user 0.124801 sys 0.000000 (best of 76)

  After:
    $ hg perffncacheload
    ! wall 0.096000 comb 0.093601 user 0.078001 sys 0.015600 (best of 97)
2012-09-17 11:00:38 +02:00
Thomas Arendsen Hein
41c1ca4d45 wireproto: workaround for yield inside try/finally incompatible with python2.4 2012-09-18 17:00:58 +02:00
Adrian Buehlmann
039dd48b84 store: optimize fncache._write by direncoding the contents in one go
For a netbeans clone on Windows 7 x64:

  Before:
    $ hg perffncachewrite
    ! wall 0.210000 comb 0.218401 user 0.202801 sys 0.015600 (best of 47)

  After:
    $ hg perffncachewrite
    ! wall 0.104000 comb 0.109201 user 0.078000 sys 0.031200 (best of 95)
2012-09-17 08:58:35 +02:00
Adrian Buehlmann
c239e1837f store: move encode lambda logic into fncachestore
and define two named functions at module scope.

This again also speeds up perffncacheencode a little bit.
2012-09-16 11:41:02 +02:00
Adrian Buehlmann
e773964ca6 store: eliminate one level of lambda functions on _hybridencode 2012-09-16 11:36:14 +02:00
Adrian Buehlmann
bbb1196b99 store: parameter path of _auxencode is now a list of strings 2012-09-16 11:36:06 +02:00
Adrian Buehlmann
55185b8e33 store: keep an accumulated length for the shorted dirs in _hybridencode
so we don't have to repeatedly do  '/'.join(sdirs)  inside the loop
2012-09-16 11:36:00 +02:00
Adrian Buehlmann
1184227af0 store: reorder basename assignment in _hybridencode 2012-09-16 11:35:55 +02:00
Adrian Buehlmann
40f2dc614d store: remove uneeded startswith('data/') checks in encodedir() and decodedir()
I don't think we will ever have anything in the store that resides inside a
directory that ends in .i or .d under store/ that we wouldn't want to have
direncoded. The files not under data/ surely don't need direncoding, but it
doesn't harm to let these few run through it. It hurts more to check whether the
thousands of other files start with 'data/'. They do anyway.

See also 67e6074ba430 (fixed with 0c522fe42894), which moved the direncoding
from filelog into store
2012-09-15 21:44:08 +02:00
Adrian Buehlmann
574c96ecb1 store: remove uneeded startswith('data/') check in _hybridencode() 2012-09-15 21:43:56 +02:00
Adrian Buehlmann
5b06fb5a39 store: refactor splitting off of "data/" in _hybridencode()
encodefilename() already calls encodedir(). Note that encodedir() skips the
encoding if the path doesn't start with "data/".
2012-09-15 21:43:14 +02:00
Patrick Mezard
cad875fb81 Merge with stable 2012-09-17 21:53:50 +02:00
Tim Delaney
0872da322b hgweb: fix incorrect graph padding calculation (issue3626)
hgweb has an incorrect padding calculation, causing the text to move further
away from the graph the more branches there are (issue3626). This patch fixes
all existing templates (gitweb, monoblue, paper and spartan).

Tests updated by Patrick Mezard <patrick@mezard.eu>
2012-09-17 21:33:16 +02:00
Adrian Buehlmann
007324cd1e store: let _auxencode() return the list of path segments
so we can spare us splitting the path again in _hybridencode()
2012-09-15 21:43:05 +02:00
Adrian Buehlmann
95efee1bf9 store: eliminate unneded last assignment to n in _auxencode()
The check for period or space at the end of the string is the last one, the
local variable n is thus not used anymore.
2012-09-15 21:42:58 +02:00
Adrian Buehlmann
d900f301da store: unindent most of the contents of the for loop in _auxencode()
by refactoring

    for i, n in enumerate(res):
        if n:
            <main code block>

to

    for i, n in enumerate(res):
        if not n:
            continue
        <main code block>

(no functional change)
2012-09-15 21:42:52 +02:00
Adrian Buehlmann
77d1f7ae29 store: optimize _auxencode() by assigning to the list elements of the path 2012-09-15 21:42:43 +02:00
Adrian Buehlmann
c774df44ee store: optimze _auxencode() a bit by grouping the reserved names by length
This reduces perffncacheencode wall time on Windows 7 x64 for my netbeans clone
here from 4.3 to 4.0 (7% faster).
2012-09-15 21:41:09 +02:00
Adrian Buehlmann
8149bc6545 store: explain "aux.foo" versus "foo.aux" in doc of _auxencode() 2012-09-15 21:41:53 +02:00
Adrian Buehlmann
93e8048296 store: add 'com0' and 'lpt0' doctest cases for _auxencode()
These are already covered by test-hybridencode.py, but they are so noteworthy
that I think they deserve being shown right in that doctest.
2012-09-15 21:41:45 +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
9c2cc273fb sshserver: avoid a multi-dot attribute lookup in a hot loop
This improves stream_out performance by about 3%.
2012-09-14 12:09:44 -07:00
Bryan O'Sullivan
b5119e949d store: reduce string concatenation when joining
This improves stream_out performance by a couple of percent.
2012-09-14 12:09:05 -07:00
Bryan O'Sullivan
1dc1178198 scmutil: use the new faster path split
Combined with a few other patches in this series, this contributes
to improving stream_out performance by 10%.
2012-09-14 12:08:55 -07:00
Bryan O'Sullivan
e3555667b8 util: implement a faster os.path.split for posix systems
This is not yet used.
2012-09-14 12:08:17 -07:00
Bryan O'Sullivan
7df4ae95dc scmutil: make join cheaper
Combined with a few followup patches, this contributes to improving
stream_out performance by 10%.
2012-09-14 12:07:33 -07: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
Bryan O'Sullivan
ecc7d720f1 scmutil: delegate mustaudit property to the real opener
This will be used by an upcoming patch.
2012-09-14 12:04:46 -07:00
Bryan O'Sullivan
51dda0ee74 scmutil: turn opener._audit into a property, mustaudit
This will be used by an upcoming patch.
2012-09-14 12:04:35 -07:00
Pierre-Yves David
ef39934b8c amend: preserve phase of amended revision (issue3602)
New commit from the amend process were created without any phase contraint. If
the amended changeset had a different phase from it's parent, the phases data
were lost.

The changeset ensure the new commit are created in the same phase than the
original changeset.
2012-08-30 16:47:08 +02:00
Takumi IINO
ba400386b5 help: fix literal block syntax 2012-09-07 00:42:42 +09:00
Bryan O'Sullivan
e9f644bcea Merge 2012-09-04 15:50:15 -07:00
Bryan O'Sullivan
bccd757a71 subrepo: encode unicode path names (issue3610)
Subversion 1.7 changes its XML output to include an explicit encoding tag:

  <?xml version="1.0" encoding="UTF-8"?>

This triggers xml.dom.minidom to always return unicode strings, causing
other parts of the code to explode.

We unconditionally encode path names before handing them back, which
works with both str (actually a no-op) and unicode values.
2012-09-04 15:46:04 -07:00
Bryan O'Sullivan
b30060d2aa Merge with stable 2012-09-04 13:49:39 -07:00
Mads Kiilerich
88105479b7 hgweb: avoid bad $$ processing in graph (issue3601)
JavaScript .replace always magically processed $$ $& $' $` in replacement
strings and thus displayed subject lines incorrectly in the graph view.

Instead of regexps and .replace we now just create the strings the right way in
the first place.
2012-08-29 02:09:43 +02:00
Steve Borho
029f4079a2 obsolete: import modules within mercurial/ without "from mercurial" 2012-08-28 11:15:34 -05:00
Pierre-Yves David
6431172ad3 bookmark: take successors into account when updating (issue3561)
When we rewrite a bookmarked changeset, we want to update the
bookmark on its successors. But the successors are not descendants
of its precursor (by definition). This changeset alters the bookmarks
logic to update bookmark location if the newer location is a successor
of the old one[1].

note: valid destinations are in fact any kind of successors of any kind
      of descendants (recursively.)

This changeset requires the enabling of the obsolete feature in
some bookmark tests.
2012-08-26 01:28:22 +02:00
Pierre-Yves David
342b88a402 bookmarks: extract valid destination logic in a dedicated function
We usually update bookmarks only if the new location is descendant of the old
bookmarks location.  We extract this logic into a function. This is the first
step to allow more complex logic using obsolescence in this validation of the
bookmark movement.
2012-08-26 00:28:56 +02:00
Pierre-Yves David
ad749501f8 checkheads: don't warn about unsynced changes that we ill obsolete
We won't be able to pull them after this push.
2012-08-26 00:27:44 +02:00
Pierre-Yves David
653c171718 checkheads: check successors for new heads in both missing and common
A relevant obsolete marker may have been added -after- we previously
exchanged the changeset. We have to search for remote heads that
disappear by the sole fact of pushing obsolescence.

This case will also happen when remote got the new version from a
repository that does not propagate obsolescence markers.
2012-08-26 00:25:33 +02:00
Pierre-Yves David
14699d4d9c checkheads: attend to phases when computing new heads with obsolete
Checkheads was more permissive than expected. When the remote heads
are public we don't need to search for successors. None will make a
public head disappear.
2012-08-24 16:52:45 +02:00
Bryan O'Sullivan
14c8cfede7 store: only one kind of OSError means "nonexistent entry" 2012-08-15 16:31:25 -07:00