| 1 |
#!/usr/bin/env python
|
| 2 |
|
| 3 |
# Show all records from the database for all or specific maintainers
|
| 4 |
# Copyright (C) 2001 Martin Michlmayr <tbm@cyrius.com>
|
| 5 |
# $Id$
|
| 6 |
|
| 7 |
# This program is free software; you can redistribute it and/or modify
|
| 8 |
# it under the terms of the GNU General Public License as published by
|
| 9 |
# the Free Software Foundation; either version 2 of the License, or
|
| 10 |
# (at your option) any later version.
|
| 11 |
|
| 12 |
# This program is distributed in the hope that it will be useful,
|
| 13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 15 |
# GNU General Public License for more details.
|
| 16 |
|
| 17 |
# You should have received a copy of the GNU General Public License
|
| 18 |
# along with this program; if not, write to the Free Software
|
| 19 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 20 |
|
| 21 |
|
| 22 |
import string, sys, re
|
| 23 |
import status
|
| 24 |
|
| 25 |
def help():
|
| 26 |
print """Usage: mia-history [ --grep <pattern> | --name ] [ <pattern> ]
|
| 27 |
|
| 28 |
Options:
|
| 29 |
--grep Search for <pattern> in entries
|
| 30 |
--name Show full name of the developer
|
| 31 |
"""
|
| 32 |
sys.exit(1)
|
| 33 |
|
| 34 |
|
| 35 |
def parse_args():
|
| 36 |
# UGLY!!!
|
| 37 |
global files
|
| 38 |
global item_match
|
| 39 |
global show_name
|
| 40 |
sys.argv = sys.argv[1:]
|
| 41 |
if sys.argv and sys.argv[0] in ['-h', '--help']:
|
| 42 |
help()
|
| 43 |
if sys.argv and sys.argv[0] in ['-n', '--name', '--names']:
|
| 44 |
show_name = 1
|
| 45 |
if len(sys.argv) > 1 and sys.argv[0] in ['-g', '--grep']:
|
| 46 |
item_match = sys.argv[1]
|
| 47 |
sys.argv = sys.argv[2:]
|
| 48 |
|
| 49 |
if sys.argv:
|
| 50 |
pats = map(re.compile, sys.argv)
|
| 51 |
for file in all_status:
|
| 52 |
for pat in pats:
|
| 53 |
if pat.search(file):
|
| 54 |
files.append(file)
|
| 55 |
break
|
| 56 |
else:
|
| 57 |
files = all_status
|
| 58 |
|
| 59 |
|
| 60 |
def main():
|
| 61 |
status.read_status(files)
|
| 62 |
if item_match:
|
| 63 |
all_status = status.get_selected_files(item_match)
|
| 64 |
else:
|
| 65 |
all_status = status.get_all_files()
|
| 66 |
for file in all_status:
|
| 67 |
if show_name:
|
| 68 |
(cn, sn) = status.get_name(file)
|
| 69 |
print '%s (%s %s):' % (file, cn, sn)
|
| 70 |
else:
|
| 71 |
print file + ':'
|
| 72 |
print string.join(status.get_history(file), '\n')
|
| 73 |
|
| 74 |
|
| 75 |
files = [ ]
|
| 76 |
item_match = None
|
| 77 |
show_name = 0
|
| 78 |
all_status = status.find_status()
|
| 79 |
|
| 80 |
parse_args()
|
| 81 |
main()
|
| 82 |
|