Commit Graph

254 Commits

Author SHA1 Message Date
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
Matt Mackall
7ad3935fdb Fix corruption resulting from skipping parts of a revision group
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fix corruption resulting from skipping parts of a revision group

We were occassionally losing track of what revision a delta applied to
when we skipped over deltas we already had and applying the delta
against the wrong base. This could result in coredumps from mpatch,
consistency errors, or failed verify.

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

iD8DBQFCzu5SywK+sNU5EO8RAi10AJ9cqIfQzOzbcdH36t1LR/rY+UMtHwCeM79p
Dtv+Jh0McLZr6nf4iJyhDgI=
=5o6U
-----END PGP SIGNATURE-----
2005-07-08 13:21:22 -08:00
Matt Mackall
ccd4188077 Fix an odd revlog bug
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fix an odd revlog bug

If revlog had a cached -empty- revision, as opposed to no cached
version, it could get confused. This cropped up in verify on a
particular repo.

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

iD8DBQFCzjRaywK+sNU5EO8RAgVEAKCv3WBJt1rBOX0UlTDXFPygPIru+gCfTZxJ
CEz1lYny1gkQ+haGY26QdBs=
=C/K5
-----END PGP SIGNATURE-----
2005-07-08 00:07:54 -08:00
mason@suse.com
5cc69df211 Performance enhancements for manifest.add()
# HG changeset patch
# User mason@suse.com

Performance enhancements for manifest.add()

Improve manifest.add performance by using bisect to insert/remove
changed items into the manifest list.  This also generates the
manifest delta directly based on the changes being made.
2005-07-06 22:28:35 -08:00
mpm@selenic.com
c6e600652f Hashing speed-up
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hashing speed-up

- From Chris Mason

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

iD8DBQFCxCFmywK+sNU5EO8RAjiEAJ98eBaomWIUtT7DAm5dCbcAOe1I7gCdFl/E
AvepXnn+tLC2Grk9et2sL3M=
=spZz
-----END PGP SIGNATURE-----
2005-06-30 08:44:22 -08:00
mpm@selenic.com
0fb5db6915 Whitespace cleanups
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whitespace cleanups

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

iD8DBQFCwuubywK+sNU5EO8RAluIAJ98XQpNdZUpSmYKgDmrMRlbL76ZzQCfes0t
rknNUN/PhtyA4bzL646dOz4=
=UyCE
-----END PGP SIGNATURE-----
2005-06-29 10:42:35 -08:00
Thomas Arendsen Hein
fbe157b4b5 Really _call_ method revlog.count in revlog.lookup()
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Really _call_ method revlog.count in revlog.lookup()
This fixes e.g. 'hg export 398737777' (exists in the mercurial repo).

manifest hash: 9de9ad4c40d0746cb3db346a01c373e3b4aba54a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCvovbW7P1GVgWeRoRAiyEAJ9gVZZiMGA3YItcWRHeai/9C+dMTgCbBiii
QoFaXQ9wZDds8fVVsvENAYw=
=msWK
-----END PGP SIGNATURE-----
2005-06-26 12:04:59 +01:00
mpm@selenic.com
5ff41c691c Various node id lookup tweaks
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Various node id lookup tweaks

- - lookup of nullid with lazymap fixed
- - do the Pythonic thing with negative rev numbers (-1 == tip)
- - bound ranges on rev numbers
- - catch exceptions more correctly
- - restrict node id matching to beginning of string on

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

iD8DBQFCvQzDywK+sNU5EO8RAnKfAJ4vzXnrGmRwOlPqNQFxxrUKchzAzQCcDkbi
g3T3KiiVUckrWpziGq67YUE=
=vrSU
-----END PGP SIGNATURE-----
2005-06-24 23:50:27 -08:00
mpm@selenic.com
ce2783cea1 Make lookup a bit smarter
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Make lookup a bit smarter

Handle overflow error
Handle "0000" -> nullid, not 0

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

iD8DBQFCu2PrywK+sNU5EO8RArqWAJ9hafXgnHjCDE/Sxtvyo+e+qmPaGgCfR8AV
DCG3i0NasG3ItbPvux2Dm5Q=
=zjqN
-----END PGP SIGNATURE-----
2005-06-23 17:37:47 -08:00
mpm@selenic.com
39bfce9301 Ancestor algorithm fix
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ancestor algorithm fix

The ancestor algorithm was a bit too optimistic about node ordering
still. Add revision numbers to the comparison to sort things out.

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

iD8DBQFCsTrCywK+sNU5EO8RAtqMAJ9fEJEesPn+0SMg/i/g5vZYmX/pBgCfVnhl
+s88q/Wilw27MVWP6J6oqX8=
=k9AU
-----END PGP SIGNATURE-----
2005-06-16 00:39:30 -08:00
mpm@selenic.com
3a091e0210 Change the size of the short hash representation
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Change the size of the short hash representation

