From 2eea113a664dd2c7bfa330edb06e32da9aa08968 Mon Sep 17 00:00:00 2001 From: lilydjwg Date: Wed, 8 Jan 2014 21:24:13 +0800 Subject: [PATCH] add nvcmp command --- nvchecker/tools.py | 15 +++++++++++++++ setup.py | 1 + 2 files changed, 16 insertions(+) diff --git a/nvchecker/tools.py b/nvchecker/tools.py index 300bf22..c385e8a 100644 --- a/nvchecker/tools.py +++ b/nvchecker/tools.py @@ -31,3 +31,18 @@ def take(): oldvers[name] = newvers[name] core.write_verfile(s.oldver, oldvers) + +def cmp(): + parser = argparse.ArgumentParser(description='compare version records of nvchecker') + core.add_common_arguments(parser) + args = parser.parse_args() + if core.process_common_arguments(args): + return + + s = core.Source(args.file) + oldvers = core.read_verfile(s.oldver) if s.oldver else {} + newvers = core.read_verfile(s.newver) + for name, newver in sorted(newvers.items()): + oldver = oldvers.get(name, None) + if oldver != newver: + print('%s %s -> %s' % (name, oldver, newver)) diff --git a/setup.py b/setup.py index bede8ac..c228be4 100755 --- a/setup.py +++ b/setup.py @@ -13,6 +13,7 @@ setup( 'console_scripts': [ 'nvchecker = nvchecker.main:main', 'nvtake = nvchecker.tools:take', + 'nvcmp = nvchecker.tools:cmp', ], },