Mercurial > hgsubversion
annotate tests/test_fetch_symlinks.py @ 890:78db88de9622
Partial metadata rebuilding
For highly active subversion repositories, it can be excruciatingly
slow to pull updates one at a time from subversion. One way around
this is to setup another mercurial repo that pulls new commits from
svn periodicly (say every 5 minutes). When you want to update your
repository, you can pull commits from this mercurial repository via
native mercurial protocols, which will be much faster than pulling
directly from svn.
Unfortunately, your metadata will be out of date after doing so.
Highly active repositories also tend to be very large, which means
that it takes a long time to rebuild your metadata from scratch. To
address this, this adds support to do a partial rebuild on the
metadata by processing only revisions that have been added to the
repository after the last revision we processed.
With the rev map 1k revisions (~2 days) behind tip updatemeta is
dramatically faster than rebuild meta:
$ hg --time svn updatemeta
Time: real 0.570 secs (user 0.480+0.000 sys 0.060+0.000)
$ hg --time svn rebuildmeta
Time: real 129.160 secs (user 128.570+0.000 sys 0.320+0.000)
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Sat, 12 May 2012 07:28:23 -0700 |
parents | 04729f3a3d17 |
children | bd12a4da0f35 |
rev | line source |
---|---|
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 import test_util |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
643
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
145
diff
changeset
|
3 import unittest |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 class TestFetchSymlinks(test_util.TestBase): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 def test_symlinks(self, stupid=False): |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
859
diff
changeset
|
7 repo = self._load_fixture_and_fetch('symlinks.svndump', stupid=stupid) |
741
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
8 # Check symlinks throughout history |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 links = { |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
10 0: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
11 'linka': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
12 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
13 'd/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
14 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
15 1: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
16 'linkaa': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
17 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
18 'd2/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
19 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
20 2: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
21 'linkaa': 'b', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
22 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
23 'd2/linka': 'b', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
24 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
25 3: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
26 }, |
741
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
27 4: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
28 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
29 }, |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
30 5: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
31 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
32 }, |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
33 6: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
34 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
35 'linka4': 'link to this', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
36 }, |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 } |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
741
diff
changeset
|
38 |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
39 for rev in repo: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
40 ctx = repo[rev] |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
41 for f in ctx.manifest(): |
859
1d07e86f5797
stupid: handle changes in svn 1.7 diff format
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
42 l = 'l' in ctx[f].flags() |
1d07e86f5797
stupid: handle changes in svn 1.7 diff format
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
43 lref = f in links[rev] |
1d07e86f5797
stupid: handle changes in svn 1.7 diff format
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
44 self.assertEqual(lref, l, '%r != %r for %s@%r' % (lref, l, f, rev)) |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
45 if f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
46 self.assertEqual(links[rev][f], ctx[f].data()) |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
47 for f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
48 self.assertTrue(f in ctx) |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 def test_symlinks_stupid(self): |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 self.test_symlinks(True) |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 def suite(): |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
832
diff
changeset
|
54 all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchSymlinks), |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 ] |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
832
diff
changeset
|
56 return unittest.TestSuite(all_tests) |