[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Fix issue 1037 (Repository UUIDs)

From: <mbk_at_boredom.org>
Date: 2003-01-29 06:08:17 CET

This is a significant change (it requires a dump/load cycle) and I have
zero experience with BDB or libsvn_fs, so please review thoroughly. :-)
I'm sending this before make check has completed; I want to go to bed.

--ben

Fix issue 1037 (repository should get GUID/UUID at creation time).
Various approaches have been discussed at length on the dev mailing-list;
the current consensus is that
  1.) this is important functionality
  2.) almost any implementation is better than no implementation

In that light, this change adds a new BDB table to the FS: uuids.
The table is a RECNO table, with fixed-length records of length
sizeof(uuid). The first record in this table is considered the
repository's own UUID. This value is preserved across dump/load
cycles. If one wants to load without changing the UUID, it can
simply be removed from dump file (it is always the third line).

* subversion/include/svn_fs.h
  (svn_fs_get_uuid, svn_fs_set_uuid): prototypes for new functions.
  
* subversion/include/svn_repos.h
  (SVN_REPOS_DUMPFILE_UUID): Macro for UUID header.
  (svn_repos_parse_fns_t): added uuid_record, a pointer to
   a function that handles UUID records.

* subversion/include/svn_props.h
  (SVN_REPOS_ENTRY_UUID): Macro for svn:entry:uuid prop.

* subversion/include/svn_wc.h:
  (svn_wc_entry_t): added uuid.
  
* subversion/libsvn_fs/uuid.c, subversion/libsvn_fs/bdb/uuids-table.c,
  subversion/libsvn_fs/bdb/uuids-table.h: New files.

* subversion/libsvn_fs/fs.c: Added include of bdb/uuids-table.h
  (cleanup_fs): Cleanup fs-uuids.
  (svn_fs_create_berkeley): Create uuids table.
  (svn_fs_open_berkeley): Open uuids table.

* subversion/libsvn_fs/fs.h
  (svn_fs_t): Added uuids DB member.

* subversion/libsvn_wc/entries.c
  (svn_wc__attrs_to_entry, write_entry): handle SVN_WC__ENTRY_ATTR_UUID
  (fold_entry): handle SVN_WC__ENTRY_MODIFY_UUID
  
* subversion/libsvn_wc/entries.h
  (SVN_WC__ENTRY_ATTR_UUID): Macro for uuid xml-entry-attribute.
  (SVN_WC__ENTRY_MODIFY_UUID): Macro for bit to indicate changes
   to the UUID.
  
* subversion/libsvn_wc/update_editor.c
  (change_dir_prop): handle SVN_PROP_ENTRY_UUID.
  (svn_wc_install_file): handle SVN_PROP_ENTRY_UUID.

* subversion/libsvn_repos/dump.c
  (svn_repos_dump_fs): include UUID in new section immediately after
   magic header.

* subversion/libsvn_repos/checkout.c
  (set_any_props): Simulate the presence of a UUID property on all files.

* subversion/libsvn_repos/load.c
  (svn_repos_parse_dumpstream): Handle a UUID section; call uuid_record().
  (uuid_record): New function.
  (svn_repos_get_fs_build_parser): Set parser-uuid_record to point to
   uuid_record.

Index: subversion/include/svn_fs.h
===================================================================
--- subversion/include/svn_fs.h (revision 4645)
+++ subversion/include/svn_fs.h (working copy)
@@ -1427,7 +1427,29 @@
                               apr_pool_t *pool);
 
 
+
+/* UUID manipulation. */
+
+/** Populate @a *uuid with the UUID associated with @a fs.
+ *
+ * Populate @a *uuid with the UUID associated with @a fs.
+ */
+
+svn_error_t *
+svn_fs_get_uuid(svn_fs_t *fs,
+ const char **uuid,
+ apr_pool_t *pool);
+
+
+/** Associate @a *uuid with @a fs.
+ *
+ * Associate @a *uuid with @a fs.
+ */
 
+svn_error_t *
+svn_fs_set_uuid(svn_fs_t *fs,
+ const char *uuid,
+ apr_pool_t *pool);
 
 
 /* Non-historical properties. */
Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 4645)
+++ subversion/include/svn_repos.h (working copy)
@@ -734,6 +734,7 @@
 /* The RFC822-style headers in our dumpfile format. */
 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER SVN-fs-dump-format-version
 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 1
