comparison tests/test_push_command.py @ 83:6c9b7cf1c5aa

push_cmd: delete empty svn directories, refactor directory creation
author Patrick Mezard <pmezard@gmail.com>
date Fri, 14 Nov 2008 16:18:24 -0600
parents 71de43e9f614
children a3b717e4abf5
comparison
equal deleted inserted replaced
82:71de43e9f614 83:6c9b7cf1c5aa
264 self.assertEqual(tip['gamma'].flags(), 'l') 264 self.assertEqual(tip['gamma'].flags(), 'l')
265 self.assertEqual(tip['gamma'].data(), 'foo') 265 self.assertEqual(tip['gamma'].data(), 'foo')
266 self.assertEqual([x for x in tip.manifest().keys() if 'l' not in 266 self.assertEqual([x for x in tip.manifest().keys() if 'l' not in
267 tip[x].flags()], ['alpha', 'beta', 'adding_file', ]) 267 tip[x].flags()], ['alpha', 'beta', 'adding_file', ])
268 268
269 def test_push_with_new_dir(self):
270 self.test_push_to_default(commit=True)
271 repo = self.repo
272 def file_callback(repo, memctx, path):
273 if path == 'newdir/gamma':
274 return context.memfilectx(path=path,
275 data='foo',
276 islink=False,
277 isexec=False,
278 copied=False)
279 raise IOError()
280 ctx = context.memctx(repo,
281 (repo['tip'].node(), node.nullid),
282 'message',
283 ['newdir/gamma', ],
284 file_callback,
285 'author',
286 '2008-10-29 21:26:00 -0500',
287 {'branch': 'default', })
288 new_hash = repo.commitctx(ctx)
289 hg.update(repo, repo['tip'].node())
290 self.pushrevisions()
291 tip = self.repo['tip']
292 self.assertNotEqual(tip.node(), new_hash)
293 self.assertEqual(tip['newdir/gamma'].data(), 'foo')
294
295 def test_push_with_new_subdir(self):
296 self.test_push_to_default(commit=True)
297 repo = self.repo
298 def file_callback(repo, memctx, path):
299 if path == 'newdir/subdir/gamma':
300 return context.memfilectx(path=path,
301 data='foo',
302 islink=False,
303 isexec=False,
304 copied=False)
305 raise IOError()
306 ctx = context.memctx(repo,
307 (repo['tip'].node(), node.nullid),
308 'message',
309 ['newdir/subdir/gamma', ],
310 file_callback,
311 'author',
312 '2008-10-29 21:26:00 -0500',
313 {'branch': 'default', })
314 new_hash = repo.commitctx(ctx)
315 hg.update(repo, repo['tip'].node())
316 self.pushrevisions()
317 tip = self.repo['tip']
318 self.assertNotEqual(tip.node(), new_hash)
319 self.assertEqual(tip['newdir/subdir/gamma'].data(), 'foo')
320
321
322 def test_push_existing_file_newly_symlink(self): 269 def test_push_existing_file_newly_symlink(self):
323 self.test_push_existing_file_newly_execute(execute=False, 270 self.test_push_existing_file_newly_execute(execute=False,
324 link=True, 271 link=True,
325 expected_flags='l') 272 expected_flags='l')
326 273