/usr/bin/git-dag is in git-cola 2.10-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #!/usr/bin/python3
# -*- python-mode -*-
"""git-dag: An advanced git DAG visualizer
"""
from __future__ import division, absolute_import, unicode_literals
import os
import sys
from argparse import ArgumentParser
__copyright__ = """
Copyright (C) 2007-2016 David Aguilar and contributors
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
"""
def setup_environment():
"""Provides access to the cola modules"""
# Try to detect where it is run from and set prefix and the search path.
# It is assumed that the user installed Cola using the --prefix= option
abspath = os.path.abspath
dirname = os.path.dirname
realpath = os.path.realpath
join = os.path.join
python2 = sys.version_info[0] == 2
prefix = dirname(dirname(realpath(abspath(__file__))))
if python2:
cola_mod = join(prefix, str('cola'), str('__init__.py'))
install_lib = join(prefix, str('share'), str('git-cola'), str('lib'))
else:
# Look for modules in the source or install trees
cola_mod = os.path.join(prefix, 'cola', '__init__.py')
install_lib = os.path.join(prefix, 'share', 'git-cola', 'lib')
if os.path.exists(cola_mod):
# Source tree
sys.path.insert(1, prefix)
else:
# Install tree
sys.path.insert(1, install_lib)
setup_environment()
# pylint: disable=wrong-import-position
from cola import app
from cola.widgets.dag import git_dag
def main():
"""Run git-dag"""
args = parse_args()
return args.func(args)
def parse_args():
"""Parse command-line arguments"""
parser = ArgumentParser()
parser.set_defaults(func=cmd_dag)
app.add_common_arguments(parser)
parser.add_argument('-c', '--count', '--max-count', metavar='<count>',
type=int, default=1000,
help='number of commits to display')
parser.add_argument('args', nargs='*', metavar='<args>',
help='git log arguments')
args, rest = parser.parse_known_args()
if rest:
# splice unknown arguments to the beginning ~
# these are forwarded to git-log(1).
args.args[:0] = rest
return args
def cmd_dag(args):
"""Run git-dag via the `git cola dag` sub-command"""
context = app.application_init(args)
view = git_dag(context.model, args=args, settings=args.settings)
return app.application_start(context, view)
if __name__ == '__main__':
sys.exit(main())
|