+#define SVN_REPOS_DUMPFILE_UUID UUID
 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH Content-length
 
 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER Revision-number
@@ -818,6 +819,17 @@
                                        void *parse_baton,
                                        apr_pool_t *pool);
 
+ /** The parser has discovered a new uuid record within the parsing
+ * session represented by @a parse_baton.
+ *
+ * The parser has discovered a new uuid record within the parsing
+ * session represented by @a parse_baton. The uuid's value is
+ * @a uuid, and it is allocated in @a pool.
+ */
+ svn_error_t *(*uuid_record) (const char *uuid,
+ void *parse_baton,
+ apr_pool_t *pool);
+
   /** The parser has discovered a new node record within the current
    * revision represented by @a revision_baton.
    *
Index: subversion/include/svn_props.h
===================================================================
--- subversion/include/svn_props.h (revision 4645)
+++ subversion/include/svn_props.h (working copy)
@@ -225,6 +225,9 @@
 /** The author who last committed to this entry. */
 #define SVN_PROP_ENTRY_LAST_AUTHOR SVN_PROP_ENTRY_PREFIX last-author
 
+/** The UUID of this entry's repository. */
+#define SVN_PROP_ENTRY_UUID SVN_PROP_ENTRY_PREFIX uuid
+
 /** When custom, user-defined properties are passed over the wire, they will
  * have this prefix added to their name.
  */
Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h (revision 4645)
+++ subversion/include/svn_wc.h (working copy)
@@ -540,6 +540,9 @@
   /** canonical repository url */
   const char *repos;
 
+ /** repository uuid */
+ const char *uuid;
+
   /** node kind (file, dir, ...) */
   svn_node_kind_t kind;
 
