Commit Graph

235 Commits

Author SHA1 Message Date
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