comparison tests/test_push_command.py @ 257:ffccf0080e54

Move wrappers for hg commands to their own module.
author Augie Fackler <durin42@gmail.com>
date Fri, 10 Apr 2009 22:38:29 -0500
parents 06130689a2c8
children 3848a7f9b983
comparison
equal deleted inserted replaced
256:7932d098cb5f 257:ffccf0080e54
7 from mercurial import hg 7 from mercurial import hg
8 from mercurial import node 8 from mercurial import node
9 from mercurial import ui 9 from mercurial import ui
10 from mercurial import revlog 10 from mercurial import revlog
11 11
12 import svncommands 12 import wrappers
13 import test_util 13 import test_util
14 import time 14 import time
15 15
16 16
17 class PushOverSvnserveTests(test_util.TestBase): 17 class PushOverSvnserveTests(test_util.TestBase):
35 assert False, ('You appear to be running your own svnserve!' 35 assert False, ('You appear to be running your own svnserve!'
36 ' You can probably ignore this test failure.') 36 ' You can probably ignore this test failure.')
37 args = ['svnserve', '-d', '--foreground', '-r', self.repo_path] 37 args = ['svnserve', '-d', '--foreground', '-r', self.repo_path]
38 self.svnserve_pid = subprocess.Popen(args).pid 38 self.svnserve_pid = subprocess.Popen(args).pid
39 time.sleep(2) 39 time.sleep(2)
40 svncommands.pull(ui.ui(), svn_url='svn://localhost/', 40 wrappers.clone(None, ui.ui(), source='svn://localhost/',
41 hg_repo_path=self.wc_path) 41 dest=self.wc_path, noupdate=True)
42 42
43 def tearDown(self): 43 def tearDown(self):
44 os.system('kill -9 %d' % self.svnserve_pid) 44 os.system('kill -9 %d' % self.svnserve_pid)
45 test_util.TestBase.tearDown(self) 45 test_util.TestBase.tearDown(self)
46 46
66 {'branch': 'default',}) 66 {'branch': 'default',})
67 new_hash = repo.commitctx(ctx) 67 new_hash = repo.commitctx(ctx)
68 if not commit: 68 if not commit:
69 return # some tests use this test as an extended setup. 69 return # some tests use this test as an extended setup.
70 hg.update(repo, repo['tip'].node()) 70 hg.update(repo, repo['tip'].node())
71 svncommands.push(ui.ui(), repo=self.repo, hg_repo_path=self.wc_path, 71 oldauthor = repo['tip'].user()
72 svn_url='svn://localhost/') 72 wrappers.push(None, ui.ui(), repo=self.repo)
73 tip = self.repo['tip'] 73 tip = self.repo['tip']
74 self.assertNotEqual(oldauthor, tip.user())
74 self.assertNotEqual(tip.node(), old_tip) 75 self.assertNotEqual(tip.node(), old_tip)
75 self.assertEqual(tip.parents()[0].node(), expected_parent) 76 self.assertEqual(tip.parents()[0].node(), expected_parent)
76 self.assertEqual(tip['adding_file'].data(), 'foo') 77 self.assertEqual(tip['adding_file'].data(), 'foo')
77 self.assertEqual(tip.branch(), 'default') 78 self.assertEqual(tip.branch(), 'default')
78 79
168 '2008-12-21 16:32:00 -0500', 169 '2008-12-21 16:32:00 -0500',
169 {'branch': 'localbranch', }) 170 {'branch': 'localbranch', })
170 newhash = self.repo.commitctx(ctx) 171 newhash = self.repo.commitctx(ctx)
171 repo = self.repo 172 repo = self.repo
172 hg.update(repo, newhash) 173 hg.update(repo, newhash)
173 svncommands.push(ui.ui(), repo=repo, 174 wrappers.push(None, ui.ui(), repo=repo)
174 svn_url=test_util.fileurl(self.repo_path),
175 hg_repo_path=self.wc_path)
176 self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash) 175 self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash)
177 self.assertEqual(self.repo['tip'].files(), ['delta', ]) 176 self.assertEqual(self.repo['tip'].files(), ['delta', ])
178 self.assertEqual(self.repo['tip'].manifest().keys(), 177 self.assertEqual(self.repo['tip'].manifest().keys(),
179 ['alpha', 'beta', 'gamma', 'delta']) 178 ['alpha', 'beta', 'gamma', 'delta'])
180 179
283 file_callback, 282 file_callback,
284 'author', 283 'author',
285 '2008-10-29 21:26:00 -0500', 284 '2008-10-29 21:26:00 -0500',
286 {'branch': 'default', }) 285 {'branch': 'default', })
287 new_hash = repo.commitctx(ctx) 286 new_hash = repo.commitctx(ctx)
288 hg.update(repo, repo['tip'].node()) 287 hg.clean(repo, repo['tip'].node())
289 self.pushrevisions() 288 self.pushrevisions()
290 tip = self.repo['tip'] 289 tip = self.repo['tip']
291 self.assertNotEqual(tip.node(), new_hash) 290 self.assertNotEqual(tip.node(), new_hash)
292 self.assert_('@' in tip.user()) 291 self.assert_('@' in self.repo['tip'].user())
293 self.assertEqual(tip['gamma'].flags(), 'x') 292 self.assertEqual(tip['gamma'].flags(), 'x')
294 self.assertEqual(tip['gamma'].data(), 'foo') 293 self.assertEqual(tip['gamma'].data(), 'foo')
295 self.assertEqual([x for x in tip.manifest().keys() if 'x' not in 294 self.assertEqual([x for x in tip.manifest().keys() if 'x' not in
296 tip[x].flags()], ['alpha', 'beta', 'adding_file', ]) 295 tip[x].flags()], ['alpha', 'beta', 'adding_file', ])
297 296