Commit Graph

596 Commits

Author SHA1 Message Date
Matt Mackall
275d2d9cb0 revlog: incrementally build node cache with linear searches
This avoids needing to prime the cache for operations like verify
which visit most or all of the index.
2011-01-18 15:55:46 -06:00
Benoit Boissinot
8acffa3308 revlog: explicit test and explicit variable names 2011-01-16 12:25:46 +01:00
Benoit Boissinot
3ada8fe22e revlog: if the nodemap is set, use the fast version of revlog.rev() 2011-01-16 12:24:48 +01:00
Benoit Boissinot
383d62511b revlog/parseindex: construct the nodemap if it is empty 2011-01-15 15:06:53 +01:00
Benoit Boissinot
4072e97b7c revlog: always add the magic nullid/nullrev entry in parseindex 2011-01-15 13:02:19 +01:00
Benoit Boissinot
b75c111431 revlog/parseindex: no need to pass the file around 2011-01-15 15:04:58 +01:00
Matt Mackall
1e3dbac7f5 revlog: do revlog node->rev mapping by scanning
Now that the nodemap is lazily created, we use linear scanning back
from tip for typical node to rev mapping. Given that nodemap creation
is O(n log n) and revisions searched for are usually very close to
tip, this is often a significant performance win for a small number of
searches.

When we do end up building a nodemap for bulk lookups, the scanning
function is replaced with a hash lookup.
2011-01-11 21:52:03 -06:00
Matt Mackall
a1c37f5749 revlog: introduce a cache for partial lookups
Partial lookups are always O(n), and often we look up the same
one multiple times.
2011-01-11 17:12:32 -06:00
Matt Mackall
846d35e24f revlog: only build the nodemap on demand 2011-01-11 17:01:04 -06:00
Matt Mackall
efaaee2894 revlog: remove lazy index 2011-01-04 14:12:52 -06:00
Matt Mackall
a399da7502 revlog: break hash checking into subfunction 2011-01-06 17:04:41 -06:00
Martin Geisler
6a3d9310ab code style: prefer 'is' and 'is not' tests with singletons 2010-11-22 18:15:58 +01:00
Nicolas Dumazet
f48c256c16 revlog: fix descendants() if nullrev is in revs
We were not returning the correct result if nullrev was in revs, as we
are checking parent(currentrev) != nullrev before yielding currentrev

