mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-09 05:24:17 +00:00
merge impignore
This commit is contained in:
@@ -186,13 +186,20 @@ class Importer:
|
|||||||
self.log.dry('would copy {} to {}'.format(dst, srcf))
|
self.log.dry('would copy {} to {}'.format(dst, srcf))
|
||||||
else:
|
else:
|
||||||
# copy the file to the dotpath
|
# copy the file to the dotpath
|
||||||
if os.path.isdir(dst):
|
try:
|
||||||
if os.path.exists(srcf):
|
if os.path.isdir(dst):
|
||||||
shutil.rmtree(srcf)
|
if os.path.exists(srcf):
|
||||||
shutil.copytree(dst, srcf, copy_function=self._cp,
|
shutil.rmtree(srcf)
|
||||||
ignore=shutil.ignore_patterns(*self.ignore))
|
ig = shutil.ignore_patterns(*self.ignore)
|
||||||
else:
|
shutil.copytree(dst, srcf,
|
||||||
shutil.copy2(dst, srcf)
|
copy_function=self._cp,
|
||||||
|
ignore=ig)
|
||||||
|
else:
|
||||||
|
shutil.copy2(dst, srcf)
|
||||||
|
except shutil.Error as e:
|
||||||
|
src = e.args[0][0][0]
|
||||||
|
why = e.args[0][0][2]
|
||||||
|
self.log.err('importing \"{}\" failed: {}'.format(src, why))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,35 @@ cntpost=`find ${tmps}/dotfiles -type f | wc -l`
|
|||||||
|
|
||||||
[ "${cntpost}" != "${cntpre}" ] && echo "import issue" && exit 1
|
[ "${cntpost}" != "${cntpre}" ] && echo "import issue" && exit 1
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# import directory with named pipe
|
||||||
|
|
||||||
|
cat > ${cfg} << _EOF
|
||||||
|
config:
|
||||||
|
backup: true
|
||||||
|
create: true
|
||||||
|
dotpath: dotfiles
|
||||||
|
dotfiles:
|
||||||
|
profiles:
|
||||||
|
_EOF
|
||||||
|
|
||||||
|
# create the dotfile
|
||||||
|
d="${tmpd}/with_named_pipe"
|
||||||
|
mkdir -p ${d}
|
||||||
|
echo "file1" > ${d}/file1
|
||||||
|
echo "fil2" > ${d}/file2
|
||||||
|
mkfifo ${d}/fifo
|
||||||
|
|
||||||
|
# import
|
||||||
|
cd ${ddpath} | ${bin} import -c ${cfg} -p p2 -V ${d}
|
||||||
|
|
||||||
|
# ensure exists and is not link
|
||||||
|
[ ! -d ${tmps}/dotfiles/${d} ] && echo "not a directory" && exit 1
|
||||||
|
[ ! -e ${tmps}/dotfiles/${d}/file1 ] && echo "not exist" && exit 1
|
||||||
|
[ ! -e ${tmps}/dotfiles/${d}/file2 ] && echo "not exist" && exit 1
|
||||||
|
|
||||||
|
cat ${cfg} | grep ${d} >/dev/null 2>&1
|
||||||
|
|
||||||
## CLEANING
|
## CLEANING
|
||||||
rm -rf ${tmps} ${tmpd}
|
rm -rf ${tmps} ${tmpd}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user