comparison tests/test_push_command.py @ 461:db3a53a2cd76

wrappers: make push aborts if uncommitted changes
author Patrick Mezard <pmezard@gmail.com>
date Sat, 18 Jul 2009 20:44:33 -0500
parents 62f90781eb10
children c2d0e738c899
comparison
equal deleted inserted replaced
460:ff69f1855086 461:db3a53a2cd76
47 hg.update(repo, repo['tip'].node()) 47 hg.update(repo, repo['tip'].node())
48 old_tip = repo['tip'].node() 48 old_tip = repo['tip'].node()
49 self.pushrevisions() 49 self.pushrevisions()
50 tip = self.repo['tip'] 50 tip = self.repo['tip']
51 self.assertEqual(tip.node(), old_tip) 51 self.assertEqual(tip.node(), old_tip)
52
53 def test_cant_push_with_changes(self):
54 repo = self.repo
55 def file_callback(repo, memctx, path):
56 return context.memfilectx(
57 path=path, data='foo', islink=False,
58 isexec=False, copied=False)
59 ctx = context.memctx(repo,
60 (repo['default'].node(), node.nullid),
61 'automated test',
62 ['adding_file'],
63 file_callback,
64 'an_author',
65 '2008-10-07 20:59:48 -0500',
66 {'branch': 'default',})
67 new_hash = repo.commitctx(ctx)
68 hg.update(repo, repo['tip'].node())
69 # Touch an existing file
70 repo.wwrite('beta', 'something else', '')
71 try:
72 self.pushrevisions()
73 except hgutil.Abort:
74 pass
75 tip = self.repo['tip']
76 self.assertEqual(new_hash, tip.node())
52 77
53 def test_push_over_svnserve(self, commit=True): 78 def test_push_over_svnserve(self, commit=True):
54 test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump') 79 test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump')
55 open(os.path.join(self.repo_path, 'conf', 'svnserve.conf'), 80 open(os.path.join(self.repo_path, 'conf', 'svnserve.conf'),
56 'w').write('[general]\nanon-access=write\n[sasl]\n') 81 'w').write('[general]\nanon-access=write\n[sasl]\n')