[gnome-ostree] source-diff: Use generic mode switch
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] source-diff: Use generic mode switch
- Date: Sun, 8 Jul 2012 20:21:04 +0000 (UTC)
commit e070cc1f63d23e2a05cf1055d2a5622b889428ba
Author: Colin Walters <walters verbum org>
Date: Sun Jul 8 16:20:26 2012 -0400
source-diff: Use generic mode switch
src/ostbuild/pyostbuild/builtin_source_diff.py | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/builtin_source_diff.py b/src/ostbuild/pyostbuild/builtin_source_diff.py
index 0e3ff07..a5dbe49 100755
--- a/src/ostbuild/pyostbuild/builtin_source_diff.py
+++ b/src/ostbuild/pyostbuild/builtin_source_diff.py
@@ -95,9 +95,8 @@ class OstbuildSourceDiff(builtins.Builtin):
def execute(self, argv):
parser = argparse.ArgumentParser(description=self.short_description)
- parser.add_argument('--log', action='store_true')
- parser.add_argument('--logp', action='store_true')
- parser.add_argument('--diffstat', action='store_true')
+ parser.add_argument('--mode', default='names', action='store')
+
parser.add_argument('--rev-from')
parser.add_argument('--rev-to')
parser.add_argument('--snapshot-from')
@@ -106,6 +105,10 @@ class OstbuildSourceDiff(builtins.Builtin):
args = parser.parse_args(argv)
self.parse_config()
+ valid_modes = ['names', 'log', 'logp', 'diff']
+ if args.mode not in valid_modes:
+ fatal("--mode must be one of %r" % (valid_modes, ))
+
to_snap = None
from_snap = None
@@ -151,12 +154,16 @@ class OstbuildSourceDiff(builtins.Builtin):
continue
if from_revision != to_revision:
- if args.log:
+ if args.mode == 'names':
+ log("Component %s changed from %s to %s" % (name, from_revision, to_revision))
+ elif args.mode == 'log':
self._log([], name, mirrordir, from_revision, to_revision)
- elif args.logp:
+ elif args.mode == 'logp':
self._log(['-p'], name, mirrordir, from_revision, to_revision)
- else:
+ elif args.mode == 'diff':
self._diff(name, mirrordir, from_revision, to_revision,
diffstat=args.diffstat)
+ else:
+ assert False
builtins.register(OstbuildSourceDiff)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]