diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -127,12 +127,7 @@ def clone(ui, source, dest=None, pull=Fa if self.dir_: self.rmtree(self.dir_, True) - dest_repo = None - try: - dest_repo = repository(ui, dest) - raise util.Abort(_("destination '%s' already exists." % dest)) - except RepoError: - dest_repo = repository(ui, dest, create=True) + dest_repo = repository(ui, dest, create=True) dest_path = None dir_cleanup = None diff --git a/tests/test-init b/tests/test-init --- a/tests/test-init +++ b/tests/test-init @@ -27,6 +27,9 @@ hg init local echo this > local/foo hg ci --cwd local -A -m "init" -d "1000000 0" +echo "#test failure" +hg init local + echo "# init+push to remote2" hg init -e ./dummyssh ssh://user@dummy/remote2 hg incoming -R remote2 local @@ -35,6 +38,12 @@ hg push -R local -e ./dummyssh ssh://use echo "# clone to remote1" hg clone -e ./dummyssh local ssh://user@dummy/remote1 +echo "# init to existing repo" +hg init -e ./dummyssh ssh://user@dummy/remote1 + +echo "# clone to existing repo" +hg clone -e ./dummyssh local ssh://user@dummy/remote1 + echo "# output of dummyssh" cat dummylog diff --git a/tests/test-init.out b/tests/test-init.out --- a/tests/test-init.out +++ b/tests/test-init.out @@ -1,5 +1,7 @@ # creating 'local' adding foo +#test failure +abort: repository local already exists! # init+push to remote2 remote: abort: repository remote2 not found! changeset: 0:c4e059d443be @@ -17,19 +19,23 @@ remote: added 1 changesets with 1 change # clone to remote1 remote: abort: repository remote1 not found! searching for changes -remote: abort: repository remote1 not found! remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files +# init to existing repo +abort: repository ssh://user@dummy/remote1 already exists! +# clone to existing repo +abort: repository ssh://user@dummy/remote1 already exists! # output of dummyssh Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: Got arguments 1:user@dummy 2:hg init remote2 3: 4: 5: Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio 3: 4: 5: Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5: +Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5: Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5: -Got arguments 1:user@dummy 2:hg init remote1 3: 4: 5: +Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5: Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio 3: 4: 5: # comparing repositories 0:c4e059d443be