annotate tests/test_fetch_command.py @ 254:9ba31af57e4b

Move utility_commands.find_wc_parent_rev() to cmdutil.parentrev().
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 10 Apr 2009 17:29:45 +0200
parents f8e9b74df403
children ffccf0080e54
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 import unittest
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 from mercurial import hg
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 from mercurial import node
195
906d3f302b45 Remove useless imports.
Augie Fackler <durin42@gmail.com>
parents: 154
diff changeset
5 from mercurial import ui
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 15
diff changeset
7 import test_util
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8
91
7d10165cf3d9 tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents: 78
diff changeset
9 class TestBasicRepoLayout(test_util.TestBase):
237
c90cfa665b81 Cope with date-less revisions.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 218
diff changeset
10
c90cfa665b81 Cope with date-less revisions.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 218
diff changeset
11 def test_no_dates(self):
c90cfa665b81 Cope with date-less revisions.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 218
diff changeset
12 repo = self._load_fixture_and_fetch('test_no_dates.svndump')
245
f8e9b74df403 Fix test_no_dates to not be TZ-sensitive.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
13 local_epoch = repo[0].date()
f8e9b74df403 Fix test_no_dates to not be TZ-sensitive.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 237
diff changeset
14 self.assertEqual(local_epoch[0], local_epoch[1])
237
c90cfa665b81 Cope with date-less revisions.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 218
diff changeset
15 self.assertEqual(repo[1].date(), repo[2].date())
c90cfa665b81 Cope with date-less revisions.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 218
diff changeset
16
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 def test_fresh_fetch_single_rev(self):
22
95d0109e495e Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents: 21
diff changeset
18 repo = self._load_fixture_and_fetch('single_rev.svndump')
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
19 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
20 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
21 self.assertEqual(repo['tip'].extra()['convert_revision'],
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
22 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@2')
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 self.assertEqual(repo['tip'], repo[0])
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 def test_fresh_fetch_two_revs(self):
22
95d0109e495e Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents: 21
diff changeset
26 repo = self._load_fixture_and_fetch('two_revs.svndump')
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 # TODO there must be a better way than repo[0] for this check
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 self.assertEqual(node.hex(repo[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
29 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
31 'c95251e0dd04697deee99b79cc407d7db76e6a5f')
14
d78dbf88c13d Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32 self.assertEqual(repo['tip'], repo[1])
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
33
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
34 def test_branches(self):
22
95d0109e495e Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents: 21
diff changeset
35 repo = self._load_fixture_and_fetch('simple_branch.svndump')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
36 # TODO there must be a better way than repo[0] for this check
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
37 self.assertEqual(node.hex(repo[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
38 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
39 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
40 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
41 self.assertEqual(len(repo['tip'].parents()), 1)
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
42 self.assertEqual(repo['tip'].parents()[0], repo['default'])
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
43 self.assertEqual(repo['tip'].extra()['convert_revision'],
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
44 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@4')
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
45 self.assertEqual(repo['default'].extra()['convert_revision'],
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
46 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@3')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
47 self.assertEqual(len(repo.heads()), 1)
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
48
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
49 def test_two_branches_with_heads(self):
22
95d0109e495e Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents: 21
diff changeset
50 repo = self._load_fixture_and_fetch('two_heads.svndump')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
51 # TODO there must be a better way than repo[0] for this check
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
52 self.assertEqual(node.hex(repo[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
53 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
54 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
55 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
56 self.assertEqual(node.hex(repo['the_branch'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
57 '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
58 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
59 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
15
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
60 self.assertEqual(len(repo['tip'].parents()), 1)
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
61 self.assertEqual(repo['tip'], repo['default'])
db32dee803a8 Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents: 14
diff changeset
62 self.assertEqual(len(repo.heads()), 2)
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 15
diff changeset
63
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
64 def test_many_special_cases_replay(self):
22
95d0109e495e Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents: 21
diff changeset
65 repo = self._load_fixture_and_fetch('many_special_cases.svndump')
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
66 # TODO there must be a better way than repo[0] for this check
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
67 self._many_special_cases_checks(repo)
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
68
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
69
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
70 def test_many_special_cases_diff(self):
135
e33c7a4bcebb tests: Fix a missing pass of stupid=True.
Augie Fackler <durin42@gmail.com>
parents: 125
diff changeset
71 repo = self._load_fixture_and_fetch('many_special_cases.svndump',
e33c7a4bcebb tests: Fix a missing pass of stupid=True.
Augie Fackler <durin42@gmail.com>
parents: 125
diff changeset
72 stupid=True)
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
73 # TODO there must be a better way than repo[0] for this check
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
74 self._many_special_cases_checks(repo)
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
75
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
76 def _many_special_cases_checks(self, repo):
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
77 self.assertEqual(node.hex(repo[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
78 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
79 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
80 'b7bdc73041b1852563deb1ef3f4153c2fe4484f2')
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
81 self.assertEqual(node.hex(repo['the_branch'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
82 '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
83 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
84 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
85 self.assertEqual(len(repo['tip'].parents()), 1)
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
86 self.assertEqual(repo['tip'], repo['default'])
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
87 self.assertEqual(len(repo.heads()), 2)
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
88
40
9952f03ddfbe Add a test that proves files in the branches directory don't cause breakage.
Augie Fackler <durin42@gmail.com>
parents: 25
diff changeset
89 def test_file_mixed_with_branches(self):
9952f03ddfbe Add a test that proves files in the branches directory don't cause breakage.
Augie Fackler <durin42@gmail.com>
parents: 25
diff changeset
90 repo = self._load_fixture_and_fetch('file_mixed_with_branches.svndump')
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
91 self.assertEqual(node.hex(repo['default'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
92 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
40
9952f03ddfbe Add a test that proves files in the branches directory don't cause breakage.
Augie Fackler <durin42@gmail.com>
parents: 25
diff changeset
93 assert 'README' not in repo
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
94 assert '../branches' not in repo
40
9952f03ddfbe Add a test that proves files in the branches directory don't cause breakage.
Augie Fackler <durin42@gmail.com>
parents: 25
diff changeset
95
41
496c0354019c Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents: 40
diff changeset
96 def test_files_copied_from_outside_btt(self):
496c0354019c Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents: 40
diff changeset
97 repo = self._load_fixture_and_fetch(
496c0354019c Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents: 40
diff changeset
98 'test_files_copied_from_outside_btt.svndump')
496c0354019c Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents: 40
diff changeset
99 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
100 '3c78170e30ddd35f2c32faa0d8646ab75bba4f73')
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
101 self.assertEqual(len(repo.changelog), 2)
21
8626f3d2e50b Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents: 18
diff changeset
102
43
af7ac6c03452 Fix a bug with added files from outside branches/trunk/tags.
Augie Fackler <durin42@gmail.com>
parents: 41
diff changeset
103 def test_file_renamed_in_from_outside_btt(self):
af7ac6c03452 Fix a bug with added files from outside branches/trunk/tags.
Augie Fackler <durin42@gmail.com>
parents: 41
diff changeset
104 repo = self._load_fixture_and_fetch(
af7ac6c03452 Fix a bug with added files from outside branches/trunk/tags.
Augie Fackler <durin42@gmail.com>
parents: 41
diff changeset
105 'file_renamed_in_from_outside_btt.svndump')
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 207
diff changeset
106 self.assert_('LICENSE.file' in repo['default'])
43
af7ac6c03452 Fix a bug with added files from outside branches/trunk/tags.
Augie Fackler <durin42@gmail.com>
parents: 41
diff changeset
107
112
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
108 def test_renamed_dir_in_from_outside_btt_not_repo_root(self):
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
109 repo = self._load_fixture_and_fetch(
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
110 'fetch_missing_files_subdir.svndump', subdir='foo')
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
111 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
112 '269dcdd4361b2847e9f4288d4500e55d35df1f52')
112
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
113 self.assert_('bar/alpha' in repo['tip'])
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
114 self.assert_('foo' in repo['tip'])
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
115 self.assert_('bar/alpha' not in repo['tip'].parents()[0])
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
116 self.assert_('foo' in repo['tip'].parents()[0])
e58c2f1de059 Fix a regression in converting repositories with files copied in from outside
Augie Fackler <durin42@gmail.com>
parents: 111
diff changeset
117
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
118 def test_oldest_not_trunk_and_tag_vendor_branch(self):
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
119 repo = self._load_fixture_and_fetch(
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
120 'tagged_vendor_and_oldest_not_trunk.svndump')
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
121 self.assertEqual(node.hex(repo['oldest'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
122 '926671740dec045077ab20f110c1595f935334fa')
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
123 self.assertEqual(repo['tip'].parents()[0].parents()[0],
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
124 repo['oldest'])
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
125 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
126 '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
111
5497d1264b4d fetch_command: Fix mis-converted executable when svn:executable was set to the
Augie Fackler <durin42@gmail.com>
parents: 101
diff changeset
127
136
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
128 def test_propedit_with_nothing_else(self, stupid=False):
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
129 repo = self._load_fixture_and_fetch('branch_prop_edit.svndump',
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
130 stupid=stupid)
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
131 self.assertEqual(repo['tip'].description(), 'Commit bogus propchange.')
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
132 self.assertEqual(repo['tip'].branch(), 'dev_branch')
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
133
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
134 def test_propedit_with_nothing_else_stupid(self):
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
135 self.test_propedit_with_nothing_else(stupid=True)
cf6fe8457570 Fix an apparent regression where branch name didn't get properly stored for
Augie Fackler <durin42@gmail.com>
parents: 135
diff changeset
136
144
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
137 def test_entry_deletion(self, stupid=False):
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
138 repo = self._load_fixture_and_fetch('delentries.svndump',
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
139 stupid=stupid)
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
140 files = list(sorted(repo['tip'].manifest()))
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
141 self.assertEqual(['aa', 'd1/c', 'd1/d2prefix'], files)
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
142
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
143 def test_entry_deletion_stupid(self):
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
144 self.test_entry_deletion(stupid=True)
19aabf67c792 test_fetch_command: test file and directory deletions
Patrick Mezard <pmezard@gmail.com>
parents: 138
diff changeset
145
207
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
146 def test_fetch_when_trunk_has_no_files(self, stupid=False):
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
147 repo = self._load_fixture_and_fetch('file_not_in_trunk_root.svndump', stupid=stupid)
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
148 print repo['tip'].branch()
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
149 print repo['tip']
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
150 print repo['tip'].files()
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
151 self.assertEqual(repo['tip'].branch(), 'default')
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
152
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
153 def test_fetch_when_trunk_has_no_files_stupid(self):
b20a6c149021 fetch: Fix a bogus case where no files in the root level of trunk caused breakage in the branch detection.
Augie Fackler <durin42@gmail.com>
parents: 203
diff changeset
154 self.test_fetch_when_trunk_has_no_files(stupid=True)
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
155
91
7d10165cf3d9 tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents: 78
diff changeset
156 class TestStupidPull(test_util.TestBase):
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
157 def test_stupid(self):
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
158 repo = test_util.load_fixture_and_fetch('two_heads.svndump',
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
159 self.repo_path,
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
160 self.wc_path,
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
161 True)
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
162 # TODO there must be a better way than repo[0] for this check
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
163 self.assertEqual(node.hex(repo[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
164 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
165 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
166 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
167 self.assertEqual(node.hex(repo['the_branch'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
168 '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
169 self.assertEqual(repo['the_branch'].extra()['convert_revision'],
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
170 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@5')
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
171 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
172 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
173 self.assertEqual(len(repo['tip'].parents()), 1)
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
174 self.assertEqual(repo['default'].extra()['convert_revision'],
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
175 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6')
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
176 self.assertEqual(repo['tip'], repo['default'])
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
177 self.assertEqual(len(repo.heads()), 2)
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
178
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
179 def test_oldest_not_trunk_and_tag_vendor_branch(self):
78
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
180 repo = test_util.load_fixture_and_fetch(
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
181 'tagged_vendor_and_oldest_not_trunk.svndump',
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
182 self.repo_path,
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
183 self.wc_path,
072010a271c6 Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 67
diff changeset
184 True)
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
185 repo = hg.repository(ui.ui(), self.wc_path)
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
186 self.assertEqual(node.hex(repo['oldest'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
187 '926671740dec045077ab20f110c1595f935334fa')
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
188 self.assertEqual(repo['tip'].parents()[0].parents()[0],
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
189 repo['oldest'])
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
190 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 144
diff changeset
191 '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
59
430af23bef4a Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents: 43
diff changeset
192
16
48a44546c12f Add a basic system for running the hgsubversion tests (although not the svnwrap ones) without requiring Nose. Nose is still the recommended way to run the tests.
Augie Fackler <durin42@gmail.com>
parents: 15
diff changeset
193 def suite():
18
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
194 all = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout),
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
195 unittest.TestLoader().loadTestsFromTestCase(TestStupidPull),
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
196 ]
f4c751037a4a Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents: 16
diff changeset
197 return unittest.TestSuite(all)