comparison tests/test_single_dir_push.py @ 1225:36f6d51b4edc stable 1.6.2

test_single_dir_push: call makememfilectx
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 02 Jun 2014 19:57:07 -0500
parents 6e1dbf6cbc92
children c6b01fd34694
comparison
equal deleted inserted replaced
1224:6b3e9cb69761 1225:36f6d51b4edc
21 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', 21 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
22 layout='single', 22 layout='single',
23 subdir='') 23 subdir='')
24 def file_callback(repo, memctx, path): 24 def file_callback(repo, memctx, path):
25 if path == 'adding_file': 25 if path == 'adding_file':
26 return context.memfilectx(path=path, 26 return compathacks.makememfilectx(repo,
27 data='foo', 27 path=path,
28 islink=False, 28 data='foo',
29 isexec=False, 29 islink=False,
30 copied=False) 30 isexec=False,
31 copied=False)
31 elif path == 'adding_binary': 32 elif path == 'adding_binary':
32 return context.memfilectx(path=path, 33 return compathacks.makememfilectx(repo,
33 data='\0binary', 34 path=path,
34 islink=False, 35 data='\0binary',
35 isexec=False, 36 islink=False,
36 copied=False) 37 isexec=False,
38 copied=False)
37 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) 39 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
38 ctx = context.memctx(repo, 40 ctx = context.memctx(repo,
39 (repo['tip'].node(), node.nullid), 41 (repo['tip'].node(), node.nullid),
40 'automated test', 42 'automated test',
41 ['adding_file', 'adding_binary'], 43 ['adding_file', 'adding_binary'],
60 def test_push_single_dir_at_subdir(self): 62 def test_push_single_dir_at_subdir(self):
61 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', 63 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
62 layout='single', 64 layout='single',
63 subdir='trunk') 65 subdir='trunk')
64 def filectxfn(repo, memctx, path): 66 def filectxfn(repo, memctx, path):
65 return context.memfilectx(path=path, 67 return compathacks.makememfilectx(repo,
66 data='contents of %s' % path, 68 path=path,
67 islink=False, 69 data='contents of %s' % path,
68 isexec=False, 70 islink=False,
69 copied=False) 71 isexec=False,
72 copied=False)
70 ctx = context.memctx(repo, 73 ctx = context.memctx(repo,
71 (repo['tip'].node(), node.nullid), 74 (repo['tip'].node(), node.nullid),
72 'automated test', 75 'automated test',
73 ['bogus'], 76 ['bogus'],
74 filectxfn, 77 filectxfn,
93 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', 96 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
94 layout='single', 97 layout='single',
95 subdir='trunk') 98 subdir='trunk')
96 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'}) 99 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
97 def file_callback(repo, memctx, path): 100 def file_callback(repo, memctx, path):
98 return context.memfilectx(path=path, 101 return compathacks.makememfilectx(repo,
99 data='data of %s' % path, 102 path=path,
100 islink=False, 103 data='data of %s' % path,
101 isexec=False, 104 islink=False,
102 copied=False) 105 isexec=False,
106 copied=False)
103 for fn in ['one', 'two']: 107 for fn in ['one', 'two']:
104 ctx = context.memctx(repo, 108 ctx = context.memctx(repo,
105 (repo['tip'].node(), node.nullid), 109 (repo['tip'].node(), node.nullid),
106 'automated test', 110 'automated test',
107 [fn], 111 [fn],
124 layout='single', 128 layout='single',
125 subdir='') 129 subdir='')
126 def file_callback(data): 130 def file_callback(data):
127 def cb(repo, memctx, path): 131 def cb(repo, memctx, path):
128 if path == data: 132 if path == data:
129 return context.memfilectx(path=path, 133 return compathacks.makememfilectx(repo,
130 data=data, 134 path=path,
131 islink=False, 135 data=data,
132 isexec=False, 136 islink=False,
133 copied=False) 137 isexec=False,
138 copied=False)
134 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) 139 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
135 return cb 140 return cb
136 141
137 def commit_to_branch(name, parent): 142 def commit_to_branch(name, parent):
138 repo.commitctx(context.memctx(repo, 143 repo.commitctx(context.memctx(repo,
172 cmd += [test_util.fileurl(repo_path), self.wc_path] 177 cmd += [test_util.fileurl(repo_path), self.wc_path]
173 test_util.dispatch(cmd) 178 test_util.dispatch(cmd)
174 179
175 def file_callback(repo, memctx, path): 180 def file_callback(repo, memctx, path):
176 if path == 'adding_file': 181 if path == 'adding_file':
177 return context.memfilectx(path=path, 182 return compathacks.makememfilectx(repo,
178 data='foo', 183 path=path,
179 islink=False, 184 data='foo',
180 isexec=False, 185 islink=False,
181 copied=False) 186 isexec=False,
187 copied=False)
182 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) 188 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
183 ctx = context.memctx(self.repo, 189 ctx = context.memctx(self.repo,
184 (self.repo['tip'].node(), node.nullid), 190 (self.repo['tip'].node(), node.nullid),
185 'automated test', 191 'automated test',
186 ['adding_file'], 192 ['adding_file'],