Alien-SVN

 view release on metacpan or  search on metacpan

src/subversion/subversion/bindings/swig/python/core.py  view on Meta::CPAN


    def valid(self):
      """Check whether this memory pool and its parents
      are still valid"""
      return hasattr(self,"_is_valid")

    def assert_valid(self):
      """Assert that this memory_pool is still valid."""
      assert self.valid(), "This pool has already been destroyed"

    def clear(self):
      """Clear embedded memory pool. Invalidate all subpools."""
      pool = self._parent_pool
      apr_pool_clear(self)
      self.set_parent_pool(pool)

    def destroy(self):
      """Destroy embedded memory pool. If you do not destroy
      the memory pool manually, Python will destroy it
      automatically."""
      global application_pool

      self.assert_valid()

      is_application_pool = not self._parent_pool

      # Destroy pool
      self._apr_pool_destroy(self)

      # Clear application pool if necessary
      if is_application_pool:
        application_pool = None
        self._svn_swig_py_clear_application_pool()

      # Mark self as invalid
      if hasattr(self, "_parent_pool"):
        del self._parent_pool
      if hasattr(self, "_is_valid"):
        del self._is_valid

    def __del__(self):
      """Automatically destroy memory pools, if necessary"""
      if self.valid():
        self.destroy()

    def _mark_valid(self):
      """Mark pool as valid"""

      self._weakparent = None

      if self._parent_pool:
        import weakref

        # Make sure that the parent object is valid
        self._parent_pool.assert_valid()

        # Refer to self using a weakrefrence so that we don't
        # create a reference cycle
        weakself = weakref.ref(self)

        # Set up callbacks to mark pool as invalid when parents
        # are destroyed
        self._weakparent = weakref.ref(self._parent_pool._is_valid,
          lambda x: _mark_weakpool_invalid(weakself))

      # Mark pool as valid
      self._is_valid = lambda: 1

    def _wrap(self, obj):
      """Mark a SWIG object as owned by this pool"""
      self.assert_valid()
      if hasattr(obj, "set_parent_pool"):
        obj.set_parent_pool(self)
        return obj
      elif obj is None:
        return None
      else:
        return GenericSWIGWrapper(obj, self)


apr_pool_t_swigregister = _core.apr_pool_t_swigregister
apr_pool_t_swigregister(apr_pool_t)

# Initialize a global pool
svn_pool_create()


def svn_swig_mergeinfo_merge(*args):
  """svn_swig_mergeinfo_merge(apr_hash_t ** mergeinfo_inout, apr_hash_t changes, apr_pool_t pool) -> svn_error_t"""
  return _core.svn_swig_mergeinfo_merge(*args)

def svn_swig_mergeinfo_sort(*args):
  """svn_swig_mergeinfo_sort(apr_hash_t ** mergeinfo_inout, apr_pool_t pool) -> svn_error_t"""
  return _core.svn_swig_mergeinfo_sort(*args)

def svn_swig_rangelist_merge(*args):
  """svn_swig_rangelist_merge(svn_rangelist_t ** rangelist_inout, apr_array_header_t changes, apr_pool_t pool) -> svn_error_t"""
  return _core.svn_swig_rangelist_merge(*args)

def svn_swig_rangelist_reverse(*args):
  """svn_swig_rangelist_reverse(svn_rangelist_t ** rangelist_inout, apr_pool_t pool) -> svn_error_t"""
  return _core.svn_swig_rangelist_reverse(*args)
# This file is compatible with both classic and new-style classes.




( run in 0.408 second using v1.01-cache-2.11-cpan-adec679a428 )