mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-09 10:04:17 +00:00
@@ -123,7 +123,7 @@ class Comparator:
|
|||||||
|
|
||||||
def _diff(self, left, right, header=False):
|
def _diff(self, left, right, header=False):
|
||||||
"""diff using the unix tool diff"""
|
"""diff using the unix tool diff"""
|
||||||
out = diff(left, right, raw=False,
|
out = diff(modified=left, original=right, raw=False,
|
||||||
opts=self.diffopts, debug=self.debug)
|
opts=self.diffopts, debug=self.debug)
|
||||||
if header:
|
if header:
|
||||||
lshort = os.path.basename(left)
|
lshort = os.path.basename(left)
|
||||||
|
|||||||
@@ -437,14 +437,14 @@ class Installer:
|
|||||||
if content:
|
if content:
|
||||||
tmp = utils.write_to_tmpfile(content)
|
tmp = utils.write_to_tmpfile(content)
|
||||||
src = tmp
|
src = tmp
|
||||||
diff = utils.diff(src, dst, raw=False)
|
diff = utils.diff(modified=src, original=dst, raw=False)
|
||||||
if tmp:
|
if tmp:
|
||||||
utils.remove(tmp, quiet=True)
|
utils.remove(tmp, quiet=True)
|
||||||
|
|
||||||
# fake the output for readability
|
# fake the output for readability
|
||||||
if not diff:
|
if not diff:
|
||||||
return
|
return
|
||||||
self.log.log('diff \"{}\" VS \"{}\"'.format(src, dst))
|
self.log.log('diff \"{}\" VS \"{}\"'.format(dst, src))
|
||||||
self.log.emph(diff)
|
self.log.emph(diff)
|
||||||
|
|
||||||
def _create_dirs(self, directory):
|
def _create_dirs(self, directory):
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ def shell(cmd, debug=False):
|
|||||||
return ret == 0, out
|
return ret == 0, out
|
||||||
|
|
||||||
|
|
||||||
def diff(src, dst, raw=True, opts='', debug=False):
|
def diff(original, modified, raw=True, opts='', debug=False):
|
||||||
"""call unix diff to compare two files"""
|
"""call unix diff to compare two files"""
|
||||||
cmd = 'diff -r {} \"{}\" \"{}\"'.format(opts, src, dst)
|
cmd = 'diff -r {} \"{}\" \"{}\"'.format(opts, original, modified)
|
||||||
_, out = run(shlex.split(cmd), raw=raw, debug=debug)
|
_, out = run(shlex.split(cmd), raw=raw, debug=debug)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user