Commit Graph

79 Commits

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