Mercurial > hgsubversion
changeset 461:db3a53a2cd76
wrappers: make push aborts if uncommitted changes
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 18 Jul 2009 20:44:33 -0500 |
parents | ff69f1855086 |
children | e43e4d506e4d |
files | hgsubversion/wrappers.py tests/test_push_command.py |
diffstat | 2 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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()
--- 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'),