Author: hwright
Date: Fri Aug 12 00:52:01 2011
New Revision: 1156925

URL: http://svn.apache.org/viewvc?rev=1156925&view=rev
Log:
On the fs-py branch:
Remove the youngest_rev_cache member from the FS data object, in favor of the
Python value.

* subversion/python/svn/fs.py
  (FS._ensure_revision_exists): Remove the translation of the error message.
  (FS._open_fs): Read the youngest rev.

* subversion/libsvn_fs_py/fs.h
  (fs_fs_data_t): Remove youngest_rev_cache member.
 
* subversion/libsvn_fs_py/fs_fs.c
  (svn_fs_py__open): Don't read the youngest rev (that's now done in Python).
  (svn_fs_py__youngest_rev): Don't set the youngest rev cache here.
  (commit_body): Set the Python youngest rev, not the C one.
  (svn_fs_py__create): Don't set the youngest rev.
 
* subversion/libsvn_fs_py/rep-cache.c
  (rep_has_been_born): Fetch the youngest_cache rev from the Python object.

* subversion/libsvn_fs_py/py_util.c
  (set_int_attr_baton, set_int_attr, svn_fs_py__set_int_attr): New.

* subversion/libsvn_fs_py/py_util.h
  (svn_fs_py__set_int_attr): New.

Modified:
    subversion/branches/fs-py/subversion/libsvn_fs_py/fs.h
    subversion/branches/fs-py/subversion/libsvn_fs_py/fs_fs.c
    subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c
    subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.h
    subversion/branches/fs-py/subversion/libsvn_fs_py/rep-cache.c
    subversion/branches/fs-py/subversion/python/svn/fs.py