test-convert-hg-startrev was wrong: if we start converting from rev -1 and
onwards, all the descendants of -1 (full repo) should be converted.
2010-11-07 18:23:48 +09:00
Nicolas Dumazet
31a27ed9b9 revlog: if start is nullrev, end is always a descendant 2010-11-07 18:16:07 +09:00
Matt Mackall
90141f6021 revlog: choose best delta for parentdelta (issue2466)
When parentdelta is enabled, we choose the delta that has the minimum
distance to its base. Otherwise, base may be sufficiently far away to
require a full version, resulting in greatly reduced compression.
2010-10-30 02:47:34 -05:00
Matt Mackall
d0eecfc8e5 revlog: precalculate p1 and p2 revisions 2010-10-30 02:47:34 -05:00
Matt Mackall
9e1ed89cc3 revlog: extract delta building to a subfunction 2010-10-30 02:47:34 -05:00
Matt Mackall
4d0c140fd2 revlog: simplify cachedelta handling 2010-10-30 02:47:34 -05:00
Matt Mackall
a758f18a0a revlog: fix buildtext local scope
buildtext stores its result in _addrevision scope to avoid repeated builds
cachedelta is already visible
2010-10-30 02:47:34 -05:00
Benoit Boissinot
e33ea43988 revlog.addgroup(): always use _addrevision() to add new revlog entries
This makes parentdelta clone support pulling.
2010-10-08 18:00:19 -05:00
Benoit Boissinot
617749c5ab revlog._addrevision(): allow text argument to be None, build it lazily 2010-10-08 18:00:16 -05:00
Matt Mackall
aa7fff48c0 bundle: move chunk parsing into unbundle class 2010-09-19 13:12:45 -05:00
Matt Mackall
4b4d939b00 bundle: get rid of chunkiter 2010-09-19 12:51:54 -05:00
Benoit Boissinot
0a73b8e369 mdiff.patch(): add a special case for when the base text is empty
remove the special casing from revlog.addgroup()
2010-08-23 13:28:04 +02:00
Benoit Boissinot
cdd70dbbdc revlog: add rawsize(), identical to size() but not subclassed by filelog 2010-08-23 13:24:19 +02:00
Benoit Boissinot
6b8f2ae045 revlog.addrevision(): move computation of nodeid in addrevision()
The check "if node in nodemap" is already done earlier in addgroup().
2010-08-22 23:17:17 +02:00
Benoit Boissinot
25c2d76480 revlog: fix docstring 2010-08-21 19:31:59 +02:00
Benoit Boissinot
70194e7582 deltaparent(): don't return nullrev for a revision containing a full snapshot
this allows us to simplify manifest.readdelta and revlog.revdiff
2010-08-21 19:30:42 +02:00
Vishakh H
f9137b572d revlog: addgroup re-adds punched revisions for missing parents
While reading changegroup if a node with missing parents is encountered,
we add a punched entry in the index with null parents for the missing
parent node.
2010-08-13 19:42:28 +05:30
Vishakh H
6a818df747 revlog: generate full revisions when parent node is missing
The full revision is sent if the first parent, against which diff is calculated, is
missing at remote. This happens in the case of shallow clones.
2010-08-13 19:41:51 +05:30
Benoit Boissinot
219b0cf9cf revlog.revision(): inline deltachain computation 2010-08-20 00:17:50 +02:00
Benoit Boissinot
8b484e5088 revlog.revision(): remove debug code 2010-08-20 00:17:50 +02:00
Benoit Boissinot
4b8002ed12 revlog.revision(): don't use nullrev as the default value for the cache
I is probably a bug if the deltachain computation think there was a cache hit
at nullrev. Use None instead, this will never trigger a cache hit.
2010-08-20 00:17:50 +02:00
Benoit Boissinot
841f801067 revlog.revision(): minor cleanup
Rename some variables, making the name more obvious (in particular "cache" was
actually two different variable.
Move code around, moving the index preloading before the deltachain computation,
without that index preloading was useless (everything was read in deltachain).
2010-08-20 00:17:50 +02:00
Benoit Boissinot
35b0c5591f parendelta: fix computation of base rev (fixes issue2337)
Refactor revlog._addrevision() and put the correct base rev in the
parent-delta case: base(rev) should always be equal to the first full snapshot
that is needed by the delta chain, in both parent-delta and tip-delta case.

Before this fix, the base rev was in most case wrong (and in the case where
p1 == nullid, this triggered the bug from issue2337). This means that
repositories converted to parent-delta earlier are corrupted and needs to be
reconverted.
2010-08-18 19:37:23 +02:00
Benoit Boissinot
cbd0c9fbc1 revlog._addrevision(): make the parent of the cached delta explicit 2010-08-18 19:45:52 +02:00
Matt Mackall
d6488d66cb revlog: optimize deltachain 2010-08-15 23:13:56 -05:00
Pradeepkumar Gayam
2257cdb06d revlog: append delta against p1 2010-08-10 22:27:41 +05:30
Pradeepkumar Gayam
dada7ee47c revlog: teach revlog to construct a revision from parentdeltas 2010-08-10 22:27:16 +05:30
Pradeepkumar Gayam
eeeffb2335 revlog: deltachain() returns chain of revs need to construct a revision 2010-08-10 22:26:08 +05:30
Pradeepkumar Gayam
65e80a1e8d revlog: parentdelta flags for revlog index 2010-08-10 22:25:08 +05:30
Matt Mackall
c0eb9c1315 Merge with stable 2010-08-06 12:59:13 -05:00
Matt Mackall
6426194b87 revlog: drop cache after use to save memory footprint
If we reconstruct back to back large versions, we need to drop the cache first to avoid doubling memory usage.
2010-08-05 16:17:17 -05:00
Vishakh H
04014eeaa3 revlog: add shallow header flag
REVLOGSHALLOW header flag to mark revlog as shallow.
The _shallow attribute of the revlog is used to check if the header flag is set.
2010-08-03 19:38:19 +05:30
Vishakh H
22c7674a18 revlog: add punched revision flag
index flag to identify a revision as punched, i.e. it contains no data.
REVIDX_PUNCHED_FLAG = 2, is used to mark a revision as punched.
REVIDX_KNOWN_FLAGS is the accumulation of all index flags.
2010-08-03 19:38:19 +05:30
Pradeepkumar Gayam
fde50bd3d6 revlog: add a flags method that returns revision flags 2010-07-27 01:16:38 +05:30
Benoit Boissinot
ccef97c636 chunkbuffer: split big strings directly in chunkbuffer 2010-07-25 13:10:57 +02:00
Nicolas Dumazet
658e3fee6a merge with stable 2010-07-13 22:56:01 +09:00
Nicolas Dumazet
6e75efdbcb cmp: document the fact that we return True if content is different
This is similar to the __builtin__.cmp behaviour, but still not
straightforward, as the dailylife meaning of a comparison usually is
"find out if they are different".
2010-07-09 11:02:39 +09:00
Renato Cunha
e0e017d51d revlog: Marked classic int divisions as such. 2010-07-01 19:27:02 -03:00
Martin Geisler
74ffb9edd7 revlog: fix inconsistent comment formatting 2010-06-10 17:10:05 +02:00
Matt Mackall
94c9deabbe static-http: disable lazy parsing
This only hits if you're crazy enough to use static-http on a
repository with revlogs larger than 1M. Don't do it.
2010-05-11 16:28:09 -05:00
Benoit Boissinot
99744e205a merge with stable 2010-04-15 15:35:06 +02:00
Benoit Boissinot
042c3ae681 add documentation for revlog._prereadsize 2010-04-15 15:21:21 +02:00
Benoit Boissinot
9037401fec merge with stable 2010-04-15 13:52:41 +02:00
Greg Ward
81511c58c5 revlog: fix lazyparser.__iter__() to return all revisions (issue2137)
Previously, it only returned revisions that were in the revlog when it
was originally opened; revisions added since then were invisible.
This broke revlog._partialmatch() and therefore repo.lookup().

(Credit to Benoit Boissinot for simplifying my original test script
and for the actual fix.)
2010-04-14 15:06:40 -04:00
Greg Ward
fac8084184 revlog: factor out _maxinline global.
This lets us change the threshold at which a *.d file will be split
out, which should make it much easier to construct test cases that
probe revlogs with a separate data file.
(issue2137)
2010-04-13 17:58:38 -04:00
Greg Ward
01987f5d3e revlog: factor out _maxinline global.
This lets us change the threshold at which a *.d file will be split
out, which should make it much easier to construct test cases that
probe revlogs with a separate data file.
(issue2137)
2010-04-13 17:58:38 -04:00
Benoit Boissinot
b8ee2dc847 revlog: put graph related functions together 2010-04-13 22:06:17 +02:00
Benoit Boissinot
9e42f82266 revlog.size: remove alternate implementation (revlogv0 specific)
it's only useful for revlogv0 anyway, revlogNG has the uncompressed size in
the index.
2010-02-09 14:02:07 +01:00
Benoit Boissinot
a2e24d1e23 revlog: don't silently discard revlog flags on revlogv0 2010-02-08 17:28:19 +01:00
Dirkjan Ochtman
71e802a601 revlog: fix up previously stupid API change 2010-02-06 12:47:17 +01:00
Dirkjan Ochtman
10416e7207 revlog: add a fast path for checking ancestry 2010-02-06 11:27:22 +01:00
Vsevolod Solovyov
d3e723589a add options dict to localrepo.store.opener and use it for defversion 2010-02-05 19:10:26 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Greg Ward
d9c710d107 revlog: rewrite several method docstrings
- methods: findmissing(), nodesbetween(), descendants(), ancestors()
- the goal is precise, concise, accurate, grammatical, understandable,
  consistently formatted docstrings
2009-12-10 09:35:43 -05:00
Benoit Boissinot
80a458a464 pychecker: remove unused local variables 2009-10-31 17:04:46 +01:00
Greg Ward
d0559b076a Improve some docstrings relating to changegroups and prepush(). 2009-09-08 17:58:59 -04:00
Benoit Boissinot
a98dab4110 manifest/revlog: do not let the revlog cache mutable objects
If a buffer of an mutable object is passed to revlog.addrevision(), the revlog
will happily store it in its cache. Later when the revlog reuses the cached
entry, if the manifest modified the object in-between, all kind of bugs
appears.

We fix it by:
- passing immutable objects to addrevision() if they are already available
- only storing the text in the cache if it's of str type

Then we can remove the conversion of the cache entry to str() during
retrieval. That was probably just there hiding the bug for the common cases
but not really fixing it.
2009-09-04 10:47:55 +02:00
Alejandro Santos
3183e52503 compat: use // for integer division 2009-07-05 11:00:44 +02:00
Martin Geisler
7fc350327e revlog: make triple-quoted string a real comment 2009-05-31 00:58:20 +02:00
Matt Mackall
28a532efb7 revlog: refactor chunk cache interface again
- chunk to _chunk
- _prime to _chunkraw
- _chunkclear for cache clearing
- _chunk calls _chunkraw
- clean up _prime a bit
- simplify users in revision and checkinlinesize
- drop file descriptor passing (we're better off opening fds lazily
2009-05-27 16:01:34 -05:00
Matt Mackall
4dc9e4309d revlog: report indexfile rather than datafile for integrity check 2009-05-27 14:44:54 -05:00
Matt Mackall
df215f1dab revlog: move stat inside lazyparser 2009-05-27 14:44:51 -05:00
Benoit Boissinot
1d46ec6dc3 changegroup: the node list might be an empty generator (fix issue1678) 2009-05-27 02:46:59 +02:00
Martin Geisler
4176f5b789 replace xrange(0, n) with xrange(n) 2009-05-25 23:06:11 +02:00
Benoit Boissinot
d861db9be5 revlog: fix undefined variable introduced in 042cecef3ad7 2009-05-25 13:52:09 +02:00
Matt Mackall
2c2304d400 revlog: fix reading of larger revlog indices on Windows 2009-05-23 11:53:23 -05:00
Martin Geisler
5d72c242d8 Merge with stable 2009-12-12 23:03:05 +01:00
Benoit Boissinot
795d30a996 revlog: add fast path to ancestor 2009-12-03 01:01:49 +01:00
Martin Geisler
0a365d5ca2 use 'x is None' instead of 'x == None'
The built-in None object is a singleton and it is therefore safe to
compare memory addresses with is. It is also faster, how much depends
on the object being compared. For a simple type like str I get:

            | s = "foo" | s = None
  ----------+-----------+----------
  s == None | 0.25 usec | 0.21 usec
  s is None | 0.17 usec | 0.17 usec
2009-05-20 00:52:46 +02:00
Benoit Boissinot
c97e6590bb revlog: use set instead of dict 2009-05-17 03:49:59 +02:00
Benoit Boissinot
c8bc34d692 revlog.missing(): use sets instead of a dict 2009-05-17 02:44:12 +02:00
Peter Arrenbrecht
5851b0b382 revlog: slightly tune group() by not going rev->node->rev 2009-05-14 16:00:21 +02:00
Matt Mackall
c70b6084a7 revlog: add cache priming for reconstructing delta chains 2009-05-07 19:39:45 -05:00
Matt Mackall
7aa559f96a revlog: use chunk cache to avoid rereading when splitting inline files 2009-05-07 19:39:45 -05:00
Matt Mackall
d48241b5f7 revlog: clean up the chunk caching code 2009-05-07 19:39:45 -05:00
Matt Mackall
9f78d7798f revlog: use index to find index size 2009-05-07 19:39:45 -05:00
Matt Mackall
00548e0791 revlog: preread revlog .i file
Smaller revlogs can be read with a single read, do it on open.
2009-05-07 19:39:45 -05:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Martin Geisler
2c8901a1b9 turn some comments back into module docstrings 2009-04-26 01:24:49 +02:00
Martin Geisler
8e4bc1e9ad put license and copyright info into comment blocks 2009-04-26 01:13:08 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Martin Geisler
7a5147b673 rebase, revlog: use set(x) instead of set(x.keys())
The latter is both unnecessary and slower.
2009-04-25 22:25:49 +02:00
Martin Geisler
747c05d2eb revlog: let nodestotag be a set instead of a list 2009-04-22 20:51:20 +02:00
Martin Geisler
e2222d3c43 replace set-like dictionaries with real sets
Many of the dictionaries created by dict.fromkeys were emulating sets.
These can now be replaced with real sets.
2009-04-22 00:57:28 +02:00
Martin Geisler
1deb417a82 util: use built-in set and frozenset
This drops Python 2.3 compatibility.
2009-04-22 00:55:32 +02:00
Henrik Stuart
c1e6537e5f strip: make repair.strip transactional to avoid repository corruption
Uses a transaction instance from the local repository to journal the
truncation of revlog files, such that if a strip only partially completes,
hg recover will be able to finish the truncate of all the files.

The potential unbundling of changes that have been backed up to be restored
later will, in case of an error, have to be unbundled manually. The
difference is that it will be possible to recover the repository state so
the unbundle can actually succeed.
2009-04-16 15:34:03 +02:00
Benoit Boissinot
309c0e0a31 merge with -stable 2009-04-06 20:11:00 +02:00
Benoit Boissinot
e5ea532970 raise RevlogError when parser can't parse the revlog index
Initial patch and test thanks to Nicolas Dumazet.
2009-04-06 19:48:11 +02:00
Nicolas Dumazet
3ced073c3b revlog: faster hash computation when one of the parent node is null
Because we often compute sha1(nullid), it's interesting to copy a precomputed
hash of nullid instead of computing everytime the same hash. Similarly, when
one of the parents is null, we can avoid a < comparison (sort).

Overall, this change adds a string equality comparison on each hash() call,
but when p2 is null, we drop one string < comparison, and copy a hash instead
of computing it. Since it is common to have revisions with only one parent,
this change makes hash() 25% faster when cloning a big repository.
2009-03-23 15:32:29 +01:00
Peter Arrenbrecht
a2d3e23eef cleanup: drop variables for unused return values
They are unnecessary. I did leave them in localrepo.py where there is
something like:

  _junk = foo()
  _junk = None

to free memory early. I don't know if just `foo()` will free the return
value as early.
2009-03-23 13:13:02 +01:00
Peter Arrenbrecht
bc21361ed2 cleanup: drop unused imports 2009-03-23 13:12:07 +01:00
Matt Mackall
d15d559b7c errors: move revlog errors
- create error.py for exception classes to reduce demandloading
- move revlog exceptions to it
- change users to import error and drop revlog import if possible
2009-01-11 22:48:28 -06:00
Matt Mackall
4bb1cd5f2b lookup: speed up partial lookup 2008-11-12 19:11:34 -06:00
Matt Mackall
4205fad04a revlog: speed up parents() 2008-11-12 15:58:46 -06:00
Matt Mackall
0770924171 revlog: remove delta function 2008-11-12 15:32:16 -06:00
Matt Mackall
b2807810c6 linkrev: take a revision number rather than a hash 2008-11-12 15:19:14 -06:00
Benoit Boissinot
4f2e35bc33 fix pull racing with push/commit (issue1320)
changegroup() has a problem when nodes which does not descend from a node
in <bases> are added to remote after the discovery phase.
If that happens, changegroup() won't send the correct set of nodes, ie.
some nodes will be missing.
To correct it we have to find the set of nodes that both remote and self
have (called <common>), and send all the nodes not in <common>.

This fix has some overhead, in the worst case it will re-send a whole branch.

A proper fix to avoid this overhead might be to change the protocol so that
the <common> nodes are sent (instead of the <bases> of the missing nodes).
2008-10-21 17:00:35 +02:00
Bernhard Leiner
b7e7ab32c3 use the new parseindex implementation C in parsers 2008-10-17 00:24:22 +02:00
Matt Mackall
a1af556eb5 revlog: fix heads performance regression 2008-10-12 15:21:08 -05:00
Sune Foldager
9b5eac039b provide nicer feedback when an unknown node id is passed to a command
Previously, an unknown node id would lead to the following error:
abort: 00changelog.i@343445453433: no node!

All other unknown revision would instead display as:
abort: unknown revision '343445453'!

The former error message has been suppressed in favor of the latter.
2008-10-04 10:14:39 +02:00
Martin Geisler
559197e59b Fixed docstring typos 2008-08-12 13:45:48 +02:00
Adrian Buehlmann
c330a45cd1 revlog: add files method 2008-08-13 20:18:41 -05:00
Stefano Tortarolo
5388b1792f Add ancestors and descendants to revlog
This patch adds two methods to revlog:
- ancestors: given a list of revisions returns their ancestors
- descendants: given a list of revisions return their descendants
2008-07-19 18:19:50 +02:00
Matt Mackall
bc715be859 add __len__ and __iter__ methods to repo and revlog 2008-06-26 14:35:50 -05:00
Alexander Solovyov
6a1b628db8 LookupError should have same __str__ as RevlogError 2008-06-18 16:47:47 +03:00
Alexander Solovyov
1088d84e91 make revlog.LookupError inherit from KeyError
This will improve integration with external applications which depend on
KeyError, which is usually raised by __getitem__ calls.
2008-06-18 12:48:04 +02:00
Peter Arrenbrecht
892bff8c6e drop superfluous param from revlog.addgroup() 2008-06-05 16:25:11 +02:00
Dirkjan Ochtman
34d6bea8db python 2.6 compatibility: compatibility wrappers for hash functions 2008-04-04 22:36:40 +02:00
Alexis S. L. Carvalho
e8bdcfb352 revlog.py: remove extra close()
atomictempfile.rename() already calls close().
2008-03-14 20:01:50 -03:00
Benoit Boissinot
8aa28e9a96 revlog: make sure the files are closed after an exception happens
This prevents a corruption when the writes happen after the truncate
initiated by the transaction rollback.
2008-03-14 22:12:50 +01:00
Matt Mackall
865487e7f2 revlog: report node and file when lookup fails 2008-03-11 17:42:29 -05:00
Joel Rosdahl
4f8012378a Remove unused imports 2008-03-06 22:23:41 +01:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Alexis S. L. Carvalho
bda2fe75b5 revlog.revision: avoid opening the datafile without need.
If there's no inline data, revlog.revision opens the data file every
time it's called.  This is useful if we're going to call chunk many
times, but, if we're going to call it only once, it's better to let
chunk open the file - if we're lucky, all the data we're going to need
is already cached and we won't need to even look at the file.
2008-02-19 19:20:10 -03:00
Alexis S. L. Carvalho
ba985d288a simplify revlog.strip interface and callers; add docstring
Also, strip files only after the changelog and the manifest.
2008-01-19 18:01:16 -02:00
Alexis S. L. Carvalho
8b35462ec9 strip: calculate list of extra nodes to save and pass it to changegroupsubset
When we remove revision N from the repository, all revisions >= N are
affected: either it's a descendant from N and will also be removed, or
it's not a descendant of N and will be renumbered.

As a consequence, we have to (at least temporarily) remove all filelog
and manifest revisions that have a linkrev >= N, readding some of them
later.

Unfortunately, it's possible to have a revlog with two revisions
r1 and r2 such that r1 < r2, but linkrev(r1) > linkrev(r2).  If we try
to strip revision linkrev(r1) from the repository, we'll also lose
revision r2 when we truncate this revlog.

We already use changegroupsubset to create a temporary changegroup
containing the revisions that have to be restored, but that function is
unable to detect that we also wanted to save the r2 in the case above.

So we manually calculate these extra nodes and pass it to changegroupsubset.

This should fix issue764.
2008-01-19 18:01:16 -02:00
Matt Mackall
ebf85d18e1 util: get rid of is_win_9x wart 2007-12-18 14:01:42 -06:00
Bryan O'Sullivan
d32d6fb57f make LookupError more detailed 2007-11-28 08:36:55 -08:00
Matt Mackall
93267d50c5 revlog: make revlogv0 loading more robust against corruption 2007-11-24 12:13:32 -06:00
Benoit Boissinot
0442ace6c2 fix UnboundLocalError, refactor a bit
bin wasn't defined in all branches (bug introduced in 959d401a1954
2007-10-11 12:16:55 +02:00
Matt Mackall
81a40fb9b2 revlog: break up compression of large deltas
Python's zlib apparently makes an internal copy of strings passed to
compress(). To avoid this, compress strings 1M at a time, then join
them at the end if the result would be smaller than the original.

For initial commits of large but compressible files, this cuts peak
memory usage nearly in half.
2007-10-11 00:46:54 -05:00
Matt Mackall
0804290ab7 revlog: fix caching of buffer objects 2007-10-11 00:46:53 -05:00
Matt Mackall
9d62709a2c revlog: avoid large yields in group()
Split large yields so that the downstream consumer (chunkbuffer) will avoid
some pain when reading ahead.
2007-10-11 00:46:51 -05:00
Matt Mackall
adbffbec3c revlog: reduce memory usage in addgroup
- use a buffer to extract the delta from a chunk
- avoid concatenating to a compressed delta
- use a buffer to directly extra full text from a trivial delta
- delete chunk and delta objects after use
2007-10-11 00:46:47 -05:00
Matt Mackall
305c1ae64c changegroup: avoid large copies
- handle chunk headers separately rather than prepending them to
  (potentially large) chunks
- break large chunks into 1M pieces for compression
- don't prepend file metadata onto (potentially large) file data
2007-10-03 17:17:28 -05:00
Matt Mackall
a92b40c2ed revlog: generate trivial deltas against null revision
To avoid extra memory usage and performance issues with large files,
generate a trivial delta header for deltas against the null revision
rather than calling the usual delta generator.

We append the delta header to meta rather than prepending it to data
to avoid a large allocate and copy.
2007-10-03 17:17:27 -05:00
Alexis S. L. Carvalho
07df6adfb5 revlog: fix revlogio.packentry corner case
We want to store version information about the revlog in the first
entry of its index.  The code in packentry was using some heuristics
to detect whether this was the first entry, but these heuristics could
fail in some cases (e.g. rev 0 was empty; rev 1 descends directly from
the nullid and is stored as a delta).

We now give the revision number to packentry to avoid heuristics.
2007-09-26 01:58:45 -03:00
Matt Mackall
1e7f28023a Merge with crew 2007-09-24 12:34:26 -05:00
Patrick Mezard
327e3eb360 revlog: fix inlined revision transaction extra data (issue 749) 2007-09-23 18:24:19 +02:00
Matt Mackall
ccc415d026 revlog: more robust for damaged indexes
- fix flag reporting
- make broken length reporting smarter
2007-09-21 17:14:39 -05:00
Matt Mackall
37cc19c8c5 revlog: localize some fastpath functions 2007-07-26 12:02:58 -05:00
Matt Mackall
eeb8f14a99 revlog: minor chunk speed-up 2007-07-26 12:02:58 -05:00
Matt Mackall
d106fa8150 revlog: minor revdiff reorganization 2007-07-26 12:02:58 -05:00
Matt Mackall
9429a0a390 revlog: move flag checking out of the offset fastpath 2007-07-26 12:02:58 -05:00
Matt Mackall
767bb11dd5 revlog: avoid some unnecessary seek/tell syscalls 2007-07-23 20:44:08 -05:00
Matt Mackall
dd01d60440 lazyparser.findnode: fix typo and s/rfind/find/
There's no reason to use reverse string search and it's slightly slower
2007-07-23 20:44:08 -05:00
Matt Mackall
7292978647 lazyindex: speed up __getitem__
This function is fairly performance sensitive, so we make a couple
ugly tweaks:

- keep all entries packed so we needn't test entry types
- fold index lookup/load into unpack call to eliminate
  local variable setting
2007-07-23 20:44:08 -05:00
Matt Mackall
a68e049384 lazyparser: up the blocksize from 512 bytes to 64k 2007-07-23 20:44:08 -05:00
Matt Mackall
b607d22a05 revlog: implement a fast path for heads 2007-07-23 20:44:08 -05:00
Matt Mackall
cb95c386e8 revlogio: speed up parsing
- precalcuate ending offset
- pull some variables into local scope
- separate inline and out of line code paths
2007-07-23 20:44:08 -05:00
Matt Mackall
8fa2498ebf revlog: eliminate diff and patches functions
call mdiff variants directly
2007-07-23 20:44:08 -05:00
Matt Mackall
9257ef4f4f revlog: speed up chunkcache
- use a reasonable cache size
- avoid an extra copy when we pull in big revs
2007-07-23 20:44:08 -05:00
Matt Mackall
141c035280 revlog: some basic code reordering 2007-07-23 20:44:08 -05:00
Matt Mackall
ff72ed852c revlog: abstract out index entry packing
This lets us remove most of the remaining v0/v1 logic from revlog
2007-07-23 20:44:08 -05:00
Matt Mackall
1f16099cd0 revlog: simplify revlog.__init__
- move stat into io helper
- get rid of self.defversion and self.indexstat
- fold _load into __init__
2007-07-23 20:44:08 -05:00
Matt Mackall
f3686b0a39 revlog: mark cache private 2007-07-23 20:44:08 -05:00
Matt Mackall
9a71ba31c4 revlog: pull chunkcache back into revlog 2007-07-23 20:44:08 -05:00
Matt Mackall
35c14c89a6 revlog: change _inline from a function to a variable 2007-07-23 20:44:08 -05:00
Matt Mackall
b51cdea681 revlog: simplify addrevision
- remove unused defaults for p1, p2, and text
- reduce some if/else
- use better variable names
- remove some extra variables
- remove some obsolete corner tests
- simply first entry handling for revlogng
- simply inline vs outofline writeout
2007-07-23 20:44:08 -05:00
Matt Mackall
0ab56eac5f revlog: some codingstyle cleanups 2007-07-23 20:44:08 -05:00
Matt Mackall
2cb4c11520 revlog: add a magic null revision to our index
We expand our index by one entry so that index[nullrev] points to a
unique entry, the null revision. This naturally eliminates numerous
extra tests in the performance-sensitive index access functions, most
of which are now trivial again.

Adding new entries is now done with insert(-1, e) rather than
append(e).
2007-07-23 20:44:08 -05:00
Matt Mackall
f03d3e07aa revlog: change accesses to index entry elements to use positive offsets 2007-07-23 20:44:08 -05:00
Matt Mackall
04b4378f47 revlog: parse revlogv0 indexes into v1 internally
This lets us eliminate lots of special case code in our
performance-sensitive index accessors.
2007-07-23 20:44:08 -05:00
Matt Mackall
70e7477200 revlog: only allow lazy parsing with revlogng files
This will allow us to store indices in memory in a single entry format
2007-07-23 20:44:08 -05:00
Matt Mackall
214f50b511 revlog: simplify the v1 immediate parser
- read all the data at once (large files are handled by the lazy parser)
- cache the entire file for inline revlogs
- simplify looping
2007-07-23 20:44:08 -05:00
Matt Mackall
3b9167f022 revlog: set the threshold for lazy parsing higher
A typical machine can parse a 1MB index in well under a second
2007-07-23 20:44:08 -05:00
Matt Mackall
1889aee8b0 revlog: simplify the v0 parser 2007-07-23 20:44:07 -05:00
Matt Mackall
e7ef5dc500 revlog: add revlogio interface
This lets us separate the logic for different on-disk revlog formats from
the main revlog logic.
2007-07-23 20:44:07 -05:00
Matt Mackall
2158f34c5f revlog: regroup parsing code 2007-07-23 20:44:07 -05:00
Matt Mackall
d5b7eaa69a revlog: privatize some methods 2007-07-21 16:18:42 -05:00
Matt Mackall
0e54e000c1 revlog: delete unused function makenode 2007-07-21 16:18:24 -05:00
Matt Mackall
9eea27ad83 revlog: raise offset/type helpers to global scope 2007-07-21 16:18:21 -05:00
Thomas Arendsen Hein
2501b7aeac Fix revlog.children so the real children of the null revision can be calculated. 2007-07-03 12:45:33 +02:00
Thomas Arendsen Hein
4d29c6dc8e Updated copyright notices and add "and others" to "hg version" 2007-06-19 08:51:34 +02:00
Alexis S. L. Carvalho
ae21f631dc merge with crew-stable 2007-06-04 00:26:53 -03:00
Alexis S. L. Carvalho
f0513bf1bb Also check the index file size when deciding whether to reload a revlog.
This should fix some spurious failures from test-clone-pull-corruption
(issue552).
2007-06-04 00:24:48 -03:00
Alexis S. L. Carvalho
047c4b002b Merge with crew-stable. 2007-04-07 04:45:27 -03:00
Alexis S. L. Carvalho
b98b34fc2e revlog.py: fix/tweak read ahead code in lazyparser 2007-04-07 04:27:55 -03:00
Matt Mackall
746c62bff7 Fixups for recent changes in revlog version handling 2007-04-02 14:16:44 -05:00
Thomas Arendsen Hein
c0c7def517 Fixed spacing in assignment of REVLOG_DEFAULT_VERSION 2007-03-24 13:31:43 +01:00
Matt Mackall
04561e556e revlog: simplify revlog version handling
- pass the default version as an attribute on the opener
- eliminate config option mess
2007-03-22 19:52:38 -05:00
Matt Mackall
b4f6965b1d revlog: don't pass datafile as an argument 2007-03-22 19:12:03 -05:00
Matt Mackall
29e8301c27 Merge with stable 2007-03-15 18:57:47 -05:00
Matt Mackall
e33842c05f revlog: attempt to gracefully handle some interleaved damage 2007-03-15 18:38:46 -05:00
Brendan Cully
53a62dfb33 lazyindex: handle __delitem__ in loadblock 2007-02-04 16:08:56 -08:00
Brendan Cully
8a6eea2483 Add revlog.LookupError exception, and use it instead of RevlogError.
Remove repo.LookupError, which devolves to the revlog version.
2006-12-18 12:22:43 -08:00
Matt Mackall
887599574c Sync with -stable 2006-12-17 21:48:22 -06:00
Benoit Boissinot
fc997dfbf2 fix calculation of new heads added during push with -r
fix issue450
2006-12-17 05:00:22 +01:00
Matt Mackall
296d6a7cb8 Simplify i18n imports 2006-12-14 20:25:19 -06:00
Matt Mackall
f17a4e1934 Replace demandload with new demandimport 2006-12-13 13:27:09 -06:00
Thomas Arendsen Hein
aaa1f20f5a Use unsigned version format.
This way can use one additional bit, and when encountering invalid revlogs
with the first bit set don't produce python warnings or strange error messages.
2006-12-01 23:27:53 +01:00
Thomas Arendsen Hein
d279e55ca0 Improve error message for unknown revlog flags.
Old: unknown flags 120000 for ...
New: unknown flags 0x0012 for ...
2006-12-01 23:16:12 +01:00
Matt Mackall
b4165617fe Make revlog error slightly less scary 2006-12-01 02:24:56 -06:00
Matt Mackall
9c3965d552 add docstring to reachable 2006-11-19 16:32:36 -06:00
Thomas Arendsen Hein
d3c6666f73 Indentation cleanups for 16c127c30658. 2006-11-19 16:09:04 +01:00
Marcos Chaves
794888ecba fix warnings generated by pygettext.py. 2006-11-18 17:20:38 -02:00
Matt Mackall
aa97044b36 revlog: reachable actually takes a node 2006-11-13 13:26:57 -06:00
Benoit Boissinot
46893fed9e revlog: more nullrev fixes 2006-10-29 16:14:55 +01:00
Benoit Boissinot
a0c2a353ec revlog: return 0 as offset for nullid 2006-10-29 16:14:02 +01:00
Benoit Boissinot
a2d320e112 revlog.size() fix handling of rev == -1 2006-10-29 14:41:14 +01:00
Thomas Arendsen Hein
687e4a7111 Define and use nullrev (revision of nullid) instead of -1. 2006-10-29 10:53:51 +01:00
Alexis S. L. Carvalho
7342f50f68 revlog.py: always return tuples from parents and parentrevs
There's at least one place doing parentrevs(rev) != (rev-1, -1),
which is always true with revlog v0, since parentrevs returns a list
in this case.
2006-10-24 23:00:43 -03:00
Matt Mackall
49503fb772 Merge with crew 2006-10-24 13:46:04 -05:00
Benoit Boissinot
7c004b60e9 fix errors spotted by pychecker 2006-10-19 16:55:34 +02:00
Benoit Boissinot
1bccbf1e1e revlog.children: use parentrevs instead of parents 2006-10-19 10:23:27 +02:00
Matt Mackall
4a6017f8e8 Only look up tags and branches as a last resort 2006-10-18 11:44:56 -05:00
Matt Mackall
833cdcbbe2 revlog.lookup tweaks
- fast path for binary node ids
- direct lookup for full hex ids
- silly change to bin_id
2006-10-17 22:07:54 -05:00
Alexis S. L. Carvalho
54c70682e5 make revlog.addgroup pass its file handles to addrevision
This should fix issue255.

It looks like the problem there happens when addgroup calls addrevision
to add a full revision, and addrevision decides to split the index file
into a .i/.d pair.  Since addgroup has an open file handle for the
index file, the renaming of the new .i file to its final name fails on
windows.
2006-10-14 18:47:48 -03:00
Benoit Boissinot
a1bd76f99b nodesbetween: fix a bug with duplicate heads 2006-10-12 11:40:26 +02:00
Brendan Cully
65be154af0 Teach bdiff to support buffer objects
manifest.add gives revlog.addrevision a buffer object, which may
be cached and used for a second call in the same session (as mq does
when pushing multiple patches). The other option would be to cast the
buffer to str when caching it.
2006-10-11 12:06:14 -07:00
Benoit Boissinot
00efcc68ba correctly find the type of 'id' in revlog.lookup 2006-09-30 15:15:59 +02:00
Benoit Boissinot
445628dbea optimize revlog.lookup when passed hex(node)[:...]
Instead of converting each node from the filenode to a hex form,
convert the arg to a bin form.
For a revlog with 26711 entries, doing 100 lookup:
before: ~18s
after : ~13s
2006-09-24 13:52:27 +02:00
Benoit Boissinot
1dc0baf068 cleanups in revlog.lookup
- add comments
- do a clean separation of the different cases
- don't use a list of each possible node when
  doing the lookup, just keep the previous entry
2006-09-24 13:52:25 +02:00
Matt Mackall
7ca6c6f0dd Switch revlog.ancestor to use revisions rather than nodeids 2006-09-21 18:15:44 -05:00
Matt Mackall
79aed53c85 Abstract ancestor algorithm into generic function
Make depth calculation non-recursive
Add simple shortcut for linear ancestry

Convert context to use ancestor function
 make memoized parents function

Convert revlog to use ancestor function
2006-09-20 16:50:50 -05:00
Benoit Boissinot
2caa3e642d fix warnings spotted by pychecker 2006-09-18 17:43:31 +02:00
Alexis S. L. Carvalho
6a3814b114 Avoid negative block sizes in lazyparser.
This fixes a bug introduced by changeset 605357078795 .
2006-09-13 14:37:51 -03:00
Alexis S. L. Carvalho
38036387d3 don't let lazyparser read more data than it can handle
This should fix issue368.
2006-09-10 19:15:08 -03:00
Matt Mackall
e3e04b8f17 Move cmp bits from filelog to revlog 2006-08-15 14:18:13 -05:00
Vadim Gelfer
dc377b58c1 update copyrights. 2006-08-12 12:30:02 -07:00
Matt Mackall
4dc0a93fd6 revlog.lookup optimization 2006-08-03 21:24:19 -05:00
Benoit Boissinot
490a3977ae correct the handling of linkrev with nullid 2006-07-17 01:58:59 +02:00
Benoit Boissinot
c0ceee40fc lookup should allow -1 to represent nullid (if passed an int as arg) 2006-07-17 01:58:50 +02:00
Vadim Gelfer
e0b0ae3431 clean up trailing white space. 2006-07-12 08:28:00 -07:00
Matt Mackall
ca55a0ae02 revlog: make lookup handle binary nodes 2006-06-28 16:52:42 -05:00
Matt Mackall
e00f914b09 revlog: handle integer arguments to lookup 2006-06-28 15:49:33 -05:00
Alexis S. L. Carvalho
30401d484f Change revlog.heads to walk the revision graph using revision numbers
On the kernel repo:
$ hg heads -q
           before    after
RevlogNG    1.11     0.52
Revlogv0    0.80     0.69

Since the current code for tags has to find all the heads of the repo,
this also helps there:
$ hg tags
           before    after
RevlogNG    2.35     1.76
Revlogv0    2.04     1.90
2006-06-20 15:02:23 -03:00
Alexis S. L. Carvalho
6b69fa6621 Add revlog.parentrevs function.
This allows one to walk the revision graph using only revision numbers,
which can be faster than using revision hashes, especially for
RevlogNG, where the parents of a revision are stored as revision
numbers.
2006-06-20 14:57:30 -03:00
Thomas Arendsen Hein
5800bfc290 Manifest groups may be empty, so don't abort in this case (fixes issue210).
Only abort on empty changelog and file revlogs.
2006-05-31 22:25:20 +02:00
Benoit Boissinot
01540f3159 fix a typo in an error message 2006-05-16 11:07:56 +02:00
Alexis S. L. Carvalho
e2d5b135e9 Fix revlog.parseindex
parseindex could fail if read returns too little data in the right
moment (e.g. when there's still leftover data from the previous
iteration and read returns less than "s" bytes).
2006-05-14 18:22:12 -03:00
mason@suse.com
f2b0d07cb4 Reduce ram used for very large inlined index files
During a clone, an inline index is not converted to a split index
file until the very end.  When the conversion happens, the index
can be very large, and the inline index loading functions always load
the entire index file into ram.

This changes the revlog code to read the index in smaller chunks.
2006-05-10 15:26:56 -07:00
Vadim Gelfer
20d2979fe8 windows: revlog.lazyparser not always safe to use.
can not use on windows < nt or if win32 api not available.
2006-05-10 11:10:18 -07:00
mason@suse.com
58d4ef2538 Use revlogng and inlined data files by default
This changes revlog specify revlogng by default.  Inlined
data files are also used unless a flags option is found in the .hgrc.
Some example hgrc files:

[revlog]
# use the original revlog format
format=0

[revlog]
# use revlogng.  Because no flags are included, inlined data files
# also be selected
format=1

[revlog]
# use revlogng but do not inline the data files with the index
flags=

[revlog]
# the new default
format=1
flags=inline
2006-05-08 14:26:18 -05:00
Vadim Gelfer
75ddc9a984 merge with crew. 2006-05-02 14:37:55 -07:00
Vadim Gelfer
fad839fb0b fix file handling bugs on windows.
add util.posixfile class that has posix semantics on windows.
fix util.rename so it works with stupid windows delete semantics.
2006-05-02 14:30:00 -07:00
Thomas Arendsen Hein
c9a89940a1 Replaced 0 with REVLOGV0 where this meaning is used. 2006-04-27 21:16:46 +02:00
Thomas Arendsen Hein
4b95cebb2d Corrected error message for incompatible revision flags. 2006-04-27 21:03:07 +02:00
Alexis S. L. Carvalho
1b54526c23 Fix revlog-ng interaction with old-http.
revlog.py wasn't trying to detect the version of a revlog file that
doesn't exist on the filesystem (as is the case with old-http).

Additionally, there was an off-by-one error in httprangereader.read
(ranges in HTTP Range headers are inclusive), making it get more data
than what was asked for.  This made a struct.unpack complain that
"unpack str size does not match format".

Finally, with the two fixes above, test-static-http fails, since
BaseHTTPServer doesn't understand ranges and returns too much data.
Work around that by reading only the specified amount.
2006-04-26 22:42:07 -07:00
Vadim Gelfer
15e922024b make appendfile simpler so it does not break with revlogng on windows.
it used to cache open files. this made revlogng break because it wants
to rename files when splitting .i into .i/.d, but cannot rename or unlink
open files on windows.

new code is bit slower, but safe on linux and windows. proper fix for
too many open/close of changelog/manifest belongs in different place.
can get 10% speed improvement back.
2006-04-19 08:33:46 -07:00
Chris Mason
4841dc10da Fix transaction handling during interleaved file split. 2006-04-17 13:19:58 -04:00
mason@suse.com
ccafb51c29 Additional appendfile fixes for interleaved data/index files
The appendfile code was not passing default version info to the
changelog or manifest classes, and so they were always being created
as version 0.

revlog.checkinlinesize had to be corrected to seek to the end
of the index file when no index file was passed (only clone does this)
2006-04-08 20:08:06 -04:00
Chris Mason
d59976bf1f Speedup revlog.ancestors for the linear case
revlog.ancestors can be expensive on big repos.  This cuts down the overall
time for hg update by ~19% by short cutting revlog.ancestors when one of the
revisions is reachable from another.
2006-04-06 20:13:09 -04:00
mason@suse.com
b9b0249b14 Reduce index memory usage by storing the bare string instead of tuples
Storing the tuple returned by struct.unpack significantly increases
the memory required to store the entire index in ram.  This patch
uses struct.unpack on demand instead.
2006-04-04 19:00:40 -04:00
mason@suse.com
2faf52fa64 New lazy index code for revlogs.
This tunes for large repositories.   It does not read the whole
index file in one big chunk, but tries to buffer reads in more
reasonable chunks instead.

Search speeds are improved in two ways.  When trying to find a
specific sha hash, it searches from the end of the file backward.
More recent entries are more likely to be relevant, especially the
tip.

Also, this can load only the mapping of nodes to revlog index number.
Loading the map uses less cpu (no struct.unpack) and much less
memory than loading both the map and the index.

This cuts down the time for hg tip on the 80,000 changeset
kernel repo from 1.8s to 3.69s.  Most commands the pull a single
rev out of a big index get roughly the same benefit.  Commands
that read the whole index are not slower.
2006-04-04 16:47:12 -04:00
mason@suse.com
492b52fda3 Fill in the uncompressed size during revlog.addgroup
This uses code from Matt to calculate the size change that
would result from applying a delta to keep an accurate running
total of the text size during revlog.addgroup
2006-04-04 16:38:44 -04:00
mason@suse.com
75112658c9 Fix inlined revlogs to seek to eof after opening "a+" 2006-04-04 16:38:44 -04:00
mason@suse.com
9131eec8e3 Create an atomic opener that does not automatically rename on close
The revlog.checkinlinesize() uses an atomic opener to replace the
index file after converting it from inline to traditional .i and .d
files.  If this operation is interrupted, the atomic file class can
overwrite a valid file with a partially written one.

This patch introduces an atomic opener that does not automatically
replace the destination file with the tempfile.  This way
an interrupted checkinlinesize() call turns into a noop.
2006-04-04 16:38:44 -04:00
mason@suse.com
f197c325c7 Make the appendfile class inline-data index friendly
The appendfile class needs a few changes to make it work with interleaved
index files.  It needs to support the tell() method, opening in a+ mode,
and it needs to delay the checkinlinesize call until after the
append file is written.

Given that open(file, "a+") doesn't always seek to the end of the file,
this adds seek operations to appendfile that understand whence args
2006-04-04 16:38:43 -04:00
mason@suse.com
e7ddbb442b Implement data inlined with the index file
This patch allows you to optionally inline data bytes with the
revlog index file.  It saves considerable space and checkout
time by reducing the number of inodes, wasted partial blocks and
system calls.

To use the inline data add this to your .hgrc

[revlog]
# inline data only works with revlogng
format=1
# inline is the only valid flag right now.
flags=inline
2006-04-04 16:38:43 -04:00
mason@suse.com
ed26ff0cae Implement revlogng.
revlogng results in smaller indexes, can address larger data files, and
supports flags and version numbers.

By default the original revlog format is used.  To use the new format,
use the following .hgrc field:

[revlog]
# format choices are 0 (classic revlog format) and 1 revlogng
format=1
2006-04-04 16:38:43 -04:00
Thomas Arendsen Hein
639ae71888 Calling revlog.addgroup with an empty changegroup now raises RevlogError.
The empty changegroup can be caused by remote servers dying soon after
findincoming, and further code in pull assumes (correctly) that there are
new changesets.
2006-03-24 19:51:05 +01:00
Thomas Arendsen Hein
b246223f51 make incoming work via ssh (issue139); move chunk code into separate module.
Incoming ssh needs to detect the end of the changegroup, otherwise it would
block trying to read from the ssh pipe. This is done by parsing the
changegroup chunks.

bundlerepo.getchunk() already is identical to
localrepo.addchangegroup.getchunk(), which is followed by getgroup which
looks much like what you can re-use in bundlerepository.__init__() and in
write_bundle(). bundlerevlog.__init__.genchunk() looks very similar, too,
as do some while loops in localrepo.py.

Applied patch from Benoit Boissinot to move duplicate/related code
to mercurial/changegroup.py and use this to fix incoming ssh.
2006-03-21 11:47:21 +01:00
Benoit Boissinot
e6018802bc revlog.py: factorization and fixes for rev < 0 (nullid) 2006-03-13 03:54:23 +01:00
Thomas Arendsen Hein
3123f24623 Fix some problems when working on broken repositories:
Fix tracebacks in hg verify for certain repo errors.
Print compression type byte encoded safely.
2006-03-08 00:27:23 +01:00
Benoit Boissinot
75ed459311 revalidate revlog data after locking the repo (issue132) 2006-02-22 07:26:29 +01:00
Benoit Boissinot
9ea87984bc fix warnings from pychecker (unused variables and shadowing) 2006-02-19 19:43:03 +01:00
mason@suse.com
14cb4382e3 revlog.strip should clear the chunkcache
The chunkcache isn't valid after a strip, it needs to be cleared out.
2006-02-09 17:07:20 -06:00
Matt Mackall
1715110151 verify: notice extra data in indices 2006-01-30 19:34:35 +13:00
Matt Mackall
51ee941af7 Fix revlog signature check for empty revlogs 2006-01-29 20:30:41 +13:00
Matt Mackall
9006bd163c Add revlog version signature check 2006-01-29 20:27:58 +13:00
Benoit Boissinot
32f8c6a746 cleanup of revlog.group when repository is local
revlog.group cached every chunk from the revlog, the behaviour was
needed to minimize the roundtrip with old-http.

We now cache the revlog data ~4MB at a time.

The memory used server side when pulling goes down to 35Mo maximum
whereas without the patch more than 160Mo was used when cloning the linux kernel
repository.
The time used by cloning is higher mainly because of the check in revlog.revision.
before
110.25user 20.90system 2:52.00elapsed 76%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+708707minor)pagefaults 0swaps
after
117.56user 18.86system 2:50.43elapsed 80%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+748366minor)pagefaults 0swaps
2005-12-27 13:09:49 -06:00
Eric Hopper
dd6718fc31 Convert all classes to new-style classes by deriving them from object. 2005-11-18 22:48:47 -08:00
Thomas Arendsen Hein
b59e8e283a Fixes to "hg heads -r FOO":
Make it actually work (undefined variable 'rev'; allow to pass a rev parameter).
repo.branchlookup() doesn't need a copy of heads because it doesn't modify it.
Use None as default argument to heads() instead of nullid.
Doc string PEPification.
2005-11-16 12:56:19 +01:00
Benoit Boissinot
c4fc213345 add a -r/--rev option to heads to show only heads descendant from rev 2005-11-16 12:08:25 +01:00
mason@suse.com
bde403a04f Add revlog.strip to truncate away revisions.
This updates the revlog data structures for index and nodemap in place
so the .d and .i files don't need to be reread after stripping away a revision.
2005-11-11 18:20:24 -08:00
mason@suse.com
4813e5d3d3 Reduce string duplication in compression code
This cuts down on string copies and allows buffers (instead of strings)
to be passed into the compression code
2005-11-11 18:20:19 -08:00
Matt Mackall
20d2456786 Add safety check for addgroup 2005-11-07 15:40:24 -08:00
Matt Mackall
9e0ab220a0 Handle empty logs in repo.checksize 2005-11-02 20:09:19 -08:00
Matt Mackall
cb02ba2358 verify: add check for mismatch of index and data length 2005-11-02 19:26:23 -08:00
Matt Mackall
577f208d42 Merge bundle -r work from Eric Hopper 2005-10-27 12:26:16 -07:00
Eric Hopper
c1a375da54 lazyindex fix, make load handle negative indexes properly. 2005-10-18 20:05:54 -07:00
Benoit Boissinot
06e39e559b i18n part2: use '_' for all strings who are part of the user interface 2005-10-18 18:38:39 -07:00
Benoit Boissinot
e38e94088a i18n first part: make '_' available for files who need it 2005-10-18 18:37:48 -07:00
Matt Mackall
7f179dbe59 Fix traceback on bad revlog.lookup 2005-10-15 15:49:05 -07:00
Eric Hopper
e7d44d8ed9 Fix to handle case of empty list for roots or heads in nodesbetween. 2005-10-10 17:20:38 -07:00
Eric Hopper
b1d7ce2319 Fix small bug in nodesbetween if heads is [nullid]. 2005-10-07 17:07:57 -07:00
Eric Hopper
c37e9139de This changes the revlog.group and re-implements the localrepo.changeroup
function in terms of it.

