[PATCH 6 of 7] util.copyfiles: add optional ignore parameter
Angel Ezquerra
angel.ezquerra at gmail.com
Tue Nov 24 18:22:30 CST 2015
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1448234511 -3600
# Mon Nov 23 00:21:51 2015 +0100
# Node ID 842eee140028656f82d3d05ca3cdc68677a4ce39
# Parent ec9de3a84179e1e3531d784b1f15d988a33f5455
util.copyfiles: add optional ignore parameter
Make it possible to specify a list of files that will not be copied.
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -800,7 +800,7 @@
raise Abort(str(inst))
def copyfiles(src, dst, hardlink=None, progress=lambda t, pos: None,
- overwrite=True):
+ overwrite=True, ignore=None):
"""Copy a directory tree using hardlinks if possible."""
num = 0
@@ -812,7 +812,9 @@
else:
topic = _('copying')
- if os.path.isdir(src):
+ if ignore and src in ignore:
+ pass
+ elif os.path.isdir(src):
if not os.path.exists(dst):
os.mkdir(dst)
for name, kind in osutil.listdir(src):
@@ -822,7 +824,7 @@
if pos is not None:
return progress(t, pos + num)
hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog,
- overwrite=overwrite)
+ overwrite=overwrite, ignore=ignore)
num += n
elif not overwrite and os.path.exists(dst):
pass
More information about the Mercurial-devel
mailing list