comparison tests/test_push_command.py @ 990:def2144c0a8c

push: rebase one at a time before push Previously when pushing n commits, push would rebase n, commit 1, rebase n-1, commit 1, rebase n-2, etc. This caused push to be very slow on large repositories. Pushing 10 commits on our repo took 75 seconds per commit, and that grew at n^2 with the number of commits being pushed. This changes push to rebase each commit individually. Now pushing 10 commits on our repo takes 25 seconds per commit, and is constant relative to the number of commits being pushed.
author Durham Goode <durham@fb.com>
date Wed, 02 Jan 2013 17:51:07 -0800
parents 8417be758047
children 26e9fd21f3bf
comparison
equal deleted inserted replaced
989:68191be64af8 990:def2144c0a8c
520 ] 520 ]
521 self.commitchanges(changes, parent=self.repo['tip'].rev()) 521 self.commitchanges(changes, parent=self.repo['tip'].rev())
522 self.pushrevisions() 522 self.pushrevisions()
523 self.assertEqual(['alpha'], list(self.repo['tip'].manifest())) 523 self.assertEqual(['alpha'], list(self.repo['tip'].manifest()))
524 524
525 def test_push_without_pushing_children(self):
526 '''
527 Verify that a push of a nontip node, keeps the tip child
528 on top of the pushed commit.
529 '''
530
531 oldlen = len(self.repo)
532 oldtiphash = self.repo['default'].node()
533
534 changes = [('gamma', 'gamma', 'sometext')]
535 newhash1 = self.commitchanges(changes)
536
537 changes = [('delta', 'delta', 'sometext')]
538 newhash2 = self.commitchanges(changes)
539
540 # push only the first commit
541 repo = self.repo
542 hg.update(repo, newhash1)
543 commands.push(repo.ui, repo)
544 self.assertEqual(len(self.repo), oldlen + 2)
545
546 # verify that the first commit is pushed, and the second is not
547 commit2 = self.repo['tip']
548 self.assertEqual(commit2.files(), ['delta', ])
549 self.assertTrue(commit2.mutable())
550 commit1 = commit2.parents()[0]
551 self.assertEqual(commit1.files(), ['gamma', ])
552 self.assertFalse(commit1.mutable())
553
554
525 def suite(): 555 def suite():
526 test_classes = [PushTests, ] 556 test_classes = [PushTests, ]
527 all_tests = [] 557 all_tests = []
528 # This is the quickest hack I could come up with to load all the tests from 558 # This is the quickest hack I could come up with to load all the tests from
529 # both classes. Would love a patch that simplifies this without adding 559 # both classes. Would love a patch that simplifies this without adding