From 2522c6d386749f1deb3229a1eaf9e9e13dcc76ae Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sun, 10 Mar 2019 18:18:45 +0100 Subject: [PATCH] be more verbose when updating (#101) --- dotdrop/updater.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dotdrop/updater.py b/dotdrop/updater.py index 96d6a87..c2ceff4 100644 --- a/dotdrop/updater.py +++ b/dotdrop/updater.py @@ -79,6 +79,7 @@ class Updater: dtpath = os.path.expanduser(dtpath) if self._ignore([path, dtpath]): + self.log.sub('{} ignored'.format(dotfile.key)) return True if dotfile.trans_w: # apply write transformation if any @@ -173,6 +174,7 @@ class Updater: def _handle_file(self, path, dtpath, compare=True): """sync path (deployed file) and dtpath (dotdrop dotfile path)""" if self._ignore([path, dtpath]): + self.log.sub('{} ignored'.format(dtpath)) return True if self.debug: self.log.dbg('update for file {} and {}'.format(path, dtpath)) @@ -197,6 +199,7 @@ class Updater: if self.debug: self.log.dbg('cp {} {}'.format(path, dtpath)) shutil.copyfile(path, dtpath) + self.log.sub('{} updated'.format(dtpath)) except IOError as e: self.log.warn('{} update failed, do manually: {}'.format(path, e)) return False @@ -210,6 +213,7 @@ class Updater: path = os.path.expanduser(path) dtpath = os.path.expanduser(dtpath) if self._ignore([path, dtpath]): + self.log.sub('{} ignored'.format(dtpath)) return True # find the differences diff = filecmp.dircmp(path, dtpath, ignore=None) @@ -233,6 +237,7 @@ class Updater: # match to dotdrop dotpath new = os.path.join(right, toadd) if self._ignore([exist, new]): + self.log.sub('{} ignored'.format(exist)) continue if self.dry: self.log.dry('would cp -r {} {}'.format(exist, new)) @@ -241,6 +246,7 @@ class Updater: self.log.dbg('cp -r {} {}'.format(exist, new)) # Newly created directory should be copied as is (for efficiency). shutil.copytree(exist, new) + self.log.sub('{} updated'.format(exist)) # remove dirs that don't exist in deployed version for toremove in diff.right_only: @@ -258,6 +264,7 @@ class Updater: if not self._confirm_rm_r(old): continue utils.remove(old) + self.log.sub('{} removed'.format(old)) # handle files diff # sync files that exist in both but are different @@ -291,6 +298,7 @@ class Updater: if self.debug: self.log.dbg('cp {} {}'.format(exist, new)) shutil.copyfile(exist, new) + self.log.sub('{} added'.format(exist)) # remove files that don't exist in deployed version for toremove in diff.right_only: @@ -308,6 +316,7 @@ class Updater: if self.debug: self.log.dbg('rm {}'.format(new)) utils.remove(new) + self.log.sub('{} removed'.format(new)) # Recursively decent into common subdirectories. for subdir in diff.subdirs.values():