mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-03-22 21:20:08 +00:00
Fix diff order to compare dst with src
The current diffs are confusing, since they compare the source against the destination file. To make it less confusing: source is the file that contains modifications, and destination is the one to be overwritten. With the current order, it displays changes as if you were applying the destination file on the source file. This commit makes it so that it displays the changes it would need to apply source on destination. This is consistent with tools such as patch, that take first the destination file, and second the patch you're going to apply. Diffing should be done the same way, first the destination, second the file with the new changes. This is how other tools that provide diffs such as git also work.
This commit is contained in:
@@ -444,7 +444,7 @@ class Installer:
|
||||
# fake the output for readability
|
||||
if not diff:
|
||||
return
|
||||
self.log.log('diff \"{}\" VS \"{}\"'.format(src, dst))
|
||||
self.log.log('diff \"{}\" VS \"{}\"'.format(dst, src))
|
||||
self.log.emph(diff)
|
||||
|
||||
def _create_dirs(self, directory):
|
||||
|
||||
@@ -72,7 +72,7 @@ def shell(cmd, debug=False):
|
||||
|
||||
def diff(src, dst, raw=True, opts='', debug=False):
|
||||
"""call unix diff to compare two files"""
|
||||
cmd = 'diff -r {} \"{}\" \"{}\"'.format(opts, src, dst)
|
||||
cmd = 'diff -r {} \"{}\" \"{}\"'.format(opts, dst, src)
|
||||
_, out = run(shlex.split(cmd), raw=raw, debug=debug)
|
||||
return out
|
||||
|
||||
|
||||
Reference in New Issue
Block a user