comparison tests/test_push_command.py @ 1231:5c2917375961

Merge with stable.
author Augie Fackler <raf@durin42.com>
date Tue, 12 Aug 2014 11:08:41 -0400
parents aa8b72bd1320 46523cdfd3b0
children f367a4462191
comparison
equal deleted inserted replaced
1228:9490a3052935 1231:5c2917375961
443 '2008-10-29 21:26:00 -0500', 443 '2008-10-29 21:26:00 -0500',
444 {'branch': 'default', }) 444 {'branch': 'default', })
445 new_hash = repo.commitctx(ctx) 445 new_hash = repo.commitctx(ctx)
446 hg.update(repo, repo['tip'].node()) 446 hg.update(repo, repo['tip'].node())
447 self.pushrevisions() 447 self.pushrevisions()
448 tip = self.repo['tip'] 448 # grab a new repo instance (self.repo is an @property functions)
449 repo = self.repo
450 tip = repo['tip']
449 self.assertNotEqual(tip.node(), new_hash) 451 self.assertNotEqual(tip.node(), new_hash)
450 self.assertEqual(tip['gamma'].flags(), 'l') 452 self.assertEqual(tip['gamma'].flags(), 'l')
451 self.assertEqual(tip['gamma'].data(), 'foo') 453 self.assertEqual(tip['gamma'].data(), 'foo')
452 self.assertEqual([x for x in tip.manifest().keys() if 'l' not in 454 self.assertEqual([x for x in tip.manifest().keys() if 'l' not in
453 tip[x].flags()], ['alpha', 'beta', 'adding_file', ]) 455 tip[x].flags()], ['alpha', 'beta', 'adding_file', ])
456
457 def file_callback2(repo, memctx, path):
458 if path == 'gamma':
459 return compathacks.makememfilectx(repo,
460 path=path,
461 data='a' * 129,
462 islink=True,
463 isexec=False,
464 copied=False)
465 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
466
467 ctx = context.memctx(repo,
468 (repo['tip'].node(), node.nullid),
469 'message',
470 ['gamma', ],
471 file_callback2,
472 'author',
473 '2014-08-08 20:11:41 -0700',
474 {'branch': 'default', })
475 repo.commitctx(ctx)
476 hg.update(repo, repo['tip'].node())
477 self.pushrevisions()
478 # grab a new repo instance (self.repo is an @property functions)
479 repo = self.repo
480 tip = repo['tip']
481 self.assertEqual(tip['gamma'].flags(), 'l')
482 self.assertEqual(tip['gamma'].data(), 'a'*129)
483
484 def file_callback3(repo, memctx, path):
485 if path == 'gamma':
486 return compathacks.makememfilectx(repo,
487 path=path,
488 data='a' * 64 + 'b' * 65,
489 islink=True,
490 isexec=False,
491 copied=False)
492 raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
493
494 ctx = context.memctx(repo,
495 (repo['tip'].node(), node.nullid),
496 'message',
497 ['gamma', ],
498 file_callback3,
499 'author',
500 '2014-08-08 20:16:25 -0700',
501 {'branch': 'default', })
502 repo.commitctx(ctx)
503 hg.update(repo, repo['tip'].node())
504 self.pushrevisions()
505 repo = self.repo
506 tip = repo['tip']
507 self.assertEqual(tip['gamma'].flags(), 'l')
508 self.assertEqual(tip['gamma'].data(), 'a' * 64 + 'b' * 65)
509
454 510
455 def test_push_existing_file_newly_symlink(self): 511 def test_push_existing_file_newly_symlink(self):
456 self.test_push_existing_file_newly_execute(execute=False, 512 self.test_push_existing_file_newly_execute(execute=False,
457 link=True, 513 link=True,
458 expected_flags='l') 514 expected_flags='l')