comparison tests/test_push_command.py @ 1036:e775ffbcb359

push: also suggest user rebase if we get SVN_ERR_FS_ALREADY_EXISTS Subversion differentiates adding an already-added file from transaction being out of date and edit conflicts. Fixes #400.
author Augie Fackler <raf@durin42.com>
date Tue, 16 Jul 2013 10:09:55 -0400
parents 110794582448
children ada2400241c4
comparison
equal deleted inserted replaced
1035:2c64453f98a7 1036:e775ffbcb359
45 {'branch': 'default', }) 45 {'branch': 'default', })
46 new_hash = repo.commitctx(ctx) 46 new_hash = repo.commitctx(ctx)
47 hg.update(repo, repo['tip'].node()) 47 hg.update(repo, repo['tip'].node())
48 old_tip = repo['tip'].node() 48 old_tip = repo['tip'].node()
49 self.pushrevisions() 49 self.pushrevisions()
50 tip = self.repo['tip']
51 self.assertEqual(tip.node(), old_tip)
52
53 def test_push_add_of_added_upstream_gives_sane_error(self):
54 repo = self.repo
55 def file_callback(repo, memctx, path):
56 if path == 'adding_file':
57 return context.memfilectx(path=path,
58 data='foo',
59 islink=False,
60 isexec=False,
61 copied=False)
62 raise IOError()
63 p1 = repo['default'].node()
64 ctx = context.memctx(repo,
65 (p1, node.nullid),
66 'automated test',
67 ['adding_file'],
68 file_callback,
69 'an_author',
70 '2008-10-07 20:59:48 -0500',
71 {'branch': 'default', })
72 new_hash = repo.commitctx(ctx)
73 hg.update(repo, repo['tip'].node())
74 old_tip = repo['tip'].node()
75 self.pushrevisions()
76 tip = self.repo['tip']
77 self.assertNotEqual(tip.node(), old_tip)
78
79 # This node adds the same file as the first one we added, and
80 # will be refused by the server for adding a file that already
81 # exists. We should respond with an error suggesting the user
82 # rebase.
83 ctx = context.memctx(repo,
84 (p1, node.nullid),
85 'automated test',
86 ['adding_file'],
87 file_callback,
88 'an_author',
89 '2008-10-07 20:59:48 -0500',
90 {'branch': 'default', })
91 new_hash = repo.commitctx(ctx)
92 hg.update(repo, repo['tip'].node())
93 old_tip = repo['tip'].node()
94 try:
95 self.pushrevisions()
96 except hgutil.Abort, e:
97 assert "pull again and rebase" in str(e)
50 tip = self.repo['tip'] 98 tip = self.repo['tip']
51 self.assertEqual(tip.node(), old_tip) 99 self.assertEqual(tip.node(), old_tip)
52 100
53 def test_cant_push_with_changes(self): 101 def test_cant_push_with_changes(self):
54 repo = self.repo 102 repo = self.repo