def main(): load_plugin('tiget.core') try: init_repo() except GitError as e: print_error(e) sys.exit(1) except Exception as e: post_mortem() sys.exit(1)
def do(self, args): if args.plugin_name: try: load_plugin(args.plugin_name) except ImportError as e: raise self.error(e) else: self.print('Available plugins:') entry_points = pkg_resources.iter_entry_points('tiget.plugins') names = set(ep.name for ep in entry_points) names.update(plugins.keys()) for name in sorted(names): loaded = name in plugins self.print('[{}] {}'.format('*' if loaded else ' ', name))
def main(): parser = ArgumentParser(description='ticketing system with git backend') parser.add_argument( '-i', '--interactive', action='store_true', default=sys.stdin.isatty(), help='force start of an interactive session, even if stdin is no tty') parser.add_argument( '-n', '--no-config', action='store_false', dest='load_config', default=True, help='prevent loading of default configuration files') parser.add_argument( '-v', '--version', action='store_true', dest='print_version', default=False, help='print version information') parser.add_argument('cmd', nargs=REMAINDER, help='execute a command') args = parser.parse_args() if args.print_version: print('tiget {}'.format(__version__)) return load_plugin('tiget.core') if not is_repo_initialized(): print_error('repository is not initialized; use tiget-setup') sys.exit(1) try: if args.load_config: load_config() if args.cmd: cmd_execv(args.cmd) elif args.interactive: Repl().run() else: cmd_execfile(sys.stdin) except CmdError as e: print_error(e) sys.exit(1) except Exception as e: post_mortem() sys.exit(1)
row[key] = _get_user(row[key]) if row[key] else None ticket = Ticket.create(**row) ticket_pks[ticket_id] = ticket.pk # TODO: add comment with original ticket id # TODO: import ticket changes cur.execute(''' select ticket, author, newvalue as text from ticket_change where ticket in %s and field = 'comment' and newvalue is not null and trim(newvalue) != '' ''', (tuple(ticket_pks.keys()),)) for row in _bar('comments', cur): ticket = row['ticket'] row['ticket'] = Ticket.objects.get(pk=ticket_pks[ticket]) row['author'] = _get_user(row['author']) Comment.create(**row) # TODO: import timestamp? cur.close() conn.close() if __name__ == '__main__': load_plugin('tiget.core') load_plugin('tiget.scrum') main()