Mercurial > hg > config
comparison python/diffex.py @ 453:be91c9fb3147
python/diffex.py
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sat, 10 Aug 2013 17:14:09 -0700 |
| parents | 95afeaf9c42d |
| children | 4adc11d68e3d |
comparison
equal
deleted
inserted
replaced
| 452:7d6bd51f0323 | 453:be91c9fb3147 |
|---|---|
| 9 import lsex | 9 import lsex |
| 10 import optparse | 10 import optparse |
| 11 import os | 11 import os |
| 12 import subprocess | 12 import subprocess |
| 13 import sys | 13 import sys |
| 14 import tempfile | |
| 14 | 15 |
| 15 def add_options(parser): | 16 def add_options(parser): |
| 16 """add options to the OptionParser instance""" | 17 """add options to the OptionParser instance""" |
| 17 | 18 |
| 18 def main(args=sys.argv[1:]): | 19 def main(args=sys.argv[1:]): |
| 27 else: | 28 else: |
| 28 return '' | 29 return '' |
| 29 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) | 30 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) |
| 30 options, args = parser.parse_args(args) | 31 options, args = parser.parse_args(args) |
| 31 | 32 |
| 32 # STUB | 33 # get difference |
| 33 # before = lsex... # get executables before | 34 before = lsex.executable_names() # get executables before |
| 34 # raw_input("Press [Enter] to continue") | 35 raw_input("Press [Enter] to continue") |
| 35 # after = lsex... # get executables after | 36 after = lsex.executable_names() # get executables after |
| 36 # difflib.diff() # get difference | 37 |
| 38 # display | |
| 39 added = [i for i in after if i not in before] | |
| 40 removed = [i for i in before if i not in after] | |
| 41 added.sort() | |
| 42 removed.sort() | |
| 43 | |
| 44 display = [('Added', added), | |
| 45 ('Removed', removed), | |
| 46 ] | |
| 47 | |
| 48 for display_name, var in display: | |
| 49 if var: | |
| 50 print '%s:' % display_name | |
| 51 print '\n'.join(var) | |
| 37 | 52 |
| 38 if __name__ == '__main__': | 53 if __name__ == '__main__': |
| 39 main() | 54 main() |
| 40 | 55 |
