示例#1
0
 def post(self):
     repo.commit()
     t = str(self.request.body)
     open(mainpath, 'wb').write(t)
     
     cid = repo.vcommit('Edited (web)', self.get_argument('commitid'))
     repo.resolve(cid)
     print 'Updated schedule (%s).' % repr(t[:40])
     self.write(cid)
示例#2
0
def get_sched(integrate_slips=False):
    repo.commit()
    repo.resolve()
    # FIXME: this is terrible.  Make a real module for reading email
    # contents...
    lines = []
    lines += open(mainpath).readlines()
    
    lastdir = ['']
    def f(junk, dir, names):
        names.sort()
        #log('dir: %r\n' % dir)
        if dir[-4:] in ['/cur', '/new']:
            for n in names[:10]:
                if n.endswith('~') or n.startswith('.'):
                    continue
                #log('reading: %r\n' % n)
                g = re.split(r'\n--=---{0,2}\n',
                             open(os.path.join(dir, n)).read())
                if g:
                    top = g[0].strip()
                    g2 = re.search(re.compile(r'^Subject: (.*)$', re.M), top)
                    subj = g2 and g2.group(1) or 'Untitled'
                    sch = g[1].strip()
                    #log('%s\n' % sch)
                    folder = dir[len(bogdir):-4]
                    if lastdir[0] != folder:
                        lines.append(folder)
                        lastdir[0] = folder
                    lines.append('\t' + subj)
                    for s in sch.split('\n'):
                        lines.append(re.sub(re.compile(r'^([^#])', re.M),
                                            r'\t\t\1', s))
    os.path.walk(bogdir, f, None)
    #log('\n\n\n')
    #for l in lines:
    #    log('%s\n' % l)
    return schedulator.Schedule(lines,
                                integrate_slips=integrate_slips)
示例#3
0
#!/usr/bin/env python
import sys
from bog import options, repo
from bog.helpers import *

optspec = """
bog commit [-m msg]
--
m,message  Use a non-default commit message
"""
o = options.Options('bog commit', optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])

if extra:
    o.fatal('no arguments expected')

repo.commit(msg=opt.message or 'Commit')
示例#4
0
optspec = """
bog init
"""
o = options.Options('bog init', optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])

if extra:
    o.fatal('no arguments expected')

if os.path.exists('.bogroot'):
    log('.bogroot already exists in this directory.\n')

oldd = repo.get_dir()
if oldd and os.path.abspath(oldd) != os.path.abspath('.'):
    fatal('BOG_DIR already initialized: %r' % oldd)
os.environ['BOG_DIR'] = os.path.abspath('.')

subprocess.call(['git', 'init'])
open('.bogroot', 'wb').close()
if not os.path.exists('.gitignore'):
    open('.gitignore', 'wb').write("*~\nnohup.out\n*.swp\n*.bak\n")
if not os.path.exists('.gitattributes'):
    open('.gitattributes', 'wb').write('*  merge=union\n')
mkdirp('Undecided/cur')
mkdirp('Undecided/new')
mkdirp('Undecided/tmp')
if not os.path.exists('.git/index'):
    repo.commit(msg='Initial commit')
log('Initialized Bog repository.\n')
示例#5
0
#!/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')

示例#6
0
#!/usr/bin/env python
import sys
from bog import options, repo
from bog.helpers import *

optspec = """
bog push
"""
o = options.Options('bog push', optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])

if extra:
    o.fatal('no arguments expected')

repo.check_dir()
repo.commit('Commit (push)')
repo.resolve()
repo.push()
示例#7
0
#!/usr/bin/env python
import sys
from bog import options, repo
from bog.helpers import *

optspec = """
bog resolve
"""
o = options.Options('bog resolve', optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])

if extra:
    o.fatal('no arguments expected')

repo.check_dir()
repo.commit('Commit (resolve)')
repo.resolve()