# HG changeset patch # User Patrick Mezard # Date 1247967873 18000 # Node ID db3a53a2cd76a5c5e47908a9dc90742b8695321e # Parent ff69f18550866e6a06324e2aea7f06ccbcfe910c wrappers: make push aborts if uncommitted changes diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -112,6 +112,7 @@ def push(repo, dest, force, revs): """push revisions starting at a specified head back to Subversion. """ assert not revs, 'designated revisions for push remains unimplemented.' + cmdutil.bail_if_changed(repo) ui = repo.ui svnurl = util.normalize_url(repo.ui.expandpath(dest.svnurl)) old_encoding = util.swap_out_encoding() diff --git a/tests/test_push_command.py b/tests/test_push_command.py --- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -50,6 +50,31 @@ class PushTests(test_util.TestBase): tip = self.repo['tip'] self.assertEqual(tip.node(), old_tip) + def test_cant_push_with_changes(self): + repo = self.repo + def file_callback(repo, memctx, path): + return context.memfilectx( + path=path, data='foo', islink=False, + isexec=False, copied=False) + ctx = context.memctx(repo, + (repo['default'].node(), node.nullid), + 'automated test', + ['adding_file'], + file_callback, + 'an_author', + '2008-10-07 20:59:48 -0500', + {'branch': 'default',}) + new_hash = repo.commitctx(ctx) + hg.update(repo, repo['tip'].node()) + # Touch an existing file + repo.wwrite('beta', 'something else', '') + try: + self.pushrevisions() + except hgutil.Abort: + pass + tip = self.repo['tip'] + self.assertEqual(new_hash, tip.node()) + def test_push_over_svnserve(self, commit=True): test_util.load_svndump_fixture(self.repo_path, 'simple_branch.svndump') open(os.path.join(self.repo_path, 'conf', 'svnserve.conf'),