Index: subversion/libsvn_fs/uuid.c
===================================================================
--- subversion/libsvn_fs/uuid.c (working copy)
+++ subversion/libsvn_fs/uuid.c (working copy)
@@ -0,0 +1,96 @@
+/* uuid.c : operations on repository uuids
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2003 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+#include assert.h
+
+#include fs.h
+#include trail.h
+#include err.h
+#include bdb/uuids-table.h
+
+
+struct get_uuid_args {
+ svn_fs_t *fs;
+ int idx;
+ const char **uuid;
+};
+
+
+static svn_error_t *
+txn_body_get_uuid (void *baton, trail_t *trail)
+{
+ struct get_uuid_args *args = baton;
+
+ SVN_ERR (svn_fs__bdb_get_uuid (args-fs, args-idx, args-uuid, trail));
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_fs_get_uuid (svn_fs_t *fs,
+ const char **uuid,
+ apr_pool_t *pool)
+{
+ struct get_uuid_args args;
+
+ SVN_ERR (svn_fs__check_fs (fs));
+
+ args.fs = fs;
+ args.idx = 1;
+ args.uuid = uuid;
+ SVN_ERR (svn_fs__retry_txn (fs, txn_body_get_uuid, args, pool));
+
+ return SVN_NO_ERROR;
+}
+
+
+struct set_uuid_args {
+ svn_fs_t *fs;
+ int idx;
+ const char *uuid;
+};
+
+
+static svn_error_t *
+txn_body_set_uuid (void *baton, trail_t *trail)
+{
+ struct set_uuid_args *args = baton;
+
+ SVN_ERR (svn_fs__bdb_set_uuid (args-fs, args-idx, args-uuid, trail));
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_fs_set_uuid (svn_fs_t *fs,
+ const char *uuid,
+ apr_pool_t *pool)
+{
+ struct set_uuid_args args;
+
+ SVN_ERR (svn_fs__check_fs (fs));
+
+ args.fs = fs;
+ args.idx = 1;
+ args.uuid = uuid;
+ SVN_ERR (svn_fs__retry_txn (fs, txn_body_set_uuid, args, pool));
+
+ return SVN_NO_ERROR;
+}
+
Index: subversion/libsvn_fs/bdb/uuids-table.c
===================================================================
--- subversion/libsvn_fs/bdb/uuids-table.c (working copy)
+++ subversion/libsvn_fs/bdb/uuids-table.c (working copy)
@@ -0,0 +1,125 @@
+/* uuids-table.c : operations on the `uuids' table
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2003 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+#include apr_uuid.h
+
+#include bdb_compat.h
+#include svn_fs.h
+#include ../fs.h
+#include ../err.h
+#include dbt.h
+#include ../trail.h
+#include bdb-err.h
+#include uuids-table.h
+
+
+/*** Creating and opening the uuids table. ***/
+
+int
+svn_fs__bdb_open_uuids_table (DB **uuids_p,
+ DB_ENV *env,
+ int create)
+{
+ const u_int32_t open_flags = (create ? (DB_CREATE | DB_EXCL) : 0);
+ char buffer[APR_UUID_FORMATTED_LENGTH+1];
+ DB *uuids;
+
+ BDB_ERR (svn_fs__bdb_check_version());
+ BDB_ERR (db_create (uuids, env, 0));
+ BDB_ERR (uuids-set_re_len (uuids, sizeof(buffer)));
+ BDB_ERR (uuids-open (SVN_BDB_OPEN_PARAMS(uuids, NULL),
+ uuids, 0, DB_RECNO,
+ open_flags | SVN_BDB_AUTO_COMMIT,
+ 0666));
+
+ if (create)
+ {
+ DBT key, value;
+ apr_uuid_t uuid;
+ int recno = 0;
+
+ svn_fs__clear_dbt ();
+ key.data = recno;
+ key.size = sizeof(recno);
+
+ svn_fs__clear_dbt (value);
+ value.data = buffer;
+ value.size = sizeof(buffer);
+
+ apr_uuid_get (uuid);
+ apr_uuid_format (buffer, uuid);
+
+ BDB_ERR (uuids-put
+ (uuids, 0,
+ key, value,
+ DB_APPEND | SVN_BDB_AUTO_COMMIT));
+ }
+
+ *uuids_p = uuids;
+ return 0;
+}
+
+svn_error_t *svn_fs__bdb_get_uuid (svn_fs_t *fs,
+ int idx,
+ const char **uuid,
+ trail_t *trail)
+{
+ char buffer[APR_UUID_FORMATTED_LENGTH+1];
+ DB *uuids = fs-uuids;
+ DBT key;
+ DBT value;
+
+ svn_fs__clear_dbt ();
+ key.data =
+ key.size = sizeof(idx);
+
+ svn_fs__clear_dbt (value);
+ value.data = buffer;
+ value.size = sizeof(buffer);
+
+ SVN_ERR (BDB_WRAP (fs,
+ get repository uuid,
+ uuids-get (uuids, trail-db_txn, key, value, 0)));
+
+ *uuid = apr_pstrmemdup(trail-pool, value.data, value.size);
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *svn_fs__bdb_set_uuid (svn_fs_t *fs,
+ int idx,
+ const char *uuid,
+ trail_t *trail)
+{
+ DB *uuids = fs-uuids;
+ DBT key;
+ DBT value;
+
+ svn_fs__clear_dbt ();
+ key.data =
+ key.size = sizeof(idx);
+
+ svn_fs__clear_dbt (value);
+ value.size = strlen(uuid) + 1;
+ value.data = apr_pstrmemdup(trail-pool, uuid, value.size);
+
+ SVN_ERR (BDB_WRAP (fs,
+ get repository uuid,
+ uuids-put (uuids, trail-db_txn, key, value, 0)));
+
+ return SVN_NO_ERROR;
+}
Index: subversion/libsvn_fs/bdb/uuids-table.h
===================================================================
--- subversion/libsvn_fs/bdb/uuids-table.h (working copy)
+++ subversion/libsvn_fs/bdb/uuids-table.h (working copy)
@@ -0,0 +1,68 @@
+/* uuids-table.h : internal interface to `uuids' table
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2003 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+#ifndef SVN_LIBSVN_FS_UUIDS_TABLE_H
+#define SVN_LIBSVN_FS_UUIDS_TABLE_H
+
+#include db.h
+#include svn_io.h
+#include svn_fs.h
+
+#ifdef __cplusplus
+extern C {
+#endif /* __cplusplus */
+
+
+/* Open a `uuids' table in @a env.
+ *
+ * Open a `uuids' table in @a env. If @a create is non-zero, create
+ * one if it doesn't exist. Set @a *uuids_p to the new table.
+ * Return a Berkeley DB error code.
+ */
+int svn_fs__bdb_open_uuids_table (DB **uuids_p,
+ DB_ENV *env,
+ int create);
+
+/* Get the UUID at index @a idx in the uuids table within @a fs,
+ * storing the result in @a *uuid.
+ *
+ * Get the UUID at index @a idx in the uuids table within @a fs,
+ * storing the result in @a *uuid.
+ */
+
+svn_error_t *svn_fs__bdb_get_uuid (svn_fs_t *fs,
+ int idx,
+ const char **uuid,
+ trail_t *trail);
+
+/* Set the UUID at index @a idx in the uuids table within @a fs
+ * to @a uuid.
+ *
+ * Set the UUID at index @a idx in the uuids table within @a fs,
+ * to @a uuid.
+ */
+
+svn_error_t *svn_fs__bdb_set_uuid (svn_fs_t *fs,
+ int idx,
+ const char *uuid,
+ trail_t *trail);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SVN_LIBSVN_FS_UUIDS_TABLE_H */
Index: subversion/libsvn_fs/fs.c
===================================================================
--- subversion/libsvn_fs/fs.c (revision 4645)
+++ subversion/libsvn_fs/fs.c (working copy)
@@ -43,6 +43,7 @@
 #include bdb/changes-table.h
 #include bdb/reps-table.h
 #include bdb/strings-table.h
+#include bdb/uuids-table.h
 
 
 /* Checking for return values, and reporting errors. */
@@ -160,6 +161,7 @@
   SVN_ERR (cleanup_fs_db (fs, fs-changes, changes));
   SVN_ERR (cleanup_fs_db (fs, fs-representations, representations));
   SVN_ERR (cleanup_fs_db (fs, fs-strings, strings));
+ SVN_ERR (cleanup_fs_db (fs, fs-uuids, uuids));
 
   /* Checkpoint any changes. */
   {
@@ -507,6 +509,10 @@
                      svn_fs__bdb_open_strings_table (fs-strings,
                                                      fs-env, 1));
   if (svn_err) goto error;
+ svn_err = BDB_WRAP (fs, creating `uuids' table,
+ svn_fs__bdb_open_uuids_table (fs-uuids,
+ fs-env, 1));
+ if (svn_err) goto error;
 
   /* Initialize the DAG subsystem. */
   svn_err = svn_fs__dag_init_fs (fs);
@@ -578,6 +584,10 @@
                      svn_fs__bdb_open_strings_table (fs-strings,
                                                      fs-env, 0));
   if (svn_err) goto error;
+ svn_err = BDB_WRAP (fs, creating `uuids' table,
+ svn_fs__bdb_open_uuids_table (fs-uuids,
+ fs-env, 0));
+ if (svn_err) goto error;
 
   return SVN_NO_ERROR;
   
Index: subversion/libsvn_fs/fs.h
===================================================================
--- subversion/libsvn_fs/fs.h (revision 4645)
+++ subversion/libsvn_fs/fs.h (working copy)
@@ -53,6 +53,7 @@
   DB *revisions;
   DB *strings;
   DB *transactions;
+ DB *uuids;
 
   /* A callback function for printing warning messages, and a baton to
      pass through to it. */
Index: subversion/libsvn_wc/entries.c
===================================================================
--- subversion/libsvn_wc/entries.c (revision 4645)
+++ subversion/libsvn_wc/entries.c (working copy)
@@ -373,6 +373,14 @@
       *modify_flags |= SVN_WC__ENTRY_MODIFY_CHECKSUM;
   }
 
