#!/usr/bin/env python import sys, subprocess from bog import options, repo from bog.helpers import * optspec = """ bog log """ o = options.Options('bog log', optspec) (opt, flags, extra) = o.parse(sys.argv[1:]) if extra: o.fatal('no arguments expected') gitdir = os.path.join(repo.check_dir(), '.git') os.environ['GIT_DIR'] = gitdir sys.exit(subprocess.call(['git', 'log']))
#!/usr/bin/env python import sys, os, glob from bog import options, repo from bog.helpers import * optspec = """ bog view [bugid] """ o = options.Options('bog init', optspec) (opt, flags, extra) = o.parse(sys.argv[1:]) bogdir = repo.check_dir() (exedir, junk) = os.path.split(sys.argv[0]) if len(extra) > 1: o.fatal('at most one argument expected') def mutt(*l): os.execvp('mutt', [ 'mutt', '-e', 'set folder="%s"' % bogdir, '-e', 'source "%s/muttx"' % exedir ] + list(l)) if not extra: cwd = os.path.abspath('.') dirbase = os.path.join(bogdir, '') if cwd != dirbase and cwd.startswith(dirbase): if cwd[-4:] in ['/cur', '/new', '/tmp']:
#!/usr/bin/env python import sys from bog import options, repo from bog.helpers import * optspec = """ bog pull """ o = options.Options('bog pull', optspec) (opt, flags, extra) = o.parse(sys.argv[1:]) if extra: o.fatal('no arguments expected') repo.check_dir() repo.commit('Commit (pull)') repo.resolve() if repo.remote_url(): repo.pull() else: log('No remote repository configured.\n')
#!/usr/bin/env python import sys from bog import options, repo from bog.helpers import * optspec = """ bog remote <url> """ o = options.Options('bog remote', optspec) (opt, flags, extra) = o.parse(sys.argv[1:]) repo.check_dir() os.environ['GIT_DIR'] = os.path.join(repo.check_dir(), '.git') oldurl = repo.remote_url() if not extra: if oldurl: print oldurl else: log('No remote URL defined.\n') elif len(extra) != 1: o.fatal('exactly one argument expected') else: # exactly one argument if oldurl: log('old remote was: %s\n' % oldurl) subprocess.call(['git', 'remote', 'rm', 'origin']) sys.exit( subprocess.call(['git', 'remote', 'add', '-f', 'origin', extra[0]]))