Modified: subversion/branches/fs-py/subversion/libsvn_fs_py/fs.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/libsvn_fs_py/fs.h?rev=1156925&r1=1156924&r2=1156925&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/libsvn_fs_py/fs.h (original)
+++ subversion/branches/fs-py/subversion/libsvn_fs_py/fs.h Fri Aug 12 00:52:01 
2011
@@ -206,9 +206,6 @@ typedef struct fs_fs_shared_data_t
 /* Private (non-shared) FSFS-specific data for each svn_fs_t object. */
 typedef struct fs_fs_data_t
 {
-  /* The revision that was youngest, last time we checked. */
-  svn_revnum_t youngest_rev_cache;
-
   /* The fsfs.conf file, parsed.  Allocated in FS->pool. */
   svn_config_t *config;
 

Modified: subversion/branches/fs-py/subversion/libsvn_fs_py/fs_fs.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/libsvn_fs_py/fs_fs.c?rev=1156925&r1=1156924&r2=1156925&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/libsvn_fs_py/fs_fs.c (original)
+++ subversion/branches/fs-py/subversion/libsvn_fs_py/fs_fs.c Fri Aug 12 
00:52:01 2011
@@ -1265,7 +1265,7 @@ svn_fs_py__open(svn_fs_t *fs, const char
   /* Read the configuration file. */
   SVN_ERR(read_config(fs, pool));
 
-  return get_youngest(&(ffd->youngest_rev_cache), path, pool);
+  return SVN_NO_ERROR;
 }
 
 /* Wrapper around svn_io_file_create which ignores EEXIST. */
@@ -1743,8 +1743,6 @@ svn_fs_py__youngest_rev(svn_revnum_t *yo
 
   Py_DECREF(p_rev);
 
-  ffd->youngest_rev_cache = *youngest_p;
-
   return SVN_NO_ERROR;
 }
 
@@ -6156,7 +6154,7 @@ commit_body(void *baton, apr_pool_t *poo
      created. */
   *cb->new_rev_p = new_rev;
 
-  ffd->youngest_rev_cache = new_rev;
+  SVN_ERR(svn_fs_py__set_int_attr(ffd->p_fs, "__youngest_rev_cache", new_rev));
 
   /* Remove this transaction directory. */
   SVN_ERR(svn_fs_py__purge_txn(cb->fs, cb->txn->id, pool));
@@ -6306,7 +6304,6 @@ svn_fs_py__create(svn_fs_t *fs,
   SVN_ERR(write_format(path_format(fs, pool),
                        format, max_files_per_dir, FALSE, pool));
 
-  ffd->youngest_rev_cache = 0;
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c?rev=1156925&r1=1156924&r2=1156925&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c (original)
+++ subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.c Fri Aug 12 
00:52:01 2011
@@ -347,6 +347,42 @@ svn_fs_py__get_int_attr(int *result,
 }
 
 
+struct set_int_attr_baton
+{
+  PyObject *p_obj;
+  const char *name;
+  long int val;
+};
+
+
+static void
+set_int_attr(void *baton,
+             va_list argp)
+{
+  struct set_int_attr_baton *siab = baton;
+  PyObject *p_int;
+
+  p_int = PyInt_FromLong(siab->val);
+  if (PyErr_Occurred())
+    return;
+
+  PyObject_SetAttrString(siab->p_obj, siab->name, p_int);
+  Py_DECREF(p_int);
+
+  return;
+}
+
+
+svn_error_t *
+svn_fs_py__set_int_attr(PyObject *p_obj,
+                        const char *name,
+                        long int val)
+{
+  struct set_int_attr_baton siab = { p_obj, name, val };
+  return svn_error_trace(catch_py_exception(set_int_attr, &siab, NULL));
+}
+
+
 struct call_method_baton
 {
   PyObject **p_result;

Modified: subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.h?rev=1156925&r1=1156924&r2=1156925&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.h (original)
+++ subversion/branches/fs-py/subversion/libsvn_fs_py/py_util.h Fri Aug 12 
00:52:01 2011
@@ -50,6 +50,11 @@ svn_fs_py__convert_proplist(void *object
 svn_error_t *
 svn_fs_py__load_module(fs_fs_data_t *ffd);
 
+svn_error_t *
+svn_fs_py__set_int_attr(PyObject *p_obj,
+                        const char *name,
+                        long int val);
+
 /* Get an attribute value from a Python object, and return it in *RESULT,
    allocated in RESULT_POOL. */
 svn_error_t *

Modified: subversion/branches/fs-py/subversion/libsvn_fs_py/rep-cache.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/libsvn_fs_py/rep-cache.c?rev=1156925&r1=1156924&r2=1156925&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/libsvn_fs_py/rep-cache.c (original)
+++ subversion/branches/fs-py/subversion/libsvn_fs_py/rep-cache.c Fri Aug 12 
00:52:01 2011
@@ -34,6 +34,7 @@
 #include "private/svn_sqlite.h"
 
 #include "rep-cache-db.h"
+#include "py_util.h"
 
 /* A few magic values */
 #define REP_CACHE_SCHEMA_FORMAT   1
@@ -61,7 +62,8 @@ rep_has_been_born(representation_t *rep,
 
   SVN_ERR_ASSERT(rep);
 
-  youngest = ffd->youngest_rev_cache;
+  SVN_ERR(svn_fs_py__get_int_attr(&youngest, ffd->p_fs,
+                                  "__youngest_rev_cache"));
   if (youngest < rep->revision)
   {
     /* Stale cache. */

Modified: subversion/branches/fs-py/subversion/python/svn/fs.py
URL: 
http://svn.apache.org/viewvc/subversion/branches/fs-py/subversion/python/svn/fs.py?rev=1156925&r1=1156924&r2=1156925&view=diff
==============================================================================
--- subversion/branches/fs-py/subversion/python/svn/fs.py (original)
+++ subversion/branches/fs-py/subversion/python/svn/fs.py Fri Aug 12 00:52:01 
2011
@@ -114,7 +114,7 @@ class FS(object):
     def _ensure_revision_exists(self, rev):
         if not svn.is_valid_revnum(rev):
             raise svn.SubversionException(svn.err.FS_NO_SUCH_REVISION,
-                                    _("Invalid revision number '%ld'") % rev)
+                                    "Invalid revision number '%ld'" % rev)
 
         # Did the revision exist the last time we checked the current file?
         if rev <= self.__youngest_rev_cache:
@@ -248,11 +248,12 @@ class FS(object):
         with open(self.__path_uuid, 'rb') as f:
             self.uuid = uuid.UUID(f.readline().rstrip())
 
-        self.__youngest_rev_cache = self.__read_current()
         self.__read_format()
         if self.format >= MIN_PACKED_FORMAT:
             self.__update_min_unpacked_rev()
 
+        self.__youngest_rev_cache = self._get_youngest()
+
 
     def __setup_paths(self):
         self.__path_uuid = os.path.join(self.path, PATH_UUID)


Reply via email to