diffconfig (b7f8f259896f669f131713b0c74ba4d008daa71d) diffconfig (87c7ee67deb7fce9951a5f9d80641138694aad17)
1#!/usr/bin/env python3
2# SPDX-License-Identifier: GPL-2.0
3#
4# diffconfig - a tool to compare .config files.
5#
6# originally written in 2006 by Matt Mackall
7# (at least, this was in his bloatwatch source code)
8# last worked on 2008 by Tim Bird

--- 51 unchanged lines hidden (view full) ---

60 else:
61 if op=="-":
62 print("-%s %s" % (config, value))
63 elif op=="+":
64 print("+%s %s" % (config, new_value))
65 else:
66 print(" %s %s -> %s" % (config, value, new_value))
67
1#!/usr/bin/env python3
2# SPDX-License-Identifier: GPL-2.0
3#
4# diffconfig - a tool to compare .config files.
5#
6# originally written in 2006 by Matt Mackall
7# (at least, this was in his bloatwatch source code)
8# last worked on 2008 by Tim Bird

--- 51 unchanged lines hidden (view full) ---

60 else:
61 if op=="-":
62 print("-%s %s" % (config, value))
63 elif op=="+":
64 print("+%s %s" % (config, new_value))
65 else:
66 print(" %s %s -> %s" % (config, value, new_value))
67
68def main():
68def show_diff():
69 global merge_style
70
71 # parse command line args
72 if ("-h" in sys.argv or "--help" in sys.argv):
73 usage()
74
75 merge_style = 0
76 if "-m" in sys.argv:

--- 47 unchanged lines hidden (view full) ---

124 del b[config]
125
126 # now print items in b but not in a
127 # (items from b that were in a were removed above)
128 new = sorted(b.keys())
129 for config in new:
130 print_config("+", config, None, b[config])
131
69 global merge_style
70
71 # parse command line args
72 if ("-h" in sys.argv or "--help" in sys.argv):
73 usage()
74
75 merge_style = 0
76 if "-m" in sys.argv:

--- 47 unchanged lines hidden (view full) ---

124 del b[config]
125
126 # now print items in b but not in a
127 # (items from b that were in a were removed above)
128 new = sorted(b.keys())
129 for config in new:
130 print_config("+", config, None, b[config])
131
132main()
132def main():
133 try:
134 show_diff()
135 except BrokenPipeError:
136 # Python flushes standard streams on exit; redirect remaining output
137 # to devnull to avoid another BrokenPipeError at shutdown
138 devnull = os.open(os.devnull, os.O_WRONLY)
139 os.dup2(devnull, sys.stdout.fileno())
140 sys.exit(1) # Python exits with error code 1 on EPIPE
141
142
143if __name__ == '__main__':
144 main()