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