annotate tests/test_push_dirs.py @ 1055:2d7398fffd0d

push: obsolete rather than rebase & strip when enabled This requires a few changes to wrappers.push() to use obsolescence rather than strip and to make the rebase -- which is non-destructive with obsolete active -- to no longer keep the originals. Possible future work involves no longer relying on rebase for non-outgoing revisions, and simply leaving them in the troubled state. We test this feature by adding setting obsolete_mode_tests to True in classes that push changes.
author Dan Villiom Podlaski Christiansen <dan@cabo.dk>
date Fri, 09 Aug 2013 19:30:25 +0200
parents d741f536f23a
children 56979160b3f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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):
1055
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1044
diff changeset
6 obsolete_mode_tests = True
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1044
diff changeset
7
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 83
diff changeset
8 def test_push_dirs(self):
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
9 repo_path = self.load_and_fetch('emptyrepo.svndump')[1]
700
04b3f476e2c3 test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
10
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
11 changes = [
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
12 # Single file in single directory
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13 ('d1/a', 'd1/a', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14 # Two files in one directory
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15 ('d2/a', 'd2/a', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
16 ('d2/b', 'd2/b', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17 # Single file in empty directory hierarchy
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
18 ('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
19 ('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
20 ]
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 83
diff changeset
21 self.commitchanges(changes)
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 self.pushrevisions()
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
23 self.assertEqual(test_util.svnls(repo_path, 'trunk'),
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
24 ['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
25 '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
26 '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
27
85
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
28 # 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
29 # 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
30 changes = [
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
31 ('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
32 ('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
33 ]
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
34 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
35 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
36
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37 changes = [
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38 # Remove single file in single directory
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39 ('d1/a', None, None),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
40 # Remove one file out of two
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
41 ('d2/a', None, None),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
42 # 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
43 ('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
44 ]
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 83
diff changeset
45 self.commitchanges(changes)
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
46 self.pushrevisions()
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
47 self.assertEqual(test_util.svnls(repo_path, 'trunk'),
323
067914ecb4eb push: Fix a bug in deletion of an entire tree.
Augie Fackler <durin42@gmail.com>
parents: 268
diff changeset
48 ['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
49
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
50 def test_push_new_dir_project_root_not_repo_root(self):
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
51 repo_path = self.load_and_fetch('fetch_missing_files_subdir.svndump',
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
52 subdir='foo')[1]
832
e9af7eba88db globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents: 731
diff changeset
53 changes = [('magic_new/a', 'magic_new/a', 'ohai',),
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
54 ]
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.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
56 self.pushrevisions()
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
57 self.assertEqual(test_util.svnls(repo_path, 'foo/trunk'), ['bar',
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
58 '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
59 '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
60 '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
61 '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
62 '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
63 '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
64 '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
65
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
66 def test_push_new_file_existing_dir_root_not_repo_root(self):
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
67 repo_path = self.load_and_fetch('empty_dir_in_trunk_not_repo_root.svndump',
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
68 subdir='project')[1]
832
e9af7eba88db globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents: 731
diff changeset
69 changes = [('narf/a', 'narf/a', 'ohai',),
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
70 ]
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 self.commitchanges(changes)
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
72 self.assertEqual(test_util.svnls(repo_path, 'project/trunk'), ['a',
832
e9af7eba88db globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents: 731
diff changeset
73 'narf',
e9af7eba88db globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents: 731
diff changeset
74 ])
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
75 self.pushrevisions()
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
76 self.assertEqual(test_util.svnls(repo_path, 'project/trunk'), ['a',
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
77 '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
78 'narf/a'])
832
e9af7eba88db globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents: 731
diff changeset
79 changes = [('narf/a', None, None,),
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
80 ]
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 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
82 self.pushrevisions()
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
83 self.assertEqual(test_util.svnls(repo_path, 'project/trunk'), ['a'])
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
84
730
efb87d5bb311 subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 700
diff changeset
85 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
86 # 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
87 # Changes a file in a subdir (regression).
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
88 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
89 stupid=False,
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
90 layout='single',
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
91 subdir='tags')
731
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
92 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
93 ('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
94 ('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
95 ]
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
96 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
97 self.pushrevisions()
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
98 self.assertEqual(test_util.svnls(repo_path, 'tags'),
731
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
99 ['copied_tag',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
100 'copied_tag/alpha',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
101 'copied_tag/beta',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
102 'new_dir',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
103 'new_dir/new',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
104 'tag_r3',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
105 'tag_r3/alpha',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
106 'tag_r3/beta',
de036c2cb36a test_push_dirs: use common commit-building infrastructure
Augie Fackler <durin42@gmail.com>
parents: 730
diff changeset
107 'tag_r3/new'])