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