changeset 14626:4f8268dee8aa

mx: eclipseformat now prints all the changes that were found to the console.
author Christian Humer <christian.humer@gmail.com>
date Thu, 20 Mar 2014 00:15:49 +0100
parents ed3bfe43d772
children 46c020971d9c
files mxtool/mx.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mxtool/mx.py	Wed Mar 19 21:10:34 2014 +0100
+++ b/mxtool/mx.py	Thu Mar 20 00:15:49 2014 +0100
@@ -40,6 +40,7 @@
 import xml.parsers.expat
 import shutil, re, xml.dom.minidom
 import pipes
+import difflib
 from collections import Callable
 from threading import Thread
 from argparse import ArgumentParser, REMAINDER
@@ -1930,6 +1931,7 @@
             with open(self.path) as fp:
                 content = fp.read()
                 if self.content != content:
+                    self.diff = difflib.unified_diff(self.content.splitlines(1), content.splitlines(1))
                     self.content = content
                     return True
             os.utime(self.path, self.times)
@@ -1967,6 +1969,7 @@
                 modified.append(fi)
 
     log('{0} files were modified'.format(len(modified)))
+
     if len(modified) != 0:
         arcbase = _primary_suite.dir
         if args.backup:
@@ -1975,6 +1978,8 @@
         for fi in modified:
             name = os.path.relpath(fi.path, arcbase)
             log(' - {0}'.format(name))
+            log('Changes:')
+            log(''.join(fi.diff))
             if args.backup:
                 arcname = name.replace(os.sep, '/')
                 zf.writestr(arcname, fi.content)