mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-15 23:41:12 +00:00
update compare output
This commit is contained in:
@@ -56,11 +56,11 @@ class Comparator:
|
|||||||
for i in comp.left_only:
|
for i in comp.left_only:
|
||||||
if self._ignore([os.path.join(left, i)], ignore):
|
if self._ignore([os.path.join(left, i)], ignore):
|
||||||
continue
|
continue
|
||||||
ret.append('only in left: \"{}\"\n'.format(i))
|
ret.append('=> \"{}\" does not exist on local\n'.format(i))
|
||||||
for i in comp.right_only:
|
for i in comp.right_only:
|
||||||
if self._ignore([os.path.join(right, i)], ignore):
|
if self._ignore([os.path.join(right, i)], ignore):
|
||||||
continue
|
continue
|
||||||
ret.append('only in right: \"{}\"\n'.format(i))
|
ret.append('=> \"{}\" does not exist in dotdrop\n'.format(i))
|
||||||
|
|
||||||
# same left and right but different type
|
# same left and right but different type
|
||||||
funny = comp.common_funny
|
funny = comp.common_funny
|
||||||
@@ -90,7 +90,7 @@ class Comparator:
|
|||||||
if header:
|
if header:
|
||||||
lshort = os.path.basename(left)
|
lshort = os.path.basename(left)
|
||||||
rshort = os.path.basename(right)
|
rshort = os.path.basename(right)
|
||||||
diff = 'diff \"{}\":\n{}'.format(lshort, diff)
|
diff = '=> diff \"{}\":\n{}'.format(lshort, diff)
|
||||||
return diff
|
return diff
|
||||||
|
|
||||||
def _ignore(self, paths, ignore):
|
def _ignore(self, paths, ignore):
|
||||||
|
|||||||
@@ -168,7 +168,10 @@ def cmd_compare(opts, conf, tmp, focus=[], ignore=[]):
|
|||||||
LOG.dbg('comparing {}'.format(dotfile))
|
LOG.dbg('comparing {}'.format(dotfile))
|
||||||
src = dotfile.src
|
src = dotfile.src
|
||||||
if not os.path.lexists(os.path.expanduser(dotfile.dst)):
|
if not os.path.lexists(os.path.expanduser(dotfile.dst)):
|
||||||
LOG.emph('\"{}\" does not exist on local\n'.format(dotfile.dst))
|
line = '=> compare {}: \"{}\" does not exist on local'
|
||||||
|
LOG.log(line.format(dotfile.key, dotfile.dst))
|
||||||
|
same = False
|
||||||
|
continue
|
||||||
|
|
||||||
tmpsrc = None
|
tmpsrc = None
|
||||||
if dotfile.trans_r:
|
if dotfile.trans_r:
|
||||||
@@ -176,12 +179,14 @@ def cmd_compare(opts, conf, tmp, focus=[], ignore=[]):
|
|||||||
tmpsrc = apply_trans(opts, dotfile)
|
tmpsrc = apply_trans(opts, dotfile)
|
||||||
if not tmpsrc:
|
if not tmpsrc:
|
||||||
# could not apply trans
|
# could not apply trans
|
||||||
|
same = False
|
||||||
continue
|
continue
|
||||||
src = tmpsrc
|
src = tmpsrc
|
||||||
# install dotfile to temporary dir
|
# install dotfile to temporary dir
|
||||||
ret, insttmp = inst.install_to_temp(t, tmp, src, dotfile.dst)
|
ret, insttmp = inst.install_to_temp(t, tmp, src, dotfile.dst)
|
||||||
if not ret:
|
if not ret:
|
||||||
# failed to install to tmp
|
# failed to install to tmp
|
||||||
|
same = False
|
||||||
continue
|
continue
|
||||||
ignores = list(set(ignore + dotfile.cmpignore))
|
ignores = list(set(ignore + dotfile.cmpignore))
|
||||||
diff = comp.compare(insttmp, dotfile.dst, ignore=ignores)
|
diff = comp.compare(insttmp, dotfile.dst, ignore=ignores)
|
||||||
@@ -192,12 +197,12 @@ def cmd_compare(opts, conf, tmp, focus=[], ignore=[]):
|
|||||||
remove(tmpsrc)
|
remove(tmpsrc)
|
||||||
if diff == '':
|
if diff == '':
|
||||||
if opts['debug']:
|
if opts['debug']:
|
||||||
LOG.dbg('diffing \"{}\" VS \"{}\"'.format(dotfile.key,
|
line = '=> compare {}: diffing with \"{}\"'
|
||||||
dotfile.dst))
|
LOG.dbg(line.format(dotfile.key, dotfile.dst))
|
||||||
LOG.dbg('same file')
|
LOG.dbg('same file')
|
||||||
else:
|
else:
|
||||||
LOG.log('diffing \"{}\" VS \"{}\"'.format(dotfile.key,
|
line = '=> compare {}: diffing with \"{}\"'
|
||||||
dotfile.dst))
|
LOG.log(line.format(dotfile.key, dotfile.dst))
|
||||||
LOG.emph(diff)
|
LOG.emph(diff)
|
||||||
same = False
|
same = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user