comparison tests/test_push_command.py @ 851:9ce00cb1d676

Merge alternate tunnel schemes.
author Augie Fackler <durin42@gmail.com>
date Sat, 25 Feb 2012 14:51:22 -0600
parents 27a2136e89cd
children 50a09999dce3
comparison
equal deleted inserted replaced
850:d3bc067c0f72 851:9ce00cb1d676
41 'automated test', 41 'automated test',
42 [], 42 [],
43 file_callback, 43 file_callback,
44 'an_author', 44 'an_author',
45 '2008-10-07 20:59:48 -0500', 45 '2008-10-07 20:59:48 -0500',
46 {'branch': 'default',}) 46 {'branch': 'default', })
47 new_hash = repo.commitctx(ctx) 47 new_hash = repo.commitctx(ctx)
48 hg.update(repo, repo['tip'].node()) 48 hg.update(repo, repo['tip'].node())
49 old_tip = repo['tip'].node() 49 old_tip = repo['tip'].node()
50 self.pushrevisions() 50 self.pushrevisions()
51 tip = self.repo['tip'] 51 tip = self.repo['tip']
62 'automated test', 62 'automated test',
63 ['adding_file'], 63 ['adding_file'],
64 file_callback, 64 file_callback,
65 'an_author', 65 'an_author',
66 '2008-10-07 20:59:48 -0500', 66 '2008-10-07 20:59:48 -0500',
67 {'branch': 'default',}) 67 {'branch': 'default', })
68 new_hash = repo.commitctx(ctx) 68 new_hash = repo.commitctx(ctx)
69 hg.update(repo, repo['tip'].node()) 69 hg.update(repo, repo['tip'].node())
70 # Touch an existing file 70 # Touch an existing file
71 repo.wwrite('beta', 'something else', '') 71 repo.wwrite('beta', 'something else', '')
72 try: 72 try:
114 text='automated test', 114 text='automated test',
115 files=['adding_file'], 115 files=['adding_file'],
116 filectxfn=file_callback, 116 filectxfn=file_callback,
117 user='an_author', 117 user='an_author',
118 date='2008-10-07 20:59:48 -0500', 118 date='2008-10-07 20:59:48 -0500',
119 extra={'branch': 'default',}) 119 extra={'branch': 'default', })
120 new_hash = repo.commitctx(ctx) 120 new_hash = repo.commitctx(ctx)
121 if not commit: 121 if not commit:
122 return # some tests use this test as an extended setup. 122 return # some tests use this test as an extended setup.
123 hg.update(repo, repo['tip'].node()) 123 hg.update(repo, repo['tip'].node())
124 oldauthor = repo['tip'].user() 124 oldauthor = repo['tip'].user()
159 'automated test', 159 'automated test',
160 ['adding_file'], 160 ['adding_file'],
161 file_callback, 161 file_callback,
162 'an_author', 162 'an_author',
163 '2008-10-07 20:59:48 -0500', 163 '2008-10-07 20:59:48 -0500',
164 {'branch': 'default',}) 164 {'branch': 'default', })
165 new_hash = repo.commitctx(ctx) 165 new_hash = repo.commitctx(ctx)
166 if not commit: 166 if not commit:
167 return # some tests use this test as an extended setup. 167 return # some tests use this test as an extended setup.
168 hg.update(repo, repo['tip'].node()) 168 hg.update(repo, repo['tip'].node())
169 self.pushrevisions() 169 self.pushrevisions()
181 islink=False, 181 islink=False,
182 isexec=False, 182 isexec=False,
183 copied=False) 183 copied=False)
184 oldtiphash = self.repo['default'].node() 184 oldtiphash = self.repo['default'].node()
185 ctx = context.memctx(self.repo, 185 ctx = context.memctx(self.repo,
186 (self.repo[0].node(), revlog.nullid, ), 186 (self.repo[0].node(), revlog.nullid,),
187 'automated test', 187 'automated test',
188 ['gamma', ], 188 ['gamma', ],
189 filectxfn, 189 filectxfn,
190 'testy', 190 'testy',
191 '2008-12-21 16:32:00 -0500', 191 '2008-12-21 16:32:00 -0500',
227 'automated test', 227 'automated test',
228 ['adding_file2'], 228 ['adding_file2'],
229 file_callback, 229 file_callback,
230 'an_author', 230 'an_author',
231 '2008-10-07 20:59:48 -0500', 231 '2008-10-07 20:59:48 -0500',
232 {'branch': 'default',}) 232 {'branch': 'default', })
233 new_hash = repo.commitctx(ctx) 233 new_hash = repo.commitctx(ctx)
234 hg.update(repo, repo['tip'].node()) 234 hg.update(repo, repo['tip'].node())
235 self.pushrevisions() 235 self.pushrevisions()
236 tip = self.repo['tip'] 236 tip = self.repo['tip']
237 self.assertNotEqual(tip.node(), old_tip) 237 self.assertNotEqual(tip.node(), old_tip)
262 'automated test', 262 'automated test',
263 ['adding_file'], 263 ['adding_file'],
264 file_callback, 264 file_callback,
265 'an_author', 265 'an_author',
266 '2008-10-07 20:59:48 -0500', 266 '2008-10-07 20:59:48 -0500',
267 {'branch': 'the_branch',}) 267 {'branch': 'the_branch', })
268 new_hash = repo.commitctx(ctx) 268 new_hash = repo.commitctx(ctx)
269 hg.update(repo, repo['tip'].node()) 269 hg.update(repo, repo['tip'].node())
270 if push: 270 if push:
271 self.pushrevisions() 271 self.pushrevisions()
272 tip = self.repo['tip'] 272 tip = self.repo['tip']
289 oldf = open(os.path.join(self.wc_path, '.hg', 'hgrc'), 'w') 289 oldf = open(os.path.join(self.wc_path, '.hg', 'hgrc'), 'w')
290 oldf.write(hgrc) 290 oldf.write(hgrc)
291 oldf.close() 291 oldf.close()
292 292
293 # do a commit here 293 # do a commit here
294 self.commitchanges([('foobaz', 'foobaz', 'This file is added on default.', ), 294 self.commitchanges([('foobaz', 'foobaz', 'This file is added on default.',),
295 ], 295 ],
296 parent='default', 296 parent='default',
297 message='commit to default') 297 message='commit to default')
298 from hgsubversion import svncommands 298 from hgsubversion import svncommands
299 svncommands.rebuildmeta(u, 299 svncommands.rebuildmeta(u,
467 self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags) 467 self.assertEqual(tip.parents()[0]['alpha'].flags(), expected_flags)
468 self.assertEqual(tip['alpha'].flags(), '') 468 self.assertEqual(tip['alpha'].flags(), '')
469 469
470 def test_push_outdated_base_text(self): 470 def test_push_outdated_base_text(self):
471 self.test_push_two_revs() 471 self.test_push_two_revs()
472 changes = [('adding_file', 'adding_file', 'different_content', ), 472 changes = [('adding_file', 'adding_file', 'different_content',),
473 ] 473 ]
474 par = self.repo['tip'].rev() 474 par = self.repo['tip'].rev()
475 self.commitchanges(changes, parent=par) 475 self.commitchanges(changes, parent=par)
476 self.pushrevisions() 476 self.pushrevisions()
477 changes = [('adding_file', 'adding_file', 477 changes = [('adding_file', 'adding_file',
478 'even_more different_content', ), 478 'even_more different_content',),
479 ] 479 ]
480 self.commitchanges(changes, parent=par) 480 self.commitchanges(changes, parent=par)
481 try: 481 try:
482 self.pushrevisions() 482 self.pushrevisions()
483 assert False, 'This should have aborted!' 483 assert False, 'This should have aborted!'
488 '(pull again and rebase on a newer revision)') 488 '(pull again and rebase on a newer revision)')
489 489
490 490
491 def suite(): 491 def suite():
492 test_classes = [PushTests, ] 492 test_classes = [PushTests, ]
493 tests = [] 493 all_tests = []
494 # This is the quickest hack I could come up with to load all the tests from 494 # This is the quickest hack I could come up with to load all the tests from
495 # both classes. Would love a patch that simplifies this without adding 495 # both classes. Would love a patch that simplifies this without adding
496 # dependencies. 496 # dependencies.
497 for tc in test_classes: 497 for tc in test_classes:
498 for attr in dir(tc): 498 for attr in dir(tc):
499 if attr.startswith('test_'): 499 if attr.startswith('test_'):
500 tests.append(tc(attr)) 500 all_tests.append(tc(attr))
501 return unittest.TestSuite(tests) 501 return unittest.TestSuite(all_tests)