mercurial/commands.py
changeset 532 2e9698a5c92c
parent 528 648386fabf9c
child 534 ab0d1bfeee7c
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -273,9 +273,10 @@ def clone(ui, source, dest = None, **opt
 
     if dest is None:
         dest = os.path.basename(os.path.normpath(source))
-        if dest == source:
-            ui.warn('abort: source and destination are the same\n')
-            sys.exit(1)
+
+    if os.path.exists(dest):
+        ui.warn("abort: destination '%s' already exists\n" % dest)
+        return 1
 
     os.mkdir(dest)