[PATCH 1 of 1] allow clone into existing but empty directories
Steve Borho
steve at borho.org
Sun Mar 29 15:39:28 CDT 2009
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1238358956 18000
# Node ID d33bf06e0d4e54fff29e414aa066b30c89cd4c0c
# Parent 67e59a9886d5902de5b94cd2552d854b6292ec63
allow clone into existing but empty directories
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -131,7 +131,10 @@
source = localpath(source)
if os.path.exists(dest):
- raise util.Abort(_("destination '%s' already exists") % dest)
+ if not os.path.isdir(dest):
+ raise util.Abort(_("destination '%s' already exists") % dest)
+ elif os.listdir(dest):
+ raise util.Abort(_("destination '%s' is not empty") % dest)
class DirCleanup(object):
def __init__(self, dir_):
More information about the Mercurial-devel
mailing list