+ /* UUID. */
+ {
+ entry-uuid = apr_hash_get (atts, SVN_WC__ENTRY_ATTR_UUID,
+ APR_HASH_KEY_STRING);
+ if (entry-uuid)
+ *modify_flags |= SVN_WC__ENTRY_MODIFY_UUID;
+ }
+
   /* Setup last-committed values. */
   {
     const char *cmt_datestr, *cmt_revstr;
@@ -914,6 +922,10 @@
     apr_hash_set (atts, SVN_WC__ENTRY_ATTR_CMT_AUTHOR, APR_HASH_KEY_STRING,
                   entry-cmt_author);
 
+ if (entry-uuid)
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_UUID, APR_HASH_KEY_STRING,
+ entry-uuid);
+
   if (entry-cmt_date)
     {
       apr_hash_set (atts, SVN_WC__ENTRY_ATTR_CMT_DATE, APR_HASH_KEY_STRING,
@@ -945,12 +957,14 @@
 
       if (entry-kind == svn_node_dir)
         {
- /* We don't write url or revision for subdir
+ /* We don't write url, revision, or uuid for subdir
              entries. */
           apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REVISION, APR_HASH_KEY_STRING,
                         NULL);
           apr_hash_set (atts, SVN_WC__ENTRY_ATTR_URL, APR_HASH_KEY_STRING,
                         NULL);
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_UUID, APR_HASH_KEY_STRING,
+ NULL);
         }
       else
         {
@@ -960,7 +974,14 @@
           if (entry-revision == this_dir-revision)
             apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REVISION,
                           APR_HASH_KEY_STRING, NULL);
