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

New FS API, open_path, cloning and dag_node_t

From: Branko Èibej <brane_at_xbc.nu>
Date: 2001-02-14 00:11:53 CET

I love generic subject lins. :-)

Now, here's the issue: While hammering on tree.c to get it in line with
the new FS API, I decded (and it seems that Jim tentatively agrees) that
we need a function that will call svn_fs__dag_open repeatedly to
traverse a path. It's called open_path in tree.c as of Jim's latest commits.

Now, often we'll call this function because we only want to read a node,
but sometimes we'll want to clone the node (for modifications) or its
parent (for delete). The cloning has to bubble up the path until it
reaches the root or a mutable node.

Now, what I'm proposing is that a) dag_node_t keeps track of its parent
and its name in the parent, and b) that open_path should construct a
list of DAG nodes. This node list could then be used directly to clone
the whole path.

This wouldn't increase processing time or memory footprint. One
potential problem is that we'd have to be careful not to hold on to the
node list past the lifetime of a trail, but I think we have to watch
that anyway.

Thoughts?

(Just to illustrate the proposed change:

Index: dag.c
===================================================================
RCS file: /cvs/subversion/subversion/libsvn_fs/dag.c,v
retrieving revision 1.14
diff -u -r1.14 dag.c
--- dag.c 2001/02/13 16:38:35 1.14
+++ dag.c 2001/02/13 23:10:35
@@ -34,6 +34,12 @@
      into an svn_fs_id_t). */
   svn_fs_id_t *id;
 
+ /* The node's parent node, NULL if this is the root. */
+ dag_node_t* parent;
+
+ /* The node's name in PARENT. */
+ const char* name;
+
   /* The contents of the node (i.e., the DB value, parsed into a
      skel). */
   skel_t *contents;
@@ -204,6 +210,10 @@
                                const char *name,
                                trail_t *trail)
 {
+ /* Do the opening bits, then ... */
+ child->parent = parent;
+ child->name = name;
+
   abort();
   /* NOTREACHED */
   return NULL;

-- 
Brane �ibej
    home:   <brane_at_xbc.nu>             http://www.xbc.nu/brane/
    work:   <branko.cibej_at_hermes.si>   http://www.hermes-softlab.com/
     ACM:   <brane_at_acm.org>            http://www.acm.org/
Received on Sat Oct 21 14:36:22 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.