FreeBSD/contrib/subversion/subversion/libsvn_delta/depth_filter_editor.c
/* Return TRUE iff changes to immediate children of the directory
   identified by PB, when those children are of node kind KIND, are
   allowed by the requested depth which this editor is trying to
   preserve.  EB is the edit baton.  */
Return TRUE iff changes to immediate children of the directory
identified by PB, when those children are of node kind KIND, are
allowed by the requested depth which this editor is trying to
preserve.  EB is the edit baton.
Return TRUE iff changes to immediate children of the directory identified by PB when those children are of node kind KIND are allowed by the requested depth which this editor is trying to preserve . EB is the edit baton .
static svn_boolean_t
okay_to_edit(struct edit_baton *eb,
             struct node_baton *pb,
             svn_node_kind_t kind)
{
  int effective_depth;
  if (pb->filtered)
    return FALSE;
  effective_depth = pb->dir_depth - (eb->has_target ? 1 : 0);
  switch (eb->requested_depth)
    {
    case svn_depth_empty:
      return (effective_depth <= 0);
    case svn_depth_files:
      return ((effective_depth <= 0)
              || (kind == svn_node_file && effective_depth == 1));
    case svn_depth_immediates:
      return (effective_depth <= 1);
    case svn_depth_unknown:
    case svn_depth_exclude:
    case svn_depth_infinity:
    default:
      SVN_ERR_MALFUNCTION_NO_RETURN();
    }
}
static svn_boolean_t okay_to_edit ( struct edit_baton * eb , struct node_baton * pb , svn_node_kind_t kind ) { int effective_depth ; if ( pb -> filtered ) return FALSE ; effective_depth = pb -> dir_depth - ( eb -> has_target ? 1 : 0 ) ; switch ( eb -> requested_depth ) { case svn_depth_empty : return ( effective_depth <= 0 ) ; case svn_depth_files : return ( ( effective_depth <= 0 ) || ( kind == svn_node_file && effective_depth == 1 ) ) ; case svn_depth_immediates : return ( effective_depth <= 1 ) ; case svn_depth_unknown : case svn_depth_exclude : case svn_depth_infinity : default : SVN_ERR_MALFUNCTION_NO_RETURN ( ) ; } }
Return TRUE iff changes to immediate children of the directory
identified by PB, when those children are of node kind KIND, are
allowed by the requested depth which this editor is trying to
preserve.
Return TRUE iff changes to immediate children of the directory identified by PB when those children are of node kind KIND are allowed by the requested depth which this editor is trying to preserve .
/* If we've already filter out the parent directory, we necessarily
     are filtering out its children, too.  */ /* Calculate the effective depth of the parent directory.

     NOTE:  "Depth" in this sense is not the same as the Subversion
     magic depth keywords.  Here, we're talking about a literal,
     integral, stacked depth of directories.

     The root of the edit is generally depth=1, subdirectories thereof
     depth=2, and so on.  But if we have an edit target -- which means
     that the real target of the edit operation isn't the root
     directory, but is instead some immediate child thereof -- we have
     to adjust our calculated effected depth such that the target
     itself is depth=1 (as are its siblings, which we trust aren't
     present in the edit at all), immediate subdirectories thereof are
     depth=2, and so on.
  */ /* Shouldn't reach; see svn_delta_depth_filter_editor() */