Mercurial > hgsubversion
annotate tests/test_fetch_command.py @ 87:b033d74be76b
fetch_command: in stupid non-diffy mode, take changed paths in account
Former code was checkouting all branch files for every converted
revision when diffs were not available in stupid mode. Now, only
changed items are requested.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 14 Nov 2008 16:18:24 -0600 |
parents | 072010a271c6 |
children | 7d10165cf3d9 |
rev | line source |
---|---|
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 import os |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
2 import tempfile |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 import unittest |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 from mercurial import hg |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 from mercurial import ui |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 from mercurial import node |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 import fetch_command |
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
|
10 import test_util |
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 |
18
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
12 |
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 class TestBasicRepoLayout(unittest.TestCase): |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 def setUp(self): |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 self.oldwd = os.getcwd() |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 self.tmpdir = tempfile.mkdtemp('svnwrap_test') |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 self.repo_path = '%s/testrepo' % self.tmpdir |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 self.wc_path = '%s/testrepo_wc' % self.tmpdir |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 def tearDown(self): |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
21 test_util.rmtree(self.tmpdir) |
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 os.chdir(self.oldwd) |
25
99f8e4b535e9
svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents:
22
diff
changeset
|
23 |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
21
diff
changeset
|
24 def _load_fixture_and_fetch(self, fixture_name): |
25
99f8e4b535e9
svn 1.4 and 1.5 have different ideas of diff output for prop changes.
Augie Fackler <durin42@gmail.com>
parents:
22
diff
changeset
|
25 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
21
diff
changeset
|
26 self.wc_path) |
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 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
|
29 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
|
30 self.assertEqual(node.hex(repo['tip'].node()), |
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 self.assertEqual(repo['tip'], repo[0]) |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 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
|
35 repo = self._load_fixture_and_fetch('two_revs.svndump') |
14
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
36 # 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
|
37 self.assertEqual(node.hex(repo[0].node()), |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
38 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
39 self.assertEqual(node.hex(repo['tip'].node()), |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
40 'bf3767835b3b32ecc775a298c2fa27134dd91c11') |
d78dbf88c13d
Started a meaningful test suite.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
41 self.assertEqual(repo['tip'], repo[1]) |
15
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
42 |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
43 def test_branches(self): |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
21
diff
changeset
|
44 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
|
45 # 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
|
46 self.assertEqual(node.hex(repo[0].node()), |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
47 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
48 self.assertEqual(node.hex(repo['tip'].node()), |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
49 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
50 self.assertEqual(len(repo['tip'].parents()), 1) |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
51 self.assertEqual(repo['tip'].parents()[0], repo['default']) |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
52 self.assertEqual(len(repo.heads()), 1) |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
53 |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
54 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
|
55 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
|
56 # 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
|
57 self.assertEqual(node.hex(repo[0].node()), |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
58 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
59 self.assertEqual(node.hex(repo['tip'].node()), |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
60 'a595c77cfcaa3d1ba9e04b2c55c68bc6bf2b0fbf') |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
61 self.assertEqual(node.hex(repo['the_branch'].node()), |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
62 '8ccaba5f0eae124487e413abd904a013f7f6fdeb') |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
63 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()), |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
64 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
65 self.assertEqual(len(repo['tip'].parents()), 1) |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
66 self.assertEqual(repo['tip'], repo['default']) |
db32dee803a8
Add some basic tests of branching.
Augie Fackler <durin42@gmail.com>
parents:
14
diff
changeset
|
67 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
|
68 |
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
|
69 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
|
70 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
|
71 # 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
|
72 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
|
73 |
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 |
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 def test_many_special_cases_diff(self): |
22
95d0109e495e
Refactor tests so I can reuse code more.
Augie Fackler <durin42@gmail.com>
parents:
21
diff
changeset
|
76 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
|
77 # 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
|
78 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
|
79 |
8626f3d2e50b
Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents:
18
diff
changeset
|
80 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
|
81 self.assertEqual(node.hex(repo[0].node()), |
8626f3d2e50b
Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents:
18
diff
changeset
|
82 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
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['tip'].node()), |
67
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
59
diff
changeset
|
84 '179fb7d9bc77eef78288661f0430e0c1dff56b6f') |
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(node.hex(repo['the_branch'].node()), |
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 '8ccaba5f0eae124487e413abd904a013f7f6fdeb') |
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(node.hex(repo['the_branch'].parents()[0].node()), |
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 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') |
8626f3d2e50b
Add a small stack of tests that exercise some of the interesting special cases.
Augie Fackler <durin42@gmail.com>
parents:
18
diff
changeset
|
89 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
|
90 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
|
91 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
|
92 |
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 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
|
94 repo = self._load_fixture_and_fetch('file_mixed_with_branches.svndump') |
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 self.assertEqual(node.hex(repo['tip'].node()), |
9952f03ddfbe
Add a test that proves files in the branches directory don't cause breakage.
Augie Fackler <durin42@gmail.com>
parents:
25
diff
changeset
|
96 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
9952f03ddfbe
Add a test that proves files in the branches directory don't cause breakage.
Augie Fackler <durin42@gmail.com>
parents:
25
diff
changeset
|
97 assert 'README' not in repo |
9952f03ddfbe
Add a test that proves files in the branches directory don't cause breakage.
Augie Fackler <durin42@gmail.com>
parents:
25
diff
changeset
|
98 |
41
496c0354019c
Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents:
40
diff
changeset
|
99 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
|
100 repo = self._load_fixture_and_fetch( |
496c0354019c
Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents:
40
diff
changeset
|
101 '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
|
102 self.assertEqual(node.hex(repo['tip'].node()), |
496c0354019c
Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents:
40
diff
changeset
|
103 'c4e669a763a70f751c71d4534a34a65f398d71d4') |
496c0354019c
Improved handling of copies from outside of trunk.
Augie Fackler <durin42@gmail.com>
parents:
40
diff
changeset
|
104 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
|
105 |
43
af7ac6c03452
Fix a bug with added files from outside branches/trunk/tags.
Augie Fackler <durin42@gmail.com>
parents:
41
diff
changeset
|
106 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
|
107 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
|
108 'file_renamed_in_from_outside_btt.svndump') |
af7ac6c03452
Fix a bug with added files from outside branches/trunk/tags.
Augie Fackler <durin42@gmail.com>
parents:
41
diff
changeset
|
109 self.assert_('LICENSE.file' in repo['tip']) |
af7ac6c03452
Fix a bug with added files from outside branches/trunk/tags.
Augie Fackler <durin42@gmail.com>
parents:
41
diff
changeset
|
110 |
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
|
111 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
|
112 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
|
113 '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
|
114 self.assertEqual(node.hex(repo['oldest'].node()), |
430af23bef4a
Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
115 'd73002bcdeffe389a8df81ee43303d36e79e8ca4') |
430af23bef4a
Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
116 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
|
117 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
|
118 self.assertEqual(node.hex(repo['tip'].node()), |
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 '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') |
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 #'1316ef606dda89354ee8c4df725e6264177b5129') |
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 |
430af23bef4a
Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
122 |
18
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
123 class TestStupidPull(unittest.TestCase): |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
124 def setUp(self): |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
125 self.oldwd = os.getcwd() |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
126 self.tmpdir = tempfile.mkdtemp('svnwrap_test') |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
127 self.repo_path = '%s/testrepo' % self.tmpdir |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
128 self.wc_path = '%s/testrepo_wc' % self.tmpdir |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
129 |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
130 def tearDown(self): |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
131 test_util.rmtree(self.tmpdir) |
18
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
132 os.chdir(self.oldwd) |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
133 |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
134 def test_stupid(self): |
78
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
135 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
|
136 self.repo_path, |
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
137 self.wc_path, |
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
138 True) |
18
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
139 # 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
|
140 self.assertEqual(node.hex(repo[0].node()), |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
141 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
142 self.assertEqual(node.hex(repo['tip'].node()), |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
143 'a595c77cfcaa3d1ba9e04b2c55c68bc6bf2b0fbf') |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
144 self.assertEqual(node.hex(repo['the_branch'].node()), |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
145 '8ccaba5f0eae124487e413abd904a013f7f6fdeb') |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
146 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()), |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
147 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
148 self.assertEqual(len(repo['tip'].parents()), 1) |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
149 self.assertEqual(repo['tip'], repo['default']) |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
150 self.assertEqual(len(repo.heads()), 2) |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
151 |
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
|
152 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
|
153 repo = test_util.load_fixture_and_fetch( |
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
154 'tagged_vendor_and_oldest_not_trunk.svndump', |
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
155 self.repo_path, |
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
156 self.wc_path, |
072010a271c6
Fix basic issues with tests on Windows
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
157 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
|
158 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
|
159 self.assertEqual(node.hex(repo['oldest'].node()), |
430af23bef4a
Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
160 'd73002bcdeffe389a8df81ee43303d36e79e8ca4') |
430af23bef4a
Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
161 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
|
162 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
|
163 self.assertEqual(node.hex(repo['tip'].node()), |
430af23bef4a
Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
164 '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') |
430af23bef4a
Performance fix for branches-from-tags in real replay, which is tied up with
Augie Fackler <durin42@gmail.com>
parents:
43
diff
changeset
|
165 |
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
|
166 def suite(): |
18
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
167 all = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout), |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
168 unittest.TestLoader().loadTestsFromTestCase(TestStupidPull), |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
169 ] |
f4c751037a4a
Add a quick test for diff-based pull.
Augie Fackler <durin42@gmail.com>
parents:
16
diff
changeset
|
170 return unittest.TestSuite(all) |