FreeBSD/contrib/subversion/subversion/libsvn_fs_x/tree.c
/* Implement svn_fs_history_prev, set *PREV_HISTORY_P to a new
   svn_fs_history_t object that represents the predecessory of
   HISTORY.  If CROSS_COPIES is true, *PREV_HISTORY_P may be related
   only through a copy operation.  Perform all allocations in POOL. */
Implement svn_fs_history_prev, set *PREV_HISTORY_P to a new
svn_fs_history_t object that represents the predecessory of
HISTORY.  If CROSS_COPIES is true, *PREV_HISTORY_P may be related
only through a copy operation.  Perform all allocations in POOL.
Implement svn_fs_history_prev set * PREV_HISTORY_P to a new svn_fs_history_t object that represents the predecessory of HISTORY . If CROSS_COPIES is true * PREV_HISTORY_P may be related only through a copy operation . Perform all allocations in POOL .
static svn_error_t *
fs_history_prev(svn_fs_history_t **prev_history_p,
                svn_fs_history_t *history,
                svn_boolean_t cross_copies,
                apr_pool_t *result_pool,
                apr_pool_t *scratch_pool)
{
  svn_fs_history_t *prev_history = NULL;
  fs_history_data_t *fhd = history->fsap_data;
  svn_fs_t *fs = fhd->fs;
  if (strcmp(fhd->path, "/") == 0)
    {
      if (! fhd->is_interesting)
        prev_history = assemble_history(fs, "/", fhd->revision,
                                        1, NULL, SVN_INVALID_REVNUM,
                                        result_pool);
      else if (fhd->revision > 0)
        prev_history = assemble_history(fs, "/", fhd->revision - 1,
                                        1, NULL, SVN_INVALID_REVNUM,
                                        result_pool);
    }
  else
    {
      apr_pool_t *iterpool = svn_pool_create(scratch_pool);
      prev_history = history;
      while (1)
        {
          svn_pool_clear(iterpool);
          SVN_ERR(history_prev(&prev_history, prev_history, cross_copies,
                               result_pool, iterpool));
          if (! prev_history)
            break;
          fhd = prev_history->fsap_data;
          if (fhd->is_interesting)
            break;
        }
      svn_pool_destroy(iterpool);
    }
  *prev_history_p = prev_history;
  return SVN_NO_ERROR;
}
static svn_error_t * fs_history_prev ( svn_fs_history_t * * prev_history_p , svn_fs_history_t * history , svn_boolean_t cross_copies , apr_pool_t * result_pool , apr_pool_t * scratch_pool ) { svn_fs_history_t * prev_history = NULL ; fs_history_data_t * fhd = history -> fsap_data ; svn_fs_t * fs = fhd -> fs ; if ( strcmp ( fhd -> path , " " ) == 0 ) { if ( ! fhd -> is_interesting ) prev_history = assemble_history ( fs , " " , fhd -> revision , 1 , NULL , SVN_INVALID_REVNUM , result_pool ) ; else if ( fhd -> revision > 0 ) prev_history = assemble_history ( fs , " " , fhd -> revision - 1 , 1 , NULL , SVN_INVALID_REVNUM , result_pool ) ; } else { apr_pool_t * iterpool = svn_pool_create ( scratch_pool ) ; prev_history = history ; while ( 1 ) { svn_pool_clear ( iterpool ) ; SVN_ERR ( history_prev ( & prev_history , prev_history , cross_copies , result_pool , iterpool ) ) ; if ( ! prev_history ) break ; fhd = prev_history -> fsap_data ; if ( fhd -> is_interesting ) break ; } svn_pool_destroy ( iterpool ) ; } * prev_history_p = prev_history ; return SVN_NO_ERROR ; }
Implement svn_fs_history_prev, set *PREV_HISTORY_P to a new
svn_fs_history_t object that represents the predecessory of
HISTORY.
Implement svn_fs_history_prev set * PREV_HISTORY_P to a new svn_fs_history_t object that represents the predecessory of HISTORY .
/* Special case: the root directory changes in every single
     revision, no exceptions.  And, the root can't be the target (or
     child of a target -- duh) of a copy.  So, if that's our path,
     then we need only decrement our revision by 1, and there you go. */