Mercurial > hgsubversion
annotate tests/test_rebuildmeta.py @ 893:295a8b48e4e2
Merge
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sat, 12 May 2012 10:07:29 -0500 |
parents | 3bfb7e985c47 78db88de9622 |
children | 7e9d805a0e1f |
rev | line source |
---|---|
643
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
638
diff
changeset
|
1 import test_util |
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
638
diff
changeset
|
2 |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 import os |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 import pickle |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 import unittest |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 |
638
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
7 from mercurial import context |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
8 from mercurial import extensions |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 from mercurial import hg |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 from mercurial import ui |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
12 from hgsubversion import svncommands |
416
cd6317fe70be
invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
414
diff
changeset
|
13 from hgsubversion import svnmeta |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
15 # These test repositories have harmless skew in rebuildmeta for the |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
16 # last-pulled-rev because the last rev in svn causes absolutely no |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
17 # changes in hg. |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
18 expect_youngest_skew = [('file_mixed_with_branches.svndump', False, False), |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
19 ('file_mixed_with_branches.svndump', True, False), |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
20 ('unrelatedbranch.svndump', False, False), |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
21 ('unrelatedbranch.svndump', True, False), |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
22 ] |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
23 |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
24 |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
25 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
26 def _do_case(self, name, stupid, single): |
194
13ae1bded5e7
Add some comprehensive tests that can be run with nose in order to make it easier to verify stupid and real replay do the same thing.
Augie Fackler <durin42@gmail.com>
parents:
182
diff
changeset
|
27 subdir = test_util.subdir.get(name, '') |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
28 layout = 'auto' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
29 if single: |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
30 layout = 'single' |
867
50c13e01c7e3
test_util: add a load_and_fetch() returning the repo_path
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
31 repo, repo_path = self.load_and_fetch(name, subdir=subdir, stupid=stupid, |
50c13e01c7e3
test_util: add a load_and_fetch() returning the repo_path
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
32 layout=layout) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 assert len(self.repo) > 0 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 wc2_path = self.wc_path + '_clone' |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
35 u = ui.ui() |
816
86d124a8768e
Fix hg.clone() calls changed by d976542986d2
Patrick Mezard <pmezard@gmail.com>
parents:
748
diff
changeset
|
36 src, dest = test_util.hgclone(u, self.wc_path, wc2_path, update=False) |
638
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
37 |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
38 # insert a wrapper that prevents calling changectx.children() |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
39 def failfn(orig, ctx): |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
40 self.fail('calling %s is forbidden; it can cause massive slowdowns ' |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
41 'when rebuilding large repositories' % orig) |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
42 |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
43 origchildren = getattr(context.changectx, 'children') |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
44 extensions.wrapfunction(context.changectx, 'children', failfn) |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
45 |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
46 try: |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
47 svncommands.rebuildmeta(u, dest, |
867
50c13e01c7e3
test_util: add a load_and_fetch() returning the repo_path
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
48 args=[test_util.fileurl(repo_path + |
638
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
49 subdir), ]) |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
50 finally: |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
51 # remove the wrapper |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
52 context.changectx.children = origchildren |
ea0f42e0004d
tests: disallow calling changectx.children() during rebuildmeta
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
622
diff
changeset
|
53 |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
54 self._run_assertions(name, stupid, single, src, dest, u) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
55 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
56 wc3_path = self.wc_path + '_partial' |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
57 src, dest = test_util.hgclone(u, |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
58 self.wc_path, |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
59 wc3_path, |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
60 update=False, |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
61 rev=[0]) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
62 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
63 # insert a wrapper that prevents calling changectx.children() |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
64 extensions.wrapfunction(context.changectx, 'children', failfn) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
65 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
66 try: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
67 svncommands.rebuildmeta(u, dest, |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
68 args=[test_util.fileurl(repo_path + |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
69 subdir), ]) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
70 finally: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
71 # remove the wrapper |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
72 context.changectx.children = origchildren |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
73 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
74 dest.pull(src) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
75 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
76 # insert a wrapper that prevents calling changectx.children() |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
77 extensions.wrapfunction(context.changectx, 'children', failfn) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
78 try: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
79 svncommands.updatemeta(u, dest, |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
80 args=[test_util.fileurl(repo_path + |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
81 subdir), ]) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
82 finally: |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
83 # remove the wrapper |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
84 context.changectx.children = origchildren |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
85 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
86 self._run_assertions(name, stupid, single, src, dest, u) |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
87 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
88 |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
89 def _run_assertions(self, name, stupid, single, src, dest, u): |
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
90 |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
91 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
92 'no .hg/svn directory in the source!') |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
93 self.assertTrue(os.path.isdir(os.path.join(src.path, 'svn')), |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
94 'no .hg/svn directory in the destination!') |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
95 dest = hg.repository(u, os.path.dirname(dest.path)) |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
821
diff
changeset
|
96 for tf in ('lastpulled', 'rev_map', 'uuid', 'tagmap', 'layout', 'subdir',): |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
97 |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
98 stf = os.path.join(src.path, 'svn', tf) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
99 self.assertTrue(os.path.isfile(stf), '%r is missing!' % stf) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
100 dtf = os.path.join(dest.path, 'svn', tf) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
246
diff
changeset
|
101 self.assertTrue(os.path.isfile(dtf), '%r is missing!' % tf) |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
416
diff
changeset
|
102 old, new = open(stf).read(), open(dtf).read() |
821
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
103 if tf == 'lastpulled' and (name, |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
104 stupid, single) in expect_youngest_skew: |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
105 self.assertNotEqual(old, new, |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
106 'rebuildmeta unexpected match on youngest rev!') |
f28e0f54a6ef
svnmeta: store youngest revision pulled from subversion
Augie Fackler <durin42@gmail.com>
parents:
816
diff
changeset
|
107 continue |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
108 self.assertMultiLineEqual(old, new, tf + ' differs') |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
416
diff
changeset
|
109 self.assertEqual(src.branchtags(), dest.branchtags()) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
110 srcbi = pickle.load(open(os.path.join(src.path, 'svn', 'branch_info'))) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
111 destbi = pickle.load(open(os.path.join(dest.path, 'svn', 'branch_info'))) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
112 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys())) |
416
cd6317fe70be
invert the svnmeta/editor relationship
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
414
diff
changeset
|
113 revkeys = svnmeta.SVNMeta(dest).revmap.keys() |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
114 for branch in destbi: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
115 srcinfo = srcbi[branch] |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
116 destinfo = destbi[branch] |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
416
diff
changeset
|
117 if srcinfo[:2] == (None, 0) or destinfo[:2] == (None, 0): |
655
dcac6dc1abe6
test_rebuildmeta: make an assertion more helpful.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
118 self.assertTrue(srcinfo[2] <= destinfo[2], |
dcac6dc1abe6
test_rebuildmeta: make an assertion more helpful.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
119 'Latest revision for %s decreased from %d to %d!' |
dcac6dc1abe6
test_rebuildmeta: make an assertion more helpful.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
120 % (branch or 'default', srcinfo[2], destinfo[2])) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
121 self.assertEqual(srcinfo[0], destinfo[0]) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
122 else: |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
123 pr = sorted(filter(lambda x: x[1] == srcinfo[0] and x[0] <= srcinfo[1], |
405
a98b8d424221
editor: simplify HgChangeReceiver constructor signature
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
383
diff
changeset
|
124 revkeys), reverse=True)[0][0] |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
125 self.assertEqual(pr, destinfo[1]) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
126 self.assertEqual(srcinfo[2], destinfo[2]) |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
127 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
128 |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
129 def buildmethod(case, name, stupid, single): |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
130 m = lambda self: self._do_case(case, stupid, single) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
131 m.__name__ = name |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
132 m.__doc__ = ('Test rebuildmeta on %s with %s replay. (%s)' % |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
133 (case, |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
134 (stupid and 'stupid') or 'real', |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
135 (single and 'single') or 'standard', |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
136 ) |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
137 ) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
138 return m |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
139 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
140 |
892
3bfb7e985c47
svn verify: add a test for corrupt repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
867
diff
changeset
|
141 skip = set([ |
3bfb7e985c47
svn verify: add a test for corrupt repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
867
diff
changeset
|
142 'project_root_not_repo_root.svndump', |
3bfb7e985c47
svn verify: add a test for corrupt repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
867
diff
changeset
|
143 'corrupt.svndump', |
3bfb7e985c47
svn verify: add a test for corrupt repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
867
diff
changeset
|
144 ]) |
3bfb7e985c47
svn verify: add a test for corrupt repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
867
diff
changeset
|
145 |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
146 attrs = {'_do_case': _do_case, |
890
78db88de9622
Partial metadata rebuilding
David Schleimer <dschleimer@fb.com>
parents:
867
diff
changeset
|
147 '_run_assertions': _run_assertions, |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
148 } |
182
47d25d61abfa
remove generators (compat with python2.3)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
155
diff
changeset
|
149 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]: |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
150 # this fixture results in an empty repository, don't use it |
892
3bfb7e985c47
svn verify: add a test for corrupt repositories.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
867
diff
changeset
|
151 if case in skip: |
347
537de0300510
Remove the 'outgoing' wrapper, and use the Mercurial infrastructure instead.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
152 continue |
499
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
153 bname = 'test_' + case[:-len('.svndump')] |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
154 attrs[bname] = buildmethod(case, bname, False, False) |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
155 name = bname + '_stupid' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
156 attrs[name] = buildmethod(case, name, True, False) |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
157 name = bname + '_single' |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
158 attrs[name] = buildmethod(case, name, False, True) |
1fd3cfa47c5e
Support for single-directory clones.
Augie Fackler <durin42@gmail.com>
parents:
474
diff
changeset
|
159 |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
821
diff
changeset
|
160 RebuildMetaTests = type('RebuildMetaTests', (test_util.TestBase,), attrs) |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
161 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
162 |
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
163 def suite(): |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
832
diff
changeset
|
164 all_tests = [unittest.TestLoader().loadTestsFromTestCase(RebuildMetaTests), |
155
ba801f44d240
utility_commands: Implement rebuildmeta so that metadata can be rebuilt.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
165 ] |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
832
diff
changeset
|
166 return unittest.TestSuite(all_tests) |