Example #1
0
        def _revinfo_helper(rev, include_changed_paths):
            # Get the revision property info.  (Would use
            # editor.get_root_props(), but something is broken there...)
            revprops = fs.revision_proplist(self.fs_ptr, rev)
            msg, author, date, revprops = _split_revprops(revprops)

            # Optimization: If our caller doesn't care about the changed
            # paths, and we don't need them to do authz determinations, let's
            # get outta here.
            if self.auth is None and not include_changed_paths:
                return date, author, msg, revprops, None

            # If we get here, then we either need the changed paths because we
            # were asked for them, or we need them to do authorization checks.
            #
            # If we only need them for authorization checks, though, we
            # won't bother generating fully populated ChangedPath items (the
            # cost is too great).
            fsroot = self._getroot(rev)
            if include_changed_paths:
                found_readable, found_unreadable, changedpaths = \
                  _get_changed_paths(fsroot)
            else:
                changedpaths = None
                found_readable, found_unreadable = _simple_auth_check(fsroot)

            # Filter our metadata where necessary, and return the requested data.
            if found_unreadable:
                msg = None
                if not found_readable:
                    author = None
                    date = None
            return date, author, msg, revprops, changedpaths
Example #2
0
  def __init__(self, fs_ptr, root, pool=None, notify_cb=None):
    """Construct a walker over the svn_fs_root_t ROOT, which must
    be in the svn_fs_t FS_PTR.  Invoke NOTIFY_CB with a single argument
    of type ChangedPath for each change under ROOT.

    At this time, two ChangedPath objects will be passed for a path that had
    been replaced in the revision/transaction.  This may change in the future.

    ### Can't we deduce FS_PTR from ROOT?

    ### POOL is unused
    """

    self.fs_ptr = fs_ptr
    self.changes = { } # path -> ChangedPathEntry()
    self.roots = { } # revision -> svn_svnfs_root_t
    self.notify_cb = notify_cb
    self.props = { }
    self.fs_root = root

    # Figger out the base revision and root properties.
    if _svnfs.is_revision_root(self.fs_root):
      rev = _svnfs.revision_root_revision(self.fs_root)
      self.base_rev = rev - 1
      self.props = _svnfs.revision_proplist(self.fs_ptr, rev)
    else:
      txn_name = _svnfs.txn_root_name(self.fs_root)
      txn_t = _svnfs.open_txn(self.fs_ptr, txn_name)
      self.base_rev = _svnfs.txn_base_revision(txn_t)
      self.props = _svnfs.txn_proplist(txn_t)
Example #3
0
   def _revinfo_helper(rev, include_changed_paths):
     # Get the revision property info.  (Would use
     # editor.get_root_props(), but something is broken there...)
     revprops = fs.revision_proplist(self.fs_ptr, rev)
     msg, author, date, revprops = _split_revprops(revprops)
 
     # Optimization: If our caller doesn't care about the changed
     # paths, and we don't need them to do authz determinations, let's
     # get outta here.
     if self.auth is None and not include_changed_paths:
       return date, author, msg, revprops, None
 
     # If we get here, then we either need the changed paths because we
     # were asked for them, or we need them to do authorization checks.
     #
     # If we only need them for authorization checks, though, we
     # won't bother generating fully populated ChangedPath items (the
     # cost is too great).
     fsroot = self._getroot(rev)
     if include_changed_paths:
       found_readable, found_unreadable, changedpaths = \
         _get_changed_paths(fsroot)
     else:
       changedpaths = None
       found_readable, found_unreadable = _simple_auth_check(fsroot)
       
     # Filter our metadata where necessary, and return the requested data.
     if found_unreadable:
       msg = None
       if not found_readable:
         author = None
         date = None
     return date, author, msg, revprops, changedpaths
Example #4
0
 def get_properties(self):
     props = fs.revision_proplist(self.fs_ptr, self.rev, self.pool())
     properties = {}
     for k, v in props.iteritems():
         if k not in (core.SVN_PROP_REVISION_LOG, 
                      core.SVN_PROP_REVISION_AUTHOR,
                      core.SVN_PROP_REVISION_DATE):
             properties[k] = to_unicode(v)
     return properties
