Example #1
0
def _get_history(svn_path, authz, fs_ptr, pool, start, end, limit=None):
    """`svn_path` is assumed to be a UTF-8 encoded string.
    Returned history paths will be `unicode` objects though."""
    history = []
    if hasattr(repos, 'svn_repos_history2'):
        # For Subversion >= 1.1
        def authz_cb(root, path, pool):
            if limit and len(history) >= limit:
                return 0
            return authz.has_permission(_from_svn(path)) and 1 or 0

        def history2_cb(path, rev, pool):
            history.append((_from_svn(path), rev))

        repos.svn_repos_history2(fs_ptr, svn_path, history2_cb, authz_cb,
                                 start, end, 1, pool())
    else:
        # For Subversion 1.0.x
        def history_cb(path, rev, pool):
            path = _from_svn(path)
            if authz.has_permission(path):
                history.append((path, rev))

        repos.svn_repos_history(fs_ptr, svn_path, history_cb, start, end, 1,
                                pool())
    for item in history:
        yield item
Example #2
0
    def _get_history(self, path, rev, path_type, limit=0, options={}):
        if self.youngest == 0:
            return []

        rev_paths = []
        fsroot = self._getroot(rev)
        show_all_logs = options.get("svn_show_all_dir_logs", 0)
        if not show_all_logs:
            # See if the path is a file or directory.
            kind = fs.check_path(fsroot, path)
            if kind is core.svn_node_file:
                show_all_logs = 1

        # Instantiate a NodeHistory collector object, and use it to collect
        # history items for PATH@REV.
        history = NodeHistory(self.fs_ptr, show_all_logs, limit)
        try:
            repos.svn_repos_history(self.fs_ptr, path, history.add_history, 1,
                                    rev, options.get("svn_cross_copies", 0))
        except core.SubversionException as e:
            if e.apr_err != core.SVN_ERR_CEASE_INVOCATION:
                raise

        # Now, iterate over those history items, checking for changes of
        # location, pruning as necessitated by authz rules.
        for hist_rev, hist_path in history:
            hist_path = _to_str(hist_path)
            path_parts = _path_parts(hist_path)
            if not vclib.check_path_access(self, path_parts, path_type,
                                           hist_rev):
                break
            rev_paths.append([hist_rev, hist_path])
        return rev_paths
Example #3
0
def _get_history(svnrepos, full_name, rev, options={}):
    fsroot = svnrepos._getroot(rev)
    show_all_logs = options.get('svn_show_all_dir_logs', 0)
    if not show_all_logs:
        # See if the path is a file or directory.
        kind = fs.check_path(fsroot, full_name, svnrepos.pool)
        if kind is core.svn_node_file:
            show_all_logs = 1

    # Instantiate a NodeHistory collector object.
    history = NodeHistory(svnrepos.fs_ptr, show_all_logs)

    # Do we want to cross copy history?
    cross_copies = options.get('svn_cross_copies', 0)

    # Get the history items for PATH.
    repos.svn_repos_history(svnrepos.fs_ptr, full_name, history.add_history, 1,
                            rev, cross_copies, svnrepos.pool)
    return history.histories
Example #4
0
def _get_history(svnrepos, full_name, rev, options={}):
  fsroot = svnrepos._getroot(rev)
  show_all_logs = options.get('svn_show_all_dir_logs', 0)
  if not show_all_logs:
    # See if the path is a file or directory.
    kind = fs.check_path(fsroot, full_name, svnrepos.pool)
    if kind is core.svn_node_file:
      show_all_logs = 1
      
  # Instantiate a NodeHistory collector object.
  history = NodeHistory(svnrepos.fs_ptr, show_all_logs)

  # Do we want to cross copy history?
  cross_copies = options.get('svn_cross_copies', 0)

  # Get the history items for PATH.
  repos.svn_repos_history(svnrepos.fs_ptr, full_name, history.add_history,
                          1, rev, cross_copies, svnrepos.pool)
  return history.histories
Example #5
0
def _get_history(path, authz, fs_ptr, start, end, limit=None):
    history = []
    if hasattr(repos, 'svn_repos_history2'):
        # For Subversion >= 1.1
        def authz_cb(root, path, pool):
            if limit and len(history) >= limit:
                return 0
            return authz.has_permission(path) and 1 or 0
        def history2_cb(path, rev, pool):
            history.append((path, rev))
        repos.svn_repos_history2(fs_ptr, path, history2_cb, authz_cb,
                                 start, end, 1)
    else:
        # For Subversion 1.0.x
        def history_cb(path, rev, pool):
            if authz.has_permission(path):
                history.append((path, rev))
        repos.svn_repos_history(fs_ptr, path, history_cb, start, end, 1)
    for item in history:
        yield item
Example #6
0
File: svn_fs.py Project: pirapu/raj
def _get_history(path, authz, fs_ptr, start, end, limit=None):
    history = []
    if hasattr(repos, 'svn_repos_history2'):
        # For Subversion >= 1.1
        def authz_cb(root, path, pool):
            if limit and len(history) >= limit:
                return 0
            return authz.has_permission(path) and 1 or 0
        def history2_cb(path, rev, pool):
            history.append((path, rev))
        repos.svn_repos_history2(fs_ptr, path, history2_cb, authz_cb,
                                 start, end, 1)
    else:
        # For Subversion 1.0.x
        def history_cb(path, rev, pool):
            if authz.has_permission(path):
                history.append((path, rev))
        repos.svn_repos_history(fs_ptr, path, history_cb, start, end, 1)
    for item in history:
        yield item
Example #7
0
    def _get_history(self, path, rev, path_type, limit=0, options={}):
        if self.youngest == 0:
            return []

        rev_paths = []
        fsroot = self._getroot(rev)
        show_all_logs = options.get('svn_show_all_dir_logs', 0)
        if not show_all_logs:
            # See if the path is a file or directory.
            kind = fs.check_path(fsroot, path)
            if kind is core.svn_node_file:
                show_all_logs = 1

        # Instantiate a NodeHistory collector object, and use it to collect
        # history items for PATH@REV.
        history = NodeHistory(self.fs_ptr, show_all_logs, limit)
        try:
            repos.svn_repos_history(self.fs_ptr, path, history.add_history, 1,
                                    rev, options.get('svn_cross_copies', 0))
        except core.SubversionException, e:
            _fix_subversion_exception(e)
            if e.apr_err != _SVN_ERR_CEASE_INVOCATION:
                raise
Example #8
0
  def _get_history(self, path, rev, path_type, limit=0, options={}):
    if self.youngest == 0:
      return []

    rev_paths = []
    fsroot = self._getroot(rev)
    show_all_logs = options.get('svn_show_all_dir_logs', 0)
    if not show_all_logs:
      # See if the path is a file or directory.
      kind = fs.check_path(fsroot, path)
      if kind is core.svn_node_file:
        show_all_logs = 1
      
    # Instantiate a NodeHistory collector object, and use it to collect
    # history items for PATH@REV.
    history = NodeHistory(self.fs_ptr, show_all_logs, limit)
    try:
      repos.svn_repos_history(self.fs_ptr, path, history.add_history,
                              1, rev, options.get('svn_cross_copies', 0))
    except core.SubversionException, e:
      _fix_subversion_exception(e)
      if e.apr_err != _SVN_ERR_CEASE_INVOCATION:
        raise
Example #9
0
def _get_history(svn_path, authz, fs_ptr, pool, start, end, limit=None):
    """`svn_path` is assumed to be a UTF-8 encoded string.
    Returned history paths will be `unicode` objects though."""
    history = []
    if hasattr(repos, 'svn_repos_history2'):
        # For Subversion >= 1.1
        def authz_cb(root, path, pool):
            if limit and len(history) >= limit:
                return 0
            return authz.has_permission(_from_svn(path)) and 1 or 0
        def history2_cb(path, rev, pool):
            history.append((_from_svn(path), rev))
        repos.svn_repos_history2(fs_ptr, svn_path, history2_cb, authz_cb,
                                 start, end, 1, pool())
    else:
        # For Subversion 1.0.x
        def history_cb(path, rev, pool):
            path = _from_svn(path)
            if authz.has_permission(path):
                history.append((path, rev))
        repos.svn_repos_history(fs_ptr, svn_path, history_cb,
                                start, end, 1, pool())
    for item in history:
        yield item