-
+
+ /* If this is not the this dir entry, and the uuid is
+ the same as that of the this dir entry, don't write out
+ the uuid. */
+ if (!strcmp(entry-uuid, this_dir-uuid))
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_UUID,
+ APR_HASH_KEY_STRING, NULL);
+
           /* If this is not the this dir entry, and the url is
              trivially calculable from that of the this dir entry,
              don't write out the url */
@@ -1176,6 +1197,11 @@
                             ? apr_pstrdup (pool, entry-cmt_author)
                             : NULL;
 
+ if (modify_flags SVN_WC__ENTRY_MODIFY_UUID)
+ cur_entry-uuid = entry-uuid
+ ? apr_pstrdup (pool, entry-uuid)
+ : NULL;
+
   /* Absorb defaults from the parent dir, if any, unless this is a
      subdir entry. */
   if (cur_entry-kind != svn_node_dir)
Index: subversion/libsvn_wc/entries.h
===================================================================
--- subversion/libsvn_wc/entries.h (revision 4645)
+++ subversion/libsvn_wc/entries.h (working copy)
@@ -61,6 +61,7 @@
 #define SVN_WC__ENTRY_ATTR_CMT_REV committed-rev
 #define SVN_WC__ENTRY_ATTR_CMT_DATE committed-date
 #define SVN_WC__ENTRY_ATTR_CMT_AUTHOR last-author
+#define SVN_WC__ENTRY_ATTR_UUID uuid
 
 
 
@@ -112,6 +113,7 @@
 #define SVN_WC__ENTRY_MODIFY_CMT_REV 0x00008000
 #define SVN_WC__ENTRY_MODIFY_CMT_DATE 0x00010000
 #define SVN_WC__ENTRY_MODIFY_CMT_AUTHOR 0x00020000
+#define SVN_WC__ENTRY_MODIFY_UUID 0x00040000
 
 
 /* ...or perhaps this to mean all of those above... */
Index: subversion/libsvn_wc/update_editor.c
===================================================================
--- subversion/libsvn_wc/update_editor.c (revision 4645)
+++ subversion/libsvn_wc/update_editor.c (working copy)
@@ -785,6 +785,11 @@
           entry.cmt_author = apr_pstrdup (pool, value-data);
           modify_flags = SVN_WC__ENTRY_MODIFY_CMT_AUTHOR;
         }