revlog.group now takes a list of nodes, and some callback functions
instead of a linkmap.
2005-10-07 10:57:11 -07:00
Eric Hopper
5a71dabdfe This implements the nodesbetween method, and it removes the newer method
and replaces it with calls to nodesbetween.
nodesbetween calculates all the changesets needed to have a complete
revision graph between a given set of base nodes and a given set of
head nodes.
2005-10-07 10:48:27 -07:00
Matt Mackall
f2dd52a8e4 Repair ancestor logic, fix up test cases 2005-09-26 16:52:47 -07:00
Bryan O'Sullivan
2b2effba47 Move urllib error handling from revlog into statichttprepo, where it belongs. 2005-09-23 00:05:16 -07:00
Bryan O'Sullivan
ed0f990208 Make revlog constructor more discerning in its treatment of errors. 2005-09-22 23:31:44 -07:00
mpm@selenic.com
e6d013f8fa Revert some exception type changes in revlog 2005-09-13 14:16:15 -05:00
mpm@selenic.com
09d2a3f668 Add preliminary support for the bundle and unbundle commands 2005-09-08 01:27:25 -07:00
mpm@selenic.com
81f7ceb9b4 Smarter handling of revlog key errors
Use RevlogError for reporting exceptions
Catch and report RevlogError exceptions at the command parser
2005-09-07 23:38:28 -07:00
Bryan O'Sullivan
fff715d0f9 revlog: raise informative exception if file is missing. 2005-09-04 14:45:03 -07:00
mpm@selenic.com
3af508f816 Minor import fixups 2005-08-27 15:19:36 -07:00
mpm@selenic.com
23905ee52b Move hash function back to revlog from node 2005-08-27 14:43:20 -07:00
mpm@selenic.com
e175fdde9b Break apart hg.py
- move the various parts of hg.py into their own files
- create node.py to store node manipulation functions
2005-08-27 14:21:25 -07:00
mpm@selenic.com
e81f28aa33 Add some docstrings to revlog.py 2005-08-27 01:43:48 -07:00
mason@suse.com
b0a4ba87ef Add revlog.reachable to find a graph of ancestors for a given rev 2005-08-26 19:19:35 -07:00
Bart Trojanowski
3529a29a40 [PATCH] raise exceptions with Exception subclasses
Fixed the patch.  Using Exception subclasses.

