comparison mxtool/mx.py @ 13288:9c3c915b5f56

Log modiffied files during eclipseformat
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 11 Dec 2013 12:21:07 +0100
parents 78ed696884b3
children e1a50eac0eac
comparison
equal deleted inserted replaced
13287:9b053d478a4e 13288:9c3c915b5f56
2153 if fi.update(): 2153 if fi.update():
2154 modified.append(fi) 2154 modified.append(fi)
2155 2155
2156 log('{0} files were modified'.format(len(modified))) 2156 log('{0} files were modified'.format(len(modified)))
2157 if len(modified) != 0: 2157 if len(modified) != 0:
2158 arcbase = _primary_suite.dir
2158 if args.backup: 2159 if args.backup:
2159 backup = os.path.abspath('eclipseformat.backup.zip') 2160 backup = os.path.abspath('eclipseformat.backup.zip')
2160 arcbase = _primary_suite.dir
2161 zf = zipfile.ZipFile(backup, 'w', zipfile.ZIP_DEFLATED) 2161 zf = zipfile.ZipFile(backup, 'w', zipfile.ZIP_DEFLATED)
2162 for fi in modified: 2162 for fi in modified:
2163 arcname = os.path.relpath(fi.path, arcbase).replace(os.sep, '/') 2163 name = os.path.relpath(fi.path, arcbase)
2164 log(' - {0}'.format(name))
2165 if args.backup:
2166 arcname = name.replace(os.sep, '/')
2164 zf.writestr(arcname, fi.content) 2167 zf.writestr(arcname, fi.content)
2168 if args.backup:
2165 zf.close() 2169 zf.close()
2166 log('Wrote backup of {0} modified files to {1}'.format(len(modified), backup)) 2170 log('Wrote backup of {0} modified files to {1}'.format(len(modified), backup))
2167 return 1 2171 return 1
2168 return 0 2172 return 0
2169 2173