Mercurial > hgsubversion
annotate tests/test_push_dirs.py @ 754:caa527346a0f
svncommands: abort on missing metadata or Subversion URL (fixes #226)
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Thu, 18 Nov 2010 14:03:26 +0100 |
parents | de036c2cb36a |
children | e9af7eba88db |
rev | line source |
---|---|
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 import test_util |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
643
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
323
diff
changeset
|
3 import unittest |
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
323
diff
changeset
|
4 |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 class TestPushDirectories(test_util.TestBase): |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
6 def test_push_dirs(self): |
700
04b3f476e2c3
test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
7 self._load_fixture_and_fetch('emptyrepo.svndump') |
04b3f476e2c3
test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
8 |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 changes = [ |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 # Single file in single directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 ('d1/a', 'd1/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 # Two files in one directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 ('d2/a', 'd2/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 ('d2/b', 'd2/b', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 # Single file in empty directory hierarchy |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 ('d31/d32/d33/d34/a', 'd31/d32/d33/d34/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 ('d31/d32/a', 'd31/d32/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 ] |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
19 self.commitchanges(changes) |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 self.pushrevisions() |
268
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
21 self.assertEqual(self.svnls('trunk'), |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
22 ['d1', 'd1/a', 'd2', 'd2/a', 'd2/b', 'd31', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
23 'd31/d32', 'd31/d32/a', 'd31/d32/d33', |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 'd31/d32/d33/d34', 'd31/d32/d33/d34/a']) |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 |
85
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
26 # Add one revision with changed files only, no directory addition |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
27 # or deletion. |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
28 changes = [ |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
29 ('d1/a', 'd1/a', 'aa\n'), |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
30 ('d2/a', 'd2/a', 'aa\n'), |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
31 ] |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
32 self.commitchanges(changes) |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
33 self.pushrevisions() |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
34 |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
35 changes = [ |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
36 # Remove single file in single directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 ('d1/a', None, None), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 # Remove one file out of two |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 ('d2/a', None, None), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 # Removing this file should remove one empty parent dir too |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 ('d31/d32/d33/d34/a', None, None), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 ] |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
43 self.commitchanges(changes) |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 self.pushrevisions() |
268
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
45 self.assertEqual(self.svnls('trunk'), |
323
067914ecb4eb
push: Fix a bug in deletion of an entire tree.
Augie Fackler <durin42@gmail.com>
parents:
268
diff
changeset
|
46 ['d2', 'd2/b', 'd31', 'd31/d32', 'd31/d32/a', ]) |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 |
268
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
48 def test_push_new_dir_project_root_not_repo_root(self): |
700
04b3f476e2c3
test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
49 self._load_fixture_and_fetch('fetch_missing_files_subdir.svndump', |
04b3f476e2c3
test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
50 subdir='foo') |
268
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
51 changes = [('magic_new/a', 'magic_new/a', 'ohai', ), |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
52 ] |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
53 self.commitchanges(changes) |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
54 self.pushrevisions() |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
55 self.assertEqual(self.svnls('foo/trunk'), ['bar', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
56 'bar/alpha', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
57 'bar/beta', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
58 'bar/delta', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
59 'bar/gamma', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
60 'foo', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
61 'magic_new', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
62 'magic_new/a']) |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
63 |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
64 def test_push_new_file_existing_dir_root_not_repo_root(self): |
700
04b3f476e2c3
test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
65 self._load_fixture_and_fetch('empty_dir_in_trunk_not_repo_root.svndump', |
04b3f476e2c3
test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
66 subdir='project') |
268
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
67 changes = [('narf/a', 'narf/a', 'ohai', ), |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
68 ] |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
69 self.commitchanges(changes) |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
70 self.assertEqual(self.svnls('project/trunk'), ['a', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
71 'narf',]) |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
72 self.pushrevisions() |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
73 self.assertEqual(self.svnls('project/trunk'), ['a', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
74 'narf', |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
75 'narf/a']) |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
76 changes = [('narf/a', None, None, ), |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
77 ] |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
78 self.commitchanges(changes) |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
79 self.pushrevisions() |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
80 self.assertEqual(self.svnls('project/trunk'), ['a' ,]) |
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
81 |
730
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
82 def test_push_single_dir_change_in_subdir(self): |
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
83 # Tests simple pushing from default branch to a single dir repo |
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
84 # Changes a file in a subdir (regression). |
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
85 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', |
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
86 stupid=False, |
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
87 layout='single', |
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
88 subdir='tags') |
731
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
89 changes = [('tag_r3/alpha', 'tag_r3/alpha', 'foo'), |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
90 ('tag_r3/new', 'tag_r3/new', 'foo'), |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
91 ('new_dir/new', 'new_dir/new', 'foo'), |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
92 ] |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
93 self.commitchanges(changes) |
730
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
94 self.pushrevisions() |
731
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
95 self.assertEqual(self.svnls('tags'), |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
96 ['copied_tag', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
97 'copied_tag/alpha', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
98 'copied_tag/beta', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
99 'new_dir', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
100 'new_dir/new', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
101 'tag_r3', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
102 'tag_r3/alpha', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
103 'tag_r3/beta', |
de036c2cb36a
test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents:
730
diff
changeset
|
104 'tag_r3/new']) |
268
6ec5b5fc5b4d
Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents:
85
diff
changeset
|
105 |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
106 def suite(): |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
107 all = [unittest.TestLoader().loadTestsFromTestCase(TestPushDirectories), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
108 ] |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
109 return unittest.TestSuite(all) |