+ else if ((! strcmp (name, SVN_PROP_ENTRY_UUID)) value)
+ {
+ entry.uuid = apr_pstrdup (pool, value-data);
+ modify_flags = SVN_WC__ENTRY_MODIFY_UUID;
+ }
 
       if (modify_flags)
         {
@@ -1512,6 +1517,8 @@
             entry_field = SVN_WC__ENTRY_ATTR_CMT_REV;
           else if (! strcmp (prop-name, SVN_PROP_ENTRY_COMMITTED_DATE))
             entry_field = SVN_WC__ENTRY_ATTR_CMT_DATE;
+ else if (! strcmp (prop-name, SVN_PROP_ENTRY_UUID))
+ entry_field = SVN_WC__ENTRY_ATTR_UUID;
           else
             continue;
 
Index: subversion/libsvn_repos/dump.c
===================================================================
--- subversion/libsvn_repos/dump.c (revision 4645)
+++ subversion/libsvn_repos/dump.c (working copy)
@@ -830,6 +830,7 @@
   svn_fs_t *fs = svn_repos_fs (repos);
   apr_pool_t *subpool = svn_pool_create (pool);
   svn_revnum_t youngest;
+ const char *uuid;
 
   /* Determine the current youngest revision of the filesystem. */
   SVN_ERR (svn_fs_youngest_rev (youngest, fs, pool));
@@ -857,7 +858,12 @@
   /* Write out general metadata for the dumpfile. In this case, a
      magic header followed by a dumpfile format version. */
   SVN_ERR (svn_stream_printf (stream, pool, SVN_REPOS_DUMPFILE_MAGIC_HEADER
- : %d\n, SVN_REPOS_DUMPFILE_FORMAT_VERSION));
+ : %d\n\n, SVN_REPOS_DUMPFILE_FORMAT_VERSION));
+ /* Write out the UUID. */
+ SVN_ERR (svn_fs_get_uuid(fs, uuid, pool));
+
+ SVN_ERR (svn_stream_printf (stream, pool, SVN_REPOS_DUMPFILE_UUID
+ : %s\n\n, uuid));
                    
   /* Main loop: we're going to dump revision i. */
   for (i = start_rev; i = end_rev; i++)
Index: subversion/libsvn_repos/checkout.c
===================================================================
--- subversion/libsvn_repos/checkout.c (revision 4645)
+++ subversion/libsvn_repos/checkout.c (working copy)
@@ -67,7 +67,7 @@
 {
   apr_hash_index_t *hi;
   svn_revnum_t committed_rev;
- const char *last_author, *committed_date, *revision_str;
+ const char *last_author, *committed_date, *revision_str, *uuid;
   apr_hash_t *props = NULL;
 
   /* Get all user properties attached to PATH. */
@@ -101,9 +101,15 @@
                 strlen(SVN_PROP_ENTRY_LAST_AUTHOR),
                 last_author ?
                 svn_string_create (last_author, pool) : NULL);
-
-
- /* Loop over properties, send them through the editor. */
+
+ SVN_ERR (svn_fs_get_uuid (svn_fs_root_fs (root), uuid, pool));
+
+ apr_hash_set (props, SVN_PROP_ENTRY_UUID,
+ sizeof (SVN_PROP_ENTRY_UUID),
+ uuid ?
+ svn_string_create (uuid, pool) : NULL);
+
+ /* Loop over properties, send them through the editor. */
   for (hi = apr_hash_first (pool, props); hi; hi = apr_hash_next (hi))
     {
       const void *key;
Index: subversion/libsvn_repos/load.c
===================================================================
--- subversion/libsvn_repos/load.c (revision 4645)
+++ subversion/libsvn_repos/load.c (working copy)
@@ -372,6 +372,7 @@
   apr_pool_t *linepool = svn_pool_create (pool);
   apr_pool_t *revpool = svn_pool_create (pool);
   apr_pool_t *nodepool = svn_pool_create (pool);
+ const char *uuid;
 
   SVN_ERR (svn_stream_readline (stream, linebuf, linepool));
   if (linebuf == NULL)
@@ -451,6 +452,13 @@
           found_node = TRUE;
         }
 
+ /* Or is this the repos UUID? */
+ else if (NULL != (uuid = apr_hash_get (headers, SVN_REPOS_DUMPFILE_UUID,
+ APR_HASH_KEY_STRING)))
+ {
+ SVN_ERR (parse_fns-uuid_record (uuid, parse_baton, pool));
+ }
+
       /* Or is this bogosity?! */
       else
         {
@@ -682,6 +690,14 @@
 }
 
 
+static svn_error_t *
+uuid_record (const char *uuid,
+ void *parse_baton,
+ apr_pool_t *pool)
+{
+ struct parse_baton *pb = parse_baton;
+ return svn_fs_set_uuid (pb-fs, uuid, pool);
+}
 
 static svn_error_t *
 new_node_record (void **node_baton,
@@ -878,6 +894,7 @@
 
   parser-new_revision_record = new_revision_record;
   parser-new_node_record = new_node_record;
+ parser-uuid_record = uuid_record;
   parser-set_revision_property = set_revision_property;
   parser-set_node_property = set_node_property;
   parser-set_fulltext = set_fulltext;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:23:24 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.