Mercurial > hgsubversion
annotate tests/test_push_eol.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 | d741f536f23a |
rev | line source |
---|---|
642
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
1 import test_util |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
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:
642
diff
changeset
|
3 import unittest |
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
642
diff
changeset
|
4 |
642
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
5 class TestPushEol(test_util.TestBase): |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
6 def setUp(self): |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
7 test_util.TestBase.setUp(self) |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
8 self._load_fixture_and_fetch('emptyrepo.svndump') |
642
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
9 |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
10 def _test_push_dirs(self, stupid): |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
11 changes = [ |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
12 # Root files with LF, CRLF and mixed EOL |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
13 ('lf', 'lf', 'a\nb\n\nc'), |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
14 ('crlf', 'crlf', 'a\r\nb\r\n\r\nc'), |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
15 ('mixed', 'mixed', 'a\r\nb\n\r\nc\nd'), |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
16 ] |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
17 self.commitchanges(changes) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
18 self.pushrevisions(stupid) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
19 self.assertchanges(changes, self.repo['tip']) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
20 |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
21 changes = [ |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
22 # Update all files once, with same EOL |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
23 ('lf', 'lf', 'a\nb\n\nc\na\nb\n\nc'), |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
24 ('crlf', 'crlf', 'a\r\nb\r\n\r\nc\r\na\r\nb\r\n\r\nc'), |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
25 ('mixed', 'mixed', 'a\r\nb\n\r\nc\nd\r\na\r\nb\n\r\nc\nd'), |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
26 ] |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
27 self.commitchanges(changes) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
28 self.pushrevisions(stupid) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
29 self.assertchanges(changes, self.repo['tip']) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
30 |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
31 def test_push_dirs(self): |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
32 self._test_push_dirs(False) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
33 |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
34 def test_push_dirs_stupid(self): |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
35 self._test_push_dirs(True) |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
36 |
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
37 def suite(): |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
643
diff
changeset
|
38 all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestPushEol), |
642
c2d606a1dc6f
tests: get rid of DOS line endings.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
96
diff
changeset
|
39 ] |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
643
diff
changeset
|
40 return unittest.TestSuite(all_tests) |