(tweaked by mpm)
2005-08-26 19:08:25 -07:00
benoit.boissinot@ens-lyon.fr
95b97f01ed pep-0008 cleanup
- Don't use spaces around the '=' sign when used to indicate a
      keyword argument or a default parameter value.
2005-08-26 13:06:58 +02:00
mason@suse.com
66f2574257 Add optional stop revision to revlog.heads 2005-08-14 20:09:09 -08:00
Tristan Wibberley
34dcd4a098 Fixed revlog.children.
It was comparing a node to a rev, then appending a rev onto the list
of children being constructed instead of a node.
2005-08-06 21:58:28 +01:00
Matt Mackall
bc0449b7fa Fix out of range regression
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fix out of range regression

From: Filip Brcic <brcha@users.sourceforge.net>

The old revlog.py issued "index out of range" error when cloning the repository
Now I have reverted the parts of revlog.py to the old state when prev was
initialized as -1 and later assigned self.tip() only if that is possible.
Previously prev was always initialized as self.tip() and that is where the
out of range error was.

manifest hash: c94c9aee8b6d382ef52c3981f306a6e7e5f4c4d1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCzzIxywK+sNU5EO8RAtlcAJ0TX9FXuC2c3YHuYXNwqZhdzPWUlgCggq+a
yJzUKDKH/gvnD3Tx3jcmCn8=
=euPi
-----END PGP SIGNATURE-----
2005-07-08 18:10:57 -08:00