Mercurial > hgsubversion
annotate tests/test_single_dir_push.py @ 1051:c41e993f0892
test_fetch_commands: make a failure more readable
author | Dan Villiom Podlaski Christiansen <dan@cabo.dk> |
---|---|
date | Fri, 09 Aug 2013 20:18:31 +0200 |
parents | 3092b3c109a8 |
children | 2d7398fffd0d |
rev | line source |
---|---|
1047
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
1 import test_util |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
2 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
3 import errno |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
4 import shutil |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
5 import unittest |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
6 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
7 from mercurial import commands |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
8 from mercurial import context |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
9 from mercurial import hg |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
10 from mercurial import node |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
11 from mercurial import ui |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
12 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
13 class TestSingleDirPush(test_util.TestBase): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
14 def test_push_single_dir(self): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
15 # Tests simple pushing from default branch to a single dir repo |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
16 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
17 stupid=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
18 layout='single', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
19 subdir='') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
20 def file_callback(repo, memctx, path): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
21 if path == 'adding_file': |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
22 return context.memfilectx(path=path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
23 data='foo', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
24 islink=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
25 isexec=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
26 copied=False) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
27 elif path == 'adding_binary': |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
28 return context.memfilectx(path=path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
29 data='\0binary', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
30 islink=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
31 isexec=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
32 copied=False) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
33 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
34 ctx = context.memctx(repo, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
35 (repo['tip'].node(), node.nullid), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
36 'automated test', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
37 ['adding_file', 'adding_binary'], |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
38 file_callback, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
39 'an_author', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
40 '2009-10-19 18:49:30 -0500', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
41 {'branch': 'default', }) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
42 repo.commitctx(ctx) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
43 hg.update(repo, repo['tip'].node()) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
44 self.pushrevisions() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
45 self.assertTrue('adding_file' in test_util.svnls(repo_path, '')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
46 self.assertEqual('application/octet-stream', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
47 test_util.svnpropget(repo_path, 'adding_binary', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
48 'svn:mime-type')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
49 # Now add another commit and test mime-type being reset |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
50 changes = [('adding_binary', 'adding_binary', 'no longer binary')] |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
51 self.commitchanges(changes) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
52 self.pushrevisions() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
53 self.assertEqual('', test_util.svnpropget(repo_path, 'adding_binary', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
54 'svn:mime-type')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
55 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
56 def test_push_single_dir_at_subdir(self): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
57 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
58 stupid=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
59 layout='single', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
60 subdir='trunk') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
61 def filectxfn(repo, memctx, path): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
62 return context.memfilectx(path=path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
63 data='contents of %s' % path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
64 islink=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
65 isexec=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
66 copied=False) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
67 ctx = context.memctx(repo, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
68 (repo['tip'].node(), node.nullid), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
69 'automated test', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
70 ['bogus'], |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
71 filectxfn, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
72 'an_author', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
73 '2009-10-19 18:49:30 -0500', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
74 {'branch': 'localhacking', }) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
75 n = repo.commitctx(ctx) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
76 self.assertEqual(self.repo['tip']['bogus'].data(), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
77 'contents of bogus') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
78 before = repo['tip'].hex() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
79 hg.update(repo, self.repo['tip'].hex()) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
80 self.pushrevisions() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
81 self.assertNotEqual(before, self.repo['tip'].hex()) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
82 self.assertEqual(self.repo['tip']['bogus'].data(), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
83 'contents of bogus') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
84 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
85 def test_push_single_dir_one_incoming_and_two_outgoing(self): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
86 # Tests simple pushing from default branch to a single dir repo |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
87 # Pushes two outgoing over one incoming svn rev |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
88 # (used to cause an "unknown revision") |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
89 # This can happen if someone committed to svn since our last pull (race). |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
90 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
91 stupid=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
92 layout='single', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
93 subdir='trunk') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
94 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'}) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
95 def file_callback(repo, memctx, path): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
96 return context.memfilectx(path=path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
97 data='data of %s' % path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
98 islink=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
99 isexec=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
100 copied=False) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
101 for fn in ['one', 'two']: |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
102 ctx = context.memctx(repo, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
103 (repo['tip'].node(), node.nullid), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
104 'automated test', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
105 [fn], |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
106 file_callback, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
107 'an_author', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
108 '2009-10-19 18:49:30 -0500', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
109 {'branch': 'default', }) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
110 repo.commitctx(ctx) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
111 hg.update(repo, repo['tip'].node()) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
112 self.pushrevisions(expected_extra_back=1) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
113 self.assertTrue('trunk/one' in test_util.svnls(repo_path, '')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
114 self.assertTrue('trunk/two' in test_util.svnls(repo_path, '')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
115 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
116 def test_push_single_dir_branch(self): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
117 # Tests local branches pushing to a single dir repo. Creates a fork at |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
118 # tip. The default branch adds a file called default, while branch foo |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
119 # adds a file called foo, then tries to push the foo branch and default |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
120 # branch in that order. |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
121 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
122 stupid=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
123 layout='single', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
124 subdir='') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
125 def file_callback(data): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
126 def cb(repo, memctx, path): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
127 if path == data: |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
128 return context.memfilectx(path=path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
129 data=data, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
130 islink=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
131 isexec=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
132 copied=False) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
133 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
134 return cb |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
135 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
136 def commit_to_branch(name, parent): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
137 repo.commitctx(context.memctx(repo, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
138 (parent, node.nullid), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
139 'automated test (%s)' % name, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
140 [name], |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
141 file_callback(name), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
142 'an_author', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
143 '2009-10-19 18:49:30 -0500', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
144 {'branch': name, })) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
145 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
146 parent = repo['tip'].node() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
147 commit_to_branch('default', parent) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
148 commit_to_branch('foo', parent) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
149 hg.update(repo, repo['foo'].node()) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
150 self.pushrevisions() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
151 repo = self.repo # repo is outdated after the rebase happens, refresh |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
152 self.assertTrue('foo' in test_util.svnls(repo_path, '')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
153 self.assertEqual(repo.branchtags().keys(), ['default']) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
154 # Have to cross to another branch head, so hg.update doesn't work |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
155 commands.update(ui.ui(), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
156 self.repo, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
157 self.repo.branchheads('default')[1], |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
158 clean=True) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
159 self.pushrevisions() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
160 self.assertTrue('default' in test_util.svnls(repo_path, '')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
161 self.assertEquals(len(self.repo.branchheads('default')), 1) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
162 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
163 @test_util.requiresoption('branch') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
164 def test_push_single_dir_renamed_branch(self, stupid=False): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
165 # Tests pulling and pushing with a renamed branch |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
166 # Based on test_push_single_dir |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
167 repo_path = self.load_svndump('branch_from_tag.svndump') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
168 cmd = ['clone', '--layout=single', '--branch=flaf'] |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
169 if stupid: |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
170 cmd.append('--stupid') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
171 cmd += [test_util.fileurl(repo_path), self.wc_path] |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
172 test_util.dispatch(cmd) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
173 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
174 def file_callback(repo, memctx, path): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
175 if path == 'adding_file': |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
176 return context.memfilectx(path=path, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
177 data='foo', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
178 islink=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
179 isexec=False, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
180 copied=False) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
181 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
182 ctx = context.memctx(self.repo, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
183 (self.repo['tip'].node(), node.nullid), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
184 'automated test', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
185 ['adding_file'], |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
186 file_callback, |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
187 'an_author', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
188 '2009-10-19 18:49:30 -0500', |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
189 {'branch': 'default', }) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
190 self.repo.commitctx(ctx) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
191 hg.update(self.repo, self.repo['tip'].node()) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
192 self.pushrevisions() |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
193 self.assertTrue('adding_file' in test_util.svnls(repo_path, '')) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
194 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
195 self.assertEquals(set(['flaf']), |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
196 set(self.repo[i].branch() for i in self.repo)) |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
197 |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
198 @test_util.requiresoption('branch') |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
199 def test_push_single_dir_renamed_branch_stupid(self): |
3092b3c109a8
tests: split single directory tests that push & clone in two modules
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
diff
changeset
|
200 self.test_push_single_dir_renamed_branch(True) |