comparison tests/test_push_command.py @ 1321:a36e87ae2380

tests: always compare manifest keys in sorted order Not comparing sorted lists was probably always a mistake, but it became an actual failure when upstream Mercurial changed to using lazymanifest, which always returns keys in sorted order.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 27 Mar 2015 16:44:05 -0700
parents f96e2495de39
children 945700dac237
comparison
equal deleted inserted replaced
1320:2061fd988f3f 1321:a36e87ae2380
265 repo = self.repo 265 repo = self.repo
266 hg.update(repo, newhash) 266 hg.update(repo, newhash)
267 commands.push(repo.ui, repo) 267 commands.push(repo.ui, repo)
268 self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash) 268 self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash)
269 self.assertEqual(self.repo['tip'].files(), ['delta', ]) 269 self.assertEqual(self.repo['tip'].files(), ['delta', ])
270 self.assertEqual(self.repo['tip'].manifest().keys(), 270 self.assertEqual(sorted(self.repo['tip'].manifest().keys()),
271 ['alpha', 'beta', 'gamma', 'delta']) 271 ['alpha', 'beta', 'delta', 'gamma'])
272 272
273 def test_push_two_revs(self): 273 def test_push_two_revs(self):
274 # set up some work for us 274 # set up some work for us
275 self.test_push_to_default(commit=False) 275 self.test_push_to_default(commit=False)
276 repo = self.repo 276 repo = self.repo
417 tip = self.repo['tip'] 417 tip = self.repo['tip']
418 self.assertNotEqual(tip.node(), new_hash) 418 self.assertNotEqual(tip.node(), new_hash)
419 self.assert_('@' in self.repo['tip'].user()) 419 self.assert_('@' in self.repo['tip'].user())
420 self.assertEqual(tip['gamma'].flags(), 'x') 420 self.assertEqual(tip['gamma'].flags(), 'x')
421 self.assertEqual(tip['gamma'].data(), 'foo') 421 self.assertEqual(tip['gamma'].data(), 'foo')
422 self.assertEqual([x for x in tip.manifest().keys() if 'x' not in 422 self.assertEqual(sorted([x for x in tip.manifest().keys() if 'x' not in
423 tip[x].flags()], ['alpha', 'beta', 'adding_file', ]) 423 tip[x].flags()]),
424 ['adding_file', 'alpha', 'beta', ])
424 425
425 def test_push_symlink_file(self): 426 def test_push_symlink_file(self):
426 self.test_push_to_default(commit=True) 427 self.test_push_to_default(commit=True)
427 repo = self.repo 428 repo = self.repo
428 def file_callback(repo, memctx, path): 429 def file_callback(repo, memctx, path):
449 repo = self.repo 450 repo = self.repo
450 tip = repo['tip'] 451 tip = repo['tip']
451 self.assertNotEqual(tip.node(), new_hash) 452 self.assertNotEqual(tip.node(), new_hash)
452 self.assertEqual(tip['gamma'].flags(), 'l') 453 self.assertEqual(tip['gamma'].flags(), 'l')
453 self.assertEqual(tip['gamma'].data(), 'foo') 454 self.assertEqual(tip['gamma'].data(), 'foo')
454 self.assertEqual([x for x in tip.manifest().keys() if 'l' not in 455 self.assertEqual(sorted([x for x in tip.manifest().keys() if 'l' not in
455 tip[x].flags()], ['alpha', 'beta', 'adding_file', ]) 456 tip[x].flags()]),
457 ['adding_file', 'alpha', 'beta', ])
456 458
457 def file_callback2(repo, memctx, path): 459 def file_callback2(repo, memctx, path):
458 if path == 'gamma': 460 if path == 'gamma':
459 return compathacks.makememfilectx(repo, 461 return compathacks.makememfilectx(repo,
460 path=path, 462 path=path,
634 ('beta', None, None), 636 ('beta', None, None),
635 ] 637 ]
636 parent = self.repo['tip'].rev() 638 parent = self.repo['tip'].rev()
637 self.commitchanges(changes, parent=parent) 639 self.commitchanges(changes, parent=parent)
638 self.pushrevisions() 640 self.pushrevisions()
639 self.assertEqual({}, self.repo['tip'].manifest()) 641 self.assertEqual(len(self.repo['tip'].manifest()), 0)
640 642
641 # Try to re-add a file after emptying the branch 643 # Try to re-add a file after emptying the branch
642 changes = [ 644 changes = [
643 ('alpha', 'alpha', 'alpha'), 645 ('alpha', 'alpha', 'alpha'),
644 ] 646 ]