3 """This module contains commands related to statistics on git repositories.
5 Each command here is merely a wrapper around other, more complicated, commands.
8 from git_python
import Repo
9 from git_python
import Git
16 class DispatchException(Exception):
17 """This exception is raised when something went wrong during dispatching
23 """This class provides basic dispatching functionality
26 def __init__(self
, commands
):
27 self
.commands
= commands
29 def showUsageMessage(self
):
30 print("Available commands are:")
31 for key
in self
.commands
.iterkeys():
34 def dispatch(self
, argv
):
36 self
.showUsageMessage()
41 for key
, value
in self
.commands
.iteritems():
42 if key
.startswith(command
):
46 raise DispatchException("Unknown command '" + command
+ "'.")
51 "author" : author
.dispatch
,
52 "branch" : branch
.dispatch
,
53 "commit" : commit
.dispatch
,
54 "index" : index
.dispatch
,
58 if __name__
== '__main__':
62 result
= Dispatcher(commands
).dispatch(sys
.argv
)