Commit Graph

18185 Commits

Author SHA1 Message Date
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
684502f847 perf: add perfbranchmap command
The command times the update of a branchmap from its nearest subset
or from scratch.
2013-01-11 18:39:43 +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
Mads Kiilerich
dfd7d10cbf largefiles: fix update from a merge with removed files
A situation with this case could happen after interrupting an update. Update
would fail with:
  abort: No such file or directory: $TESTTMP/f/.hglf/sub2/large6

Update from a merge without using clean is not possible anyway, so this patch
takes a step in the right direction so it gets as far as reporting the right
error.
2013-01-11 16:30:29 +01:00
Mads Kiilerich
19813fa421 largefiles: fix revert removing a largefile from a merge
Before revert could fail with:
  abort: .hglf/large@33fdd332ec: not found in manifest!

The LookupError will now be caught and handled correctly.
2013-01-11 16:30:29 +01:00
Mads Kiilerich
5096819efc largefiles: remove unused proto.refuseclient code
Should have been removed with other pre-1.9 code in 416c0b8e6104.
2013-01-11 16:30:29 +01:00
Angel Ezquerra
e70892baf4 subrepo: make 'in subrepo' string easier to find by external tools
This patch is meant to make it easier for tools that wrap the mercurial
output (such as TortoiseHg) to find the "in subrepo MYSUBREPO" string that
(since 6c419dfc848c) is appended after subrepo error messages, particularly when
the mercurial output is translated to a non-English language.

The message remains the same but the '%s' that was used to prepend the original
error message in front of the 'in subrepo' string has been moved out of the
translatable string.

As an example of the usefulness of making it easy to look for "in subrepo
MYSUBREPO" strings, TortoiseHg looks for these strings in error messages in
order to "linkify them" (i.e. convert "MYSUBREPO" into alink to the
corresponding subrepo).

The original string made it hard for a tool such as TortoiseHg to look for the
translated string on mercurial's output because the translated string contained
the error message itself. This meant that a regular expression was required to
ignore the error message part. With this change TortoiseHg can just get the
translated "(in subrepo %s)" string, substitute %s for the subrepo path (which
it gets from the subrepo exception) and simply search for the resulting string
(no regular expression needed, or at least a much simpler regular expression
could be used).

Additionaly, the existing string could lead a translator mistakenly assume that
it was possible invert the order of the %s (error and subrepo path) fields,
which would not work because the string interpolation was position based.
2013-01-03 17:42:25 +01:00
Brendan Cully
31cab25274 subrepo: fix python2.4 compatibility after e9ad4d8804d3
super(SubrepoAbort, self).__init__(*args, **kw) raises
  TypeError: super() argument 1 must be type, not classobj
2013-01-10 10:35:37 -08:00
Christian Ebert
9b136a0b1f test-keyword: improve grammar and spelling in branchcache note
See: 95bf063e6776
2013-01-10 16:25:06 +00:00
Augie Fackler
2986e3abf8 Merge with stable. 2013-01-10 09:43:28 -05:00
Mads Kiilerich
79e0196dc6 largefiles: make update with backup files in .hglf slightly less broken
Largefiles update would try to copy f to f.orig if there was a .hglf/f.orig .
That is in many many ways very very wrong, but it also caused an abort if f
didn't exist.

Now it only tries to copy f if it exists.
2013-01-10 15:33:14 +01:00
Pierre-Yves David
bf6aa861ef repoview: extract hideable revision computation in a dedicated function
This will help extensions to plug into the hidden mechanism.
2013-01-10 10:25:02 +01:00
Matt Mackall
fe3bd5fa6c tests: fix up test-highlight for breadcrumb changes 2013-01-09 19:10:44 -06:00
Pierre-Yves David
ed7bbaa14c dispatch: handle empty testedwith value in extension
When extensions had an empty `testedwith` attribute the code tried to parse it
and failed. As a result the actual error were shallowed by a This crash.

We now treat empty strip as 'unknown'
2013-01-04 19:06:42 +01:00
Benoit Boissinot
487f5cb58d test-command-template.t: make "age" filter test work on Feb 29th
reported by Julien Cristau.
2013-01-02 13:59:07 +01:00
Matt Mackall
56ee5e8df3 Added signature for changeset 9d7e53f4560e 2013-01-02 00:07:43 -06:00
Matt Mackall
b65fcfe7e4 merge with i18n 2013-01-02 00:03:31 -06:00
Matt Mackall
4ba8b9bde7 merge i18n heads 2013-01-02 00:02:22 -06:00
Augie Fackler
f909cd2da7 test-command-template.t: fix test so it all year
This test started failing for me after midnight UTC on December
31st. Fixed it by specifying a date 7 years in the future more
precisely (rather than just adding 8 to the year and specifying
January 1st), which allows the test to pass both now and on 2012-12-01
at the same time.
2012-12-31 21:50:35 -06:00
Pierre-Yves David
b6d4017a84 amend: prevent loss of bookmark on failed amend
The active bookmark were moved to the temporary commit. When the transaction
were rollbacked, the bookmark were lost.

We now temporarly disable the bookmark to prevent this effect.
2012-12-30 03:49:15 +01:00
Pierre-Yves David
6a1ec255bb amend: invalidate dirstate in case of failure (issue3670)
The temporary commit created by amend update the dirstate. If the final commit
fails, we need to invalidate the change made to the dirstate, otherwise the
release of the wlock will write the dirstate created after the rollbacked
temporary commit.

