Mercurial > hgsubversion
annotate tests/test_push_dirs.py @ 1175:d6296f901fc7 stable
push: update push logic to match mercurial upstream
Commit e10000369b47 in upstream Mercurial changed the checkpush function
signature. So we need to update hgsubversion accordingly.
Ran the tests against the tip of the hg repo, against a version of hg from
January before the exchange module, and against a version of hg after
pushoperations was added but before checkpush used it, and the tests passed in
all cases.
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 09 Apr 2014 16:17:13 -0700 |
parents | 56979160b3f7 |
children |
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): |
1071
56979160b3f7
test_push_dirs: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
6 stupid_mode_tests = True |
1055
2d7398fffd0d
push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
1044
diff
changeset
|
7 obsolete_mode_tests = True |
2d7398fffd0d
push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
1044
diff
changeset
|
8 |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
9 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
|
10 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
|
11 |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 changes = [ |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 # Single file in single directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 ('d1/a', 'd1/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 # Two files in one directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 ('d2/a', 'd2/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 ('d2/b', 'd2/b', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 # Single file in empty directory hierarchy |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 ('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
|
20 ('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
|
21 ] |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
22 self.commitchanges(changes) |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 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
|
24 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
|
25 ['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
|
26 '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
|
27 '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
|
28 |
85
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
29 # 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
|
30 # 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
|
31 changes = [ |
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
32 ('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
|
33 ('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
|
34 ] |
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.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
|
36 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
|
37 |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 changes = [ |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 # Remove single file in single directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 ('d1/a', None, None), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 # Remove one file out of two |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 ('d2/a', None, None), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 # 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
|
44 ('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
|
45 ] |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
46 self.commitchanges(changes) |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 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
|
48 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
|
49 ['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
|
50 |
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 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
|
52 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
|
53 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
|
54 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
|
55 ] |
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.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
|
57 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
|
58 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
|
59 '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
|
60 '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
|
61 '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
|
62 '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
|
63 '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
|
64 '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
|
65 '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
|
66 |
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 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
|
68 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
|
69 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
|
70 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
|
71 ] |
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.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
|
73 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
|
74 'narf', |
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
731
diff
changeset
|
75 ]) |
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
|
76 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
|
77 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
|
78 '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
|
79 '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
|
80 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
|
81 ] |
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.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
|
83 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
|
84 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
|
85 |
730
efb87d5bb311
subvertpy: fix bug with pushing changes to stuff in subdirs
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
700
diff
changeset
|
86 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
|
87 # 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
|
88 # 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
|
89 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
|
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']) |