Mercurial > hgsubversion
annotate tests/test_push_dirs.py @ 105:607d72c12dee
fetch_command: move diff file deletion code back with everything else
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 25 Nov 2008 09:18:27 -0600 |
parents | 05a0c4f6060f |
children | 6ec5b5fc5b4d |
rev | line source |
---|---|
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 import unittest |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 import test_util |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 class TestPushDirectories(test_util.TestBase): |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 def setUp(self): |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 test_util.TestBase.setUp(self) |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 test_util.load_fixture_and_fetch('emptyrepo.svndump', |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 self.repo_path, |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 self.wc_path) |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
12 def test_push_dirs(self): |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 changes = [ |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 # Single file in single directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 ('d1/a', 'd1/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 # Two files in one directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 ('d2/a', 'd2/a', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 ('d2/b', 'd2/b', 'a\n'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 # Single file in empty directory hierarchy |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 ('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
|
21 ('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
|
22 ] |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
23 self.commitchanges(changes) |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 self.pushrevisions() |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 self.assertEqual(self.svnls('trunk'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 ['d1', 'd1/a', 'd2', 'd2/a', 'd2/b', 'd31', |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
27 'd31/d32', 'd31/d32/a', 'd31/d32/d33', |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
28 '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
|
29 |
85
05a0c4f6060f
push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents:
84
diff
changeset
|
30 # 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
|
31 # 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
|
32 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 ('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
|
34 ('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
|
35 ] |
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.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
|
37 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
|
38 |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 changes = [ |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 # Remove single file in single directory |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 ('d1/a', None, None), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 # Remove one file out of two |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 ('d2/a', None, None), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 # 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
|
45 ('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
|
46 ] |
84
01e747937d35
test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents:
83
diff
changeset
|
47 self.commitchanges(changes) |
83
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 self.pushrevisions() |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 self.assertEqual(self.svnls('trunk'), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 ['d2', 'd2/b', 'd31', 'd31/d32', 'd31/d32/a', 'd31/d32/d33']) |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 def suite(): |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 all = [unittest.TestLoader().loadTestsFromTestCase(TestPushDirectories), |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 ] |
6c9b7cf1c5aa
push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 return unittest.TestSuite(all) |