This dirstate writing logic should probably be handled in the same object than
the transaction one. However such change are too big for stable.
2012-12-29 18:00:18 +01:00
Sean Farley
96729d25e1 color: add template label function 2012-12-28 19:25:10 -06:00
Alexander Sauta
39c2e8f8fe i18n-ru: synchonized with ce5a796b8950 2012-12-27 07:32:51 +00:00
Sean Farley
3247f202be templater: add no-op template function 'label' 2012-12-22 21:46:26 -06:00
Remy Blank
77663c5e65 posix: fix split() for the case where the path is at the root of the filesystem
posixpath.split() strips '/' from the dirname *unless it is the root*. This
patch reproduces this behavior in posix.split(). The old behavior causes a
crash when creating a file at the root of the repo with localrepo.wfile()
when the repo is at the root of the filesystem.
2013-01-09 20:27:17 +01:00
Idan Kamara
ba14804c98 record: remove unused import 2013-01-09 21:13:52 +02:00
Idan Kamara
547e15c84f cvsps: fix indentation 2013-01-09 21:11:00 +02:00
Bryan O'Sullivan
8b517d42bc hghave: introduce a test (unused) for cvs >= 1.12 2013-01-09 13:16:54 -08:00
Pierre-Yves David
1e2601accd discovery: drop the visibleheads function
It has no users left. (Using filtering explicitly is easier.)
2013-01-06 04:50:14 +01:00
Pierre-Yves David
3db2a036e8 clfilter: remove the last usage of visibleheads
We can just inline the filtering now that all server code uses
changelog filtering directly.
2013-01-06 04:48:22 +01:00
Pierre-Yves David
d494152aab discovery: drop the visiblebranchmap function 2013-01-05 18:57:09 +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
Pierre-Yves David
433ce5d8f8 clfilter: drop extra filtering in localpeer
The repository used by localpeer is already filtered. We no longer
need to call a special function.
2013-01-06 04:28:52 +01:00
Pierre-Yves David
158ce0ffec clfilter: make localpeer use a repo with "unserved" filter
This changeset installs a broad filter on most repos used for
serving. This removes the need to use the `visiblehead`/`visiblebranchmap`
functions, and ensures that changesets we should not serve are in
fact never served.

We do not use filtering on hgweb yet, as there is still a number
of issues to solve there.
2013-01-06 04:41:11 +01:00
Pierre-Yves David
bafe2b5542 performance: speedup computation of extinct revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository.

This change drops revset calls in favor of direct testing of the phase
of changesets.

Performance test on my Mercurial checkout
- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.

Before:
  ! extinct
  ! wall 0.015124

After:
  ! extinct
  ! wall 0.009424

Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.

Before:
  ! extinct
  ! wall 0.032844

After:
  ! extinct
  ! wall 0.000066
2013-01-04 03:16:08 +01:00
Pierre-Yves David
6124831a17 performance: speedup computation of suspended revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository.

This change drops a revset call in favor of direct testing of the
phase of changesets.

Performance test on my Mercurial checkout
- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.

Before:
  ! suspended
  ! wall 0.014319

After:
  ! suspended
  ! wall 0.009559

Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.

Before:
  ! suspended
  ! wall 0.033373

After:
  ! suspended
  ! wall 0.000053
2013-01-04 03:15:44 +01:00
Pierre-Yves David
2b70610cfb performance: speedup computation of unstable revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository.

This change drops revset call in favor of direct testing of the
phase of changesets.

Performance test on my Mercurial checkout
- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.

Before:
  ! unstable
  ! wall 0.017366

After this changes:
  ! unstable
  ! wall 0.008093

Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.

Before:
  ! unstable
  ! wall 0.045190

After:
  ! unstable
  ! wall 0.000032
2013-01-04 03:15:21 +01:00
Pierre-Yves David
1974a3ac5d performance: speedup computation of mutable revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository. The "mutable" filter is used
during branch cache loading operation. We need to make it fast.

This change drops revset calls in favor of direct testing of the
phase of a changeset.

Performance test on my Mercurial checkout
- 19857 total changesets,
- 1646 mutable revision

Before:
  ! mutable
  ! wall 0.032405

After:
  ! mutable
  ! wall 0.001469

Performance test on a Mozilla central checkout:
- 117293 total changesets,
- 1 mutable changeset,

Before:
  ! mutable
  ! wall 0.188636

After:
  ! mutable
  ! wall 0.000022
2013-01-07 15:50:25 +01:00
Pierre-Yves David
fcce734523 performance: speedup computation of unserved revisions
In their current state, revset calls can be very costly, as we test
predicates on the entire repository. The "unserved" filter is used
in multiple applications, and in particular in some branch cache
loading operations. We need to make it fast.

This change drops revset calls in favor of direct testing of the
phase of a changeset.

Performance test on my Mercurial checkout

- 19857 total changesets,
- 1584 obsolete changesets,
- 13310 obsolescence markers.

Before:
  ! unserved
  ! wall 0.030477

After:
  ! unserved
  ! wall 0.011844

Performance test on a Mozilla central checkout:

- 117293 total changesets,
- 1 obsolete changeset,
- 1 obsolescence marker.

Before:
  ! unserved
  ! wall 0.111259

After:
  ! unserved
  ! wall 0.000084
2013-01-04 20:19:05 +01:00