Example #5
0
 def get_properties(self):
     props = fs.revision_proplist(self.fs_ptr, self.rev, self.pool())
     properties = {}
     for k, v in props.iteritems():
         if k not in (core.SVN_PROP_REVISION_LOG, core.SVN_PROP_REVISION_AUTHOR, core.SVN_PROP_REVISION_DATE):
             properties[k] = to_unicode(v)
             # Note: the above `to_unicode` has a small probability
             # to mess-up binary properties, like icons.
     return properties
Example #6
0
 def get_properties(self):
     props = fs.revision_proplist(self.fs_ptr, self.rev, self.pool())
     properties = {}
     for k, v in props.iteritems():
         if k not in (core.SVN_PROP_REVISION_LOG,
                      core.SVN_PROP_REVISION_AUTHOR,
                      core.SVN_PROP_REVISION_DATE):
             properties[k] = to_unicode(v)
             # Note: the above `to_unicode` has a small probability
             # to mess-up binary properties, like icons.
     return properties
Example #7
0
  def __init__(self, fs_ptr, root, pool=None, notify_cb=None):
    self.fs_ptr = fs_ptr
    self.changes = { } # path -> ChangedPathEntry()
    self.roots = { } # revision -> svn_svnfs_root_t
    self.notify_cb = notify_cb
    self.props = { }
    self.fs_root = root

    # Figger out the base revision and root properties.
    if _svnfs.is_revision_root(self.fs_root):
      rev = _svnfs.revision_root_revision(self.fs_root)
      self.base_rev = rev - 1
      self.props = _svnfs.revision_proplist(self.fs_ptr, rev)
    else:
      txn_name = _svnfs.txn_root_name(self.fs_root)
      txn_t = _svnfs.open_txn(self.fs_ptr, txn_name)
      self.base_rev = _svnfs.txn_base_revision(txn_t)
      self.props = _svnfs.txn_proplist(txn_t)
Example #8
0
  def __init__(self, fs_ptr, root, pool=None, notify_cb=None):
    self.fs_ptr = fs_ptr
    self.changes = { } # path -> ChangedPathEntry()
    self.roots = { } # revision -> svn_fs_root_t
    self.notify_cb = notify_cb
    self.props = { }
    self.fs_root = root

    # Figger out the base revision and root properties.
    if _fs.is_revision_root(self.fs_root):
      rev = _fs.revision_root_revision(self.fs_root)
      self.base_rev = rev - 1
      self.props = _fs.revision_proplist(self.fs_ptr, rev)
    else:
      txn_name = _fs.txn_root_name(self.fs_root)
      txn_t = _fs.open_txn(self.fs_ptr, txn_name)
      self.base_rev = _fs.txn_base_revision(txn_t)
      self.props = _fs.txn_proplist(txn_t)
Example #9
0
File: svn_fs.py Project: akun/atrac
    def __init__(self, path, file_path, rev=None):
        self.file_path = file_path
        self.path = path

        repos_path = core.svn_path_canonicalize(
            os.path.normpath(self.path).replace('\\', '/')
        )
        svn_repos = repos.svn_repos_open(repos_path)
        fs_ptr = repos.svn_repos_fs(svn_repos)
        if rev:
            self.rev = rev
        else:
            self.rev = fs.youngest_rev(fs_ptr)
        self.root = fs.revision_root(fs_ptr, self.rev)
        self.kind = KIND_MAP[fs.check_path(self.root, self.file_path)]
        self.name = os.path.split(self.file_path)[-1]
        self.cr = fs.node_created_rev(self.root, self.file_path)
        props = fs.revision_proplist(fs_ptr, self.cr)
        self.date = props[core.SVN_PROP_REVISION_DATE]
        self.author = props[core.SVN_PROP_REVISION_AUTHOR]
        self.log = props[core.SVN_PROP_REVISION_LOG]
Example #10
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))