Mercurial > hgsubversion
comparison tests/test_push_command.py @ 1236:f367a4462191
push: update to branch tip instead of tip
We previously updated to the repository tip after pushing a revision,
presumably on the assumption that tip would be the last revision we
just pushed. This assumption is flawed for high traffic repositories.
In particular, you previsouly would sometimes end up on a completley
unrelated commit if someone else commits to a different branch in
between the time we push a revision and pull it back from the server.
This changes to instead update to the branch tip of the branch we were
on at the beginning of the push. This should be either the revision
we just pushed or a linear descendent of the revision we just pushed,
with a fair degree of reliability.
author | David Schleimer <dschleimer@fb.com> |
---|---|
date | Sat, 30 Aug 2014 09:23:31 -0700 |
parents | 5c2917375961 |
children | f96e2495de39 |
comparison
equal
deleted
inserted
replaced
1235:6b15eeb78c1a | 1236:f367a4462191 |
---|---|
752 self.assertNotEqual(tip.node(), old_tip) | 752 self.assertNotEqual(tip.node(), old_tip) |
753 self.assertEqual(p, os.getcwd()) | 753 self.assertEqual(p, os.getcwd()) |
754 self.assertEqual(tip['adding_file'].data(), 'fooFirstFile') | 754 self.assertEqual(tip['adding_file'].data(), 'fooFirstFile') |
755 self.assertEqual(tip['newdir/new_file'].data(), 'fooNewFile') | 755 self.assertEqual(tip['newdir/new_file'].data(), 'fooNewFile') |
756 self.assertEqual(tip.branch(), 'default') | 756 self.assertEqual(tip.branch(), 'default') |
757 | |
758 def test_update_after_push(self): | |
759 repo = self.repo | |
760 ui = repo.ui | |
761 | |
762 ui.setconfig('hooks', | |
763 'debug-hgsubversion-between-push-and-pull-for-tests', | |
764 lambda ui, repo, hooktype: self.add_svn_rev( | |
765 self.repo_path, | |
766 {'trunk/racey_file': 'race conditions suck'})) | |
767 | |
768 self.test_push_to_branch(push=False) | |
769 commands.push(ui, repo) | |
770 newctx = self.repo['.'] | |
771 self.assertNotEqual(newctx.node(), self.repo['tip'].node()) | |
772 self.assertEqual(newctx['adding_file'].data(), 'foo') | |
773 self.assertEqual(newctx.branch(), 'the_branch') |