First note that this number doesn't really matter, as we always check
for ambiguous short hash ids.

Here's the math on collision probability:

>>> import math
>>> def p(f, n): return 1 - (1 / math.exp(n**2/(2*f)))
...
>>> p(2**32, 30000.0)
0.09947179164613551   # with 30000 changesets (BKCVS), we have a 9% chance
>>> p(2**32, 65000.0)
0.38850881217977273   # and with a full import from BK, we'd have a 39% chance
>>> p(2**40, 1e6)
0.36539171908447321   # we'd like to be "safe" for 1M csets, so 40 isn't enough
>>> p(2**48, 1e6)
0.001774780051374103  # But 48 looks good
>>> p(2**48, 1e7)
0.16275260939624481
>>> p(2**48, 5e6)
0.043437281083569146
>>> p(2**48, 2e6)
0.0070802434913129764
>>> p(2**48, 3e6)
0.01586009440574343

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

iD8DBQFCsQoMywK+sNU5EO8RAoBBAJwII9GV6dT9QUOYAk3gZGw9z0JvjACfSI4q
IFnTu1F7P5OuLelO1GsM8Bs=
=CNWk
-----END PGP SIGNATURE-----
2005-06-15 21:11:40 -08:00
mpm@selenic.com
6f13d3e93a revlog: add a children function
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

revlog: add a children function

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

iD8DBQFCsPZ0ywK+sNU5EO8RAiAcAJ9D+y8zQ/Gai7CpTkfTamPFxmvVRACcDRv9
5HkupYyrxslGnGJpELaF1is=
=zf1d
-----END PGP SIGNATURE-----
2005-06-15 19:48:04 -08:00
mpm@selenic.com
9e5dff9854 lazyparser speed ups
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

lazyparser speed ups

When we do __contains__ on a map, we might as well load the whole
index. Not doing this was slowing down finding new changesets quite by
a factor of 20. When we do a full load, we also attempt to replace the
revlog's index and nodemap with normal Python objects to avoid the
lazymap overhead.

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

iD8DBQFCreYIywK+sNU5EO8RAoNHAJ9+LmXqsTQb9Bh3mZHq0A0VfQOleQCffHmn
jC/O0vnfx5FCRsX2bUFG794=
=BDTz
-----END PGP SIGNATURE-----
2005-06-13 12:01:12 -08:00
mpm@selenic.com
b7514f43bc revlog: allow duplicates
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

revlog: allow duplicates

If two branches make the same change to the same parent, the result
will be an identical hash. Git apparently does this all the time. Deal
with it gracefully.

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

iD8DBQFCqU61ywK+sNU5EO8RAkFqAJ9KhWUQgjZbzzB/+mTkolH0GkT1awCfa+Mj
ulbI4xCRZcvfQE492mcNwQA=
=N6In
-----END PGP SIGNATURE-----
2005-06-10 00:26:29 -08:00
mpm@selenic.com
bc554a1e69 fix heads for rev 0
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

fix heads for rev 0

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

iD8DBQFCofyyywK+sNU5EO8RAjkeAJ4rfOQ9HV+gpndsTzuoS6R3f+mzEQCfcb0P
IWhTz6XDpTWEkjzcK++mZ4k=
=mINY
-----END PGP SIGNATURE-----
2005-06-04 11:10:42 -08:00
mpm@selenic.com
2a4127e46c fix bad assumption about uniqueness of file versions
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

fix bad assumption about uniqueness of file versions

Mercurial had assumed that a given file hash could show up in only one
changeset, and thus that the mapping from file revision to changeset
was 1-to-1. But if two people perform the same edit with the same
parents, we can get an identical hash in different changesets.

So we've got to loosen up our uniqueness checks in addgroup and in
verify.

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

iD8DBQFCoMDkywK+sNU5EO8RAg9PAJ9YWSknfFBoeYve/+Z5DDGGvytDkwCgoMwj
kT01PcjNzGPr1/Oe5WRvulE=
=HC4t
-----END PGP SIGNATURE-----
2005-06-03 12:43:16 -08:00
mpm@selenic.com
beee203034 Beginning of multi-head support
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Beginning of multi-head support

Add revlog.heads()
Add heads command to list changeset heads

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

iD8DBQFCn7tFywK+sNU5EO8RAusWAJ9EojIxgqEEt8VZd5S+5Laj8tHV+ACfWLb5
TC7AnsoFGg50jAWF0EsofDA=
=nzyH
-----END PGP SIGNATURE-----
2005-06-02 18:07:01 -08:00
mpm@selenic.com
91589c0bf7 revlog: remove some unnecessary imports
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

revlog: remove some unnecessary imports

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

iD8DBQFCnXASywK+sNU5EO8RAkxVAJ92do7puoVbgHE2whbow4MGKKv4pQCeMmms
bt2r/9oVoFclTh2dL3SaQ2Q=
=Jeuv
-----END PGP SIGNATURE-----
2005-06-01 00:21:38 -08:00
mpm@selenic.com
55d14e5d8d Changes to network protocol
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Changes to network protocol

Stream changes at the delta level rather than at whole delta groups
 this breaks the protocol - we now send a zero byte delta to indicate
 the end of a group rather than sending the entire group length up front
Fix filename length asymmetry while we're breaking things
Fix hidden O(n^2) bug in calculating changegroup
 list.append(e) is O(n), list + [element] is not
Decompress chunks on read in revlog.group()
Improve status messages
 report bytes transferred
 report nothing to do
Deal with /dev/null path brokenness
Remove untriggered patch assertion

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

iD8DBQFCmzlqywK+sNU5EO8RAn0KAJ4z4toWSSGjLoZO6FKWLx/3QbZufACglQgd
S48bumc++DnuY1iPSNWKGAI=
=lCjx
-----END PGP SIGNATURE-----
2005-05-30 08:03:54 -08:00
mpm@selenic.com
dba1a9fc73 A new ancestor algorithm
The old ancestor algorithm could get fooled into returning ancestors
closer to root than it ought to. Hopefully this one, which strictly
orders its search by distance from room, will be foolproof.
2005-05-24 23:11:44 -08:00
mpm@selenic.com
b4d3ada8cd Remove some debugging code from lazyparser 2005-05-20 17:50:11 -08:00
mpm@selenic.com
ea4eabe690 Add code to retrieve or construct a revlog delta 2005-05-20 17:40:24 -08:00
mpm@selenic.com
a8e8d775f0 Make revision code slightly faster 2005-05-20 17:36:02 -08:00
mpm@selenic.com
a3b0765ce7 Only use lazy indexing for big indices and avoid the overhead of the
lazy index in the small index case.
2005-05-20 17:35:20 -08:00
mpm@selenic.com
06820561ca Make lazyindex load slightly faster 2005-05-20 17:34:04 -08:00
mpm@selenic.com
8b0e7913c6 Make compression more intelligent:
- we don't attempt to compress things under 44 bytes (empirical)
- we check whether larger objects actually compress
- we tag objects to indicate their compression
  NUL means uncompressed and starts with NUL
  x means gzipped and starts with x (handy)
  u means uncompressed, drop the u
2005-05-20 17:31:12 -08:00
mpm@selenic.com
fb1218fe40 Add paranoia to diff code 2005-05-18 16:59:54 -08:00
mpm@selenic.com
21089cd87c Add iterator to the lazymap code 2005-05-18 16:47:49 -08:00
mpm@selenic.com
7e5280f30b Refactor merge code
Delete old code
Fix calculation of newer nodes on server
Fix branch recursion on client
Fix manifest merge problems
Add more debugging and note messages to merge
2005-05-18 16:29:39 -08:00
mpm@selenic.com
f2ebab86cb Friendlier exceptions for unknown node errors 2005-05-17 12:20:29 -08:00
mpm@selenic.com
6795b63eb7 More useful message on broken addgroup chain 2005-05-17 11:40:26 -08:00
mpm@selenic.com
77028dbcc6 Add -q quiet option
Make -d and -v do something
Add a bunch of debug and note messages
2005-05-17 11:06:59 -08:00
mpm@selenic.com
619ec7bc34 Fix bug in lazymap code
Add a sanity check to addgroup
2005-05-17 01:07:01 -08:00
mpm@selenic.com
1bf1e8bf4c Add lazy{parser,index,map} to speed up processing of index files 2005-05-17 00:33:22 -08:00
mpm@selenic.com
00b4996d46 Change revlog to use new patch code 2005-05-16 22:10:02 -08:00
mpm@selenic.com
e56388d1b4 Add mdiff.patches to speed up applying thousands of patches to the manifest 2005-05-14 10:27:14 -08:00
mpm@selenic.com
7c6f4b49c8 Add tag support 2005-05-13 13:12:32 -08:00
mpm@selenic.com
d9094f35ef Fix up a bunch of bugs in the new merge code
Move getchangegroup/addchangegroup to generators
2005-05-13 11:47:16 -08:00
mpm@selenic.com
264f689db9 Diff in subdirectories from Jake Edge
Dates in diff
Fix O(n^2) behaviour of manifest diff
Add a/ and b/ to work with patch -p1
2005-05-12 17:54:55 -08:00
mpm@selenic.com
8bd85e1add Add changegroup support 2005-05-10 00:40:49 -08:00
mpm@selenic.com
22ff07bd9b Fix recursion depth trouble with ancestor algorithm 2005-05-10 00:34:57 -08:00
mpm@selenic.com
9bc9418a12 Fix truncate logic for indices again 2005-05-07 16:33:31 -08:00
mpm@selenic.com
8e1b58ff84 Add smart node lookup by substring or by rev number 2005-05-07 16:11:36 -08:00