FreeBSD/contrib/subversion/subversion/libsvn_fs_x/revprops.c
/* Return TRUE, if for REVISION in FS, we can find the revprop pack file.
 * Use SCRATCH_POOL for temporary allocations.
 * Set *MISSING, if the reason is a missing manifest or pack file.
 */
Return TRUE, if for REVISION in FS, we can find the revprop pack file.
Use SCRATCH_POOL for temporary allocations.
Set *MISSING, if the reason is a missing manifest or pack file.
Return TRUE if for REVISION in FS we can find the revprop pack file . Use SCRATCH_POOL for temporary allocations . Set * MISSING if the reason is a missing manifest or pack file .
svn_boolean_t
svn_fs_x__packed_revprop_available(svn_boolean_t *missing,
                                   svn_fs_t *fs,
                                   svn_revnum_t revision,
                                   apr_pool_t *scratch_pool)
{
  svn_fs_x__data_t *ffd = fs->fsap_data;
  svn_stringbuf_t *content = NULL;
  const char *folder = svn_fs_x__path_revprops_pack_shard(fs, revision,
                                                          scratch_pool);
  const char *manifest_path = svn_dirent_join(folder, PATH_MANIFEST,
                                              scratch_pool);
  svn_error_t *err = svn_fs_x__try_stringbuf_from_file(&content,
                                                       missing,
                                                       manifest_path,
                                                       FALSE,
                                                       scratch_pool);
  if (err)
    {
      svn_error_clear(err);
      return FALSE;
    }
  if (*missing)
    return FALSE;
  revision = revision < ffd->max_files_per_dir
           ? revision - 1
           : revision % ffd->max_files_per_dir;
  while (content->data)
    {
      char *next = strchr(content->data, '\n');
      if (next)
        {
          *next = 0;
          ++next;
        }
      if (revision-- == 0)
        {
          svn_node_kind_t kind;
          err = svn_io_check_path(svn_dirent_join(folder, content->data,
                                                  scratch_pool),
                                  &kind, scratch_pool);
          if (err)
            {
              svn_error_clear(err);
              return FALSE;
            }
          *missing = kind == svn_node_none;
          return kind == svn_node_file;
        }
      content->data = next;
    }
  return FALSE;
}
svn_boolean_t svn_fs_x__packed_revprop_available ( svn_boolean_t * missing , svn_fs_t * fs , svn_revnum_t revision , apr_pool_t * scratch_pool ) { svn_fs_x__data_t * ffd = fs -> fsap_data ; svn_stringbuf_t * content = NULL ; const char * folder = svn_fs_x__path_revprops_pack_shard ( fs , revision , scratch_pool ) ; const char * manifest_path = svn_dirent_join ( folder , PATH_MANIFEST , scratch_pool ) ; svn_error_t * err = svn_fs_x__try_stringbuf_from_file ( & content , missing , manifest_path , FALSE , scratch_pool ) ; if ( err ) { svn_error_clear ( err ) ; return FALSE ; } if ( * missing ) return FALSE ; revision = revision < ffd -> max_files_per_dir ? revision - 1 : revision % ffd -> max_files_per_dir ; while ( content -> data ) { char * next = strchr ( content -> data , ' \n ' ) ; if ( next ) { * next = 0 ; ++ next ; } if ( revision -- == 0 ) { svn_node_kind_t kind ; err = svn_io_check_path ( svn_dirent_join ( folder , content -> data , scratch_pool ) , & kind , scratch_pool ) ; if ( err ) { svn_error_clear ( err ) ; return FALSE ; } * missing = kind == svn_node_none ; return kind == svn_node_file ; } content -> data = next ; } return FALSE ; }
Return TRUE, if for REVISION in FS, we can find the revprop pack file.
Return TRUE if for REVISION in FS we can find the revprop pack file .
/* try to read the manifest file */ /* if the manifest cannot be read, consider the pack files inaccessible
   * even if the file itself exists. */ /* parse manifest content until we find the entry for REVISION.
   * Revision 0 is never packed. */ /* the respective pack file must exist (and be a file) */