Mercurial > hgsubversion
comparison tests/test_push_command.py @ 1555:cff81f35b31e
cleanup: reference Abort from mercurial.error instead of mercurial.util
It's been there since hg 1.7 or so, which lets us avoid any need for
compat shims.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Sat, 24 Mar 2018 16:39:30 -0400 |
parents | 8410a978c650 |
children | d55c9d0ba350 |
comparison
equal
deleted
inserted
replaced
1554:258fb67fb956 | 1555:cff81f35b31e |
---|---|
10 import subprocess | 10 import subprocess |
11 import unittest | 11 import unittest |
12 | 12 |
13 from mercurial import context | 13 from mercurial import context |
14 from mercurial import commands | 14 from mercurial import commands |
15 from mercurial import error as hgerror | |
15 from mercurial import hg | 16 from mercurial import hg |
16 from mercurial import node | 17 from mercurial import node |
17 from mercurial import revlog | 18 from mercurial import revlog |
18 from mercurial import util as hgutil | 19 from mercurial import util as hgutil |
19 | 20 |
100 new_hash = repo.commitctx(ctx) | 101 new_hash = repo.commitctx(ctx) |
101 hg.update(repo, repo['tip'].node()) | 102 hg.update(repo, repo['tip'].node()) |
102 old_tip = repo['tip'].node() | 103 old_tip = repo['tip'].node() |
103 try: | 104 try: |
104 self.pushrevisions() | 105 self.pushrevisions() |
105 except hgutil.Abort, e: | 106 except hgerror.Abort, e: |
106 assert "pull again and rebase" in str(e) | 107 assert "pull again and rebase" in str(e) |
107 tip = self.repo['tip'] | 108 tip = self.repo['tip'] |
108 self.assertEqual(tip.node(), old_tip) | 109 self.assertEqual(tip.node(), old_tip) |
109 | 110 |
110 def test_cant_push_with_changes(self): | 111 def test_cant_push_with_changes(self): |
129 hg.update(repo, repo['tip'].node()) | 130 hg.update(repo, repo['tip'].node()) |
130 # Touch an existing file | 131 # Touch an existing file |
131 repo.wwrite('beta', 'something else', '') | 132 repo.wwrite('beta', 'something else', '') |
132 try: | 133 try: |
133 self.pushrevisions() | 134 self.pushrevisions() |
134 except hgutil.Abort: | 135 except hgerror.Abort: |
135 pass | 136 pass |
136 tip = self.repo['tip'] | 137 tip = self.repo['tip'] |
137 self.assertEqual(new_hash, tip.node()) | 138 self.assertEqual(new_hash, tip.node()) |
138 | 139 |
139 def internal_push_over_svnserve(self, subdir='', commit=True): | 140 def internal_push_over_svnserve(self, subdir='', commit=True): |
655 ] | 656 ] |
656 self.commitchanges(changes, parent=par) | 657 self.commitchanges(changes, parent=par) |
657 try: | 658 try: |
658 self.pushrevisions() | 659 self.pushrevisions() |
659 assert False, 'This should have aborted!' | 660 assert False, 'This should have aborted!' |
660 except hgutil.Abort, e: | 661 except hgerror.Abort, e: |
661 self.assertEqual(e.args[0], | 662 self.assertEqual(e.args[0], |
662 'Outgoing changesets parent is not at subversion ' | 663 'Outgoing changesets parent is not at subversion ' |
663 'HEAD\n' | 664 'HEAD\n' |
664 '(pull again and rebase on a newer revision)') | 665 '(pull again and rebase on a newer revision)') |
665 # verify that any pending transactions on the server got cleaned up | 666 # verify that any pending transactions on the server got cleaned up |