Mercurial > hg > CommitWatcher
annotate commitwatcher/main.py @ 17:9ec036da252e
commitwatcher/agent.py
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Sat, 28 Sep 2013 10:19:12 -0700 |
| parents | 4cb3971d9d9d |
| children |
| rev | line source |
|---|---|
| 0 | 1 #!/usr/bin/env python |
| 2 # -*- coding: utf-8 -*- | |
| 3 | |
| 4 """ | |
| 5 new service to monitor mozbase commits | |
| 6 """ | |
| 7 | |
| 8 import optparse | |
| 9 import os | |
| 10 import subprocess | |
| 11 import sys | |
| 12 | |
|
2
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
13 from .agent import FeedAgent |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
14 |
| 0 | 15 def add_options(parser): |
| 16 """add options to the OptionParser instance""" | |
| 17 | |
| 18 def main(args=sys.argv[1:]): | |
| 19 | |
| 20 # parse command line options | |
|
2
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
21 usage = '%prog [options] url://of.repository/' |
| 0 | 22 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): |
| 23 """description formatter for console script entry point""" | |
| 24 def format_description(self, description): | |
| 25 if description: | |
| 26 return description.strip() + '\n' | |
| 27 else: | |
| 28 return '' | |
| 29 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) | |
| 30 options, args = parser.parse_args(args) | |
|
2
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
31 if len(args) != 1: |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
32 parser.error("Please specify a single repository") |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
33 # TODO : multiple repos |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
34 |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
35 repo = args[0] |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
36 |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
37 # watch the damn thing |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
38 watcher = FeedAgent(repository=repo) |
|
4cb3971d9d9d
commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
Jeff Hammel <jhammel@mozilla.com>
parents:
0
diff
changeset
|
39 watcher.update() |
| 0 | 40 |
| 41 if __name__ == '__main__': | |
| 42 main() | |
| 43 |
