Пример #1
0
def putfile(fname, rpath, home='.'):
    _util.apr_initialize()
    pool = _util.svn_pool_create(None)

    db_path = os.path.join(home, 'db')
    if not os.path.exists(db_path):
        db_path = home

    fsob = fs.new(pool)
    fs.open_berkeley(fsob, db_path)

    # open a transaction against HEAD
    rev = fs.youngest_rev(fsob, pool)

    txn = fs.begin_txn(fsob, rev, pool)
    print ` txn `

    root = fs.txn_root(txn, pool)
    fs.make_file(root, rpath, pool)

    handler, baton = fs.apply_textdelta(root, rpath, pool)

    ### it would be nice to get an svn_stream_t. for now, just load in the
    ### whole file and shove it into the FS.
    _delta.svn_txdelta_send_string(
        open(fname, 'rb').read(), handler, baton, pool)

    conflicts, new_rev = fs.commit_txn(txn)
    if conflicts:
        print 'conflicts:', conflicts
    print 'New revision:', new_rev

    _util.svn_pool_destroy(pool)
    _util.apr_terminate()
Пример #2
0
def tweak_dates(pool, home='.'):
  db_path = os.path.join(home, 'db')
  if not os.path.exists(db_path):
    db_path = home

  fsob = fs.new(None, pool)
  fs.open_berkeley(fsob, db_path)

  for i in range(fs.youngest_rev(fsob, pool)):
    # convert secs into microseconds, then a string
    date = core.svn_time_to_cstring((DATE_BASE+i*DATE_INCR) * 1000000L, pool)
    #print date
    fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_DATE, date, pool)
Пример #3
0
def tweak_dates(pool, home='.'):
  db_path = os.path.join(home, 'db')
  if not os.path.exists(db_path):
    db_path = home

  fsob = fs.new(None, pool)
  fs.open_berkeley(fsob, db_path)

  for i in range(fs.youngest_rev(fsob, pool)):
    # convert secs into microseconds, then a string
    date = core.svn_time_to_cstring((DATE_BASE+i*DATE_INCR) * 1000000L, pool)
    #print date
    fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_DATE, date, pool)
    fs.change_rev_prop(fsob, i+1, core.SVN_PROP_REVISION_AUTHOR, 'mailer test', pool)
Пример #4
0
def run(db_path):
  _util.apr_initialize()

  pool = _util.svn_pool_create(None)

  fsob = fs.new(pool)
  fs.open_berkeley(fsob, db_path)

  rev = fs.youngest_rev(fsob, pool)
  print 'Head revision:', rev

  root = fs.revision_root(fsob, rev, pool)

  print '/'
  dump_tree(fsob, root, pool, '', 2)
Пример #5
0
def getfile(pool, path, rev=None, home='.'):

    db_path = os.path.join(home, 'db')
    if not os.path.exists(db_path):
        db_path = home

    fsob = fs.new(pool)
    fs.open_berkeley(fsob, db_path)

    if rev is None:
        rev = fs.youngest_rev(fsob, pool)

    root = fs.revision_root(fsob, rev, pool)
    file = fs.file_contents(root, path, pool)
    while 1:
        data = util.svn_stream_read(file, CHUNK_SIZE)
        if not data:
            break
        sys.stdout.write(data)
Пример #6
0
def plist(rev=None, home='.', *props):

    db_path = os.path.join(home, 'db')
    if not os.path.exists(db_path):
        db_path = home

    fs_ptr = fs.new(None)
    fs.open_berkeley(fs_ptr, db_path)

    if rev is None:
        rev = fs.youngest_rev(fs_ptr)

    print 'Properties for revision:', rev
    if props:
        for propname in props:
            value = fs.revision_prop(fs_ptr, rev, propname)
            if value is None:
                print '%s: <not present>' % propname
            else:
                print '%s: %s' % (propname, value)
    else:
        proplist = fs.revision_proplist(fs_ptr, rev)
        for propname, value in proplist.items():
            print '%s: %s' % (propname, value)
def plist(rev=None, home='.', *props):

  db_path = os.path.join(home, 'db')
  if not os.path.exists(db_path):
    db_path = home

  fs_ptr = fs.new(None)
  fs.open_berkeley(fs_ptr, db_path)

  if rev is None:
    rev = fs.youngest_rev(fs_ptr)

  print('Properties for revision: %s' % rev)
  if props:
    for propname in props:
      value = fs.revision_prop(fs_ptr, rev, propname)
      if value is None:
        print('%s: <not present>' % propname)
      else:
        print('%s: %s' % (propname, value))
  else:
    proplist = fs.revision_proplist(fs_ptr, rev)
    for propname, value in proplist.items():
      print('%s: %s' % (propname, value))