[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-cvs
Subject:    svn commit: rev 1606 - trunk/subversion/libsvn_wc trunk/subversion/libsvn_client
From:       sussman () tigris ! org
Date:       2002-03-28 17:42:23
[Download RAW message or body]

Author: sussman
Date: 2002-03-28 17:42 GMT
New Revision: 1606

Modified:
   trunk/subversion/libsvn_client/repos_diff.c
   trunk/subversion/libsvn_wc/log.c
Log:

Fixups/improvements/suggestions from gstein, regarding recent 'svn
merge' work.  Thanks!

* log.c (log_do_merge): if we do the merge in a subpool, it makes
  sense to construct the path arguments in that subpool too.

* repos_diff.c (struct file_baton):  oops, we want the parent_baton
  field completely removed, not just temporarily commented out.

  (make_dir_baton, make_file_baton): simplify by taking a full path,
  not a basename or parent path.  no need to take an edit baton
  either, if parent baton already has it.

     [when converting the editor, I was trying to make the smallest
      change possible, but greg is right -- the original interfaces
      are now crufty.  :-) ]

  (open_root): build an initial dir_baton using "".

  (delete_entry, add_file, open_file): simplify call to make_file_baton.

  (add_directory, open_directory):  simplify call to make_dir_baton.



Modified: trunk/subversion/libsvn_wc/log.c
==============================================================================
--- trunk/subversion/libsvn_wc/log.c	(original)
+++ trunk/subversion/libsvn_wc/log.c	Thu Mar 28 11:42:22 2002
@@ -361,8 +361,8 @@
 {
   const char *left, *right;
   const char *left_label, *right_label, *target_label;
-  apr_pool_t *subpool;
   svn_error_t *err;
+  apr_pool_t *subpool = svn_pool_create (loggy->pool);
 
   /* NAME is the basename of our merge_target.  Pull out LEFT and RIGHT. */
   left = svn_xml_get_attr_value (SVN_WC__LOG_ATTR_ARG_1, atts);
@@ -382,12 +382,11 @@
   target_label = svn_xml_get_attr_value (SVN_WC__LOG_ATTR_ARG_5, atts);
 
   /* Convert the 3 basenames into full paths. */
-  left = svn_path_join (loggy->path->data, left, loggy->pool);
-  right = svn_path_join (loggy->path->data, right, loggy->pool);
-  name = svn_path_join (loggy->path->data, name, loggy->pool);
+  left = svn_path_join (loggy->path->data, left, subpool);
+  right = svn_path_join (loggy->path->data, right, subpool);
+  name = svn_path_join (loggy->path->data, name, subpool);
   
   /* Now do the merge with our full paths. */
-  subpool = svn_pool_create (loggy->pool);
   err = svn_wc_merge (left, right, name,
                       left_label, right_label, target_label,
                       subpool);

Modified: trunk/subversion/libsvn_client/repos_diff.c
==============================================================================
--- trunk/subversion/libsvn_client/repos_diff.c	(original)
+++ trunk/subversion/libsvn_client/repos_diff.c	Thu Mar 28 11:42:22 2002
@@ -115,9 +115,6 @@
   svn_txdelta_window_handler_t apply_handler;
   void *apply_baton;
 
-  /* The baton for the parent directory.
-  struct dir_baton *dir_baton; */
-
   /* The overall crawler editor baton. */
   struct edit_baton *edit_baton;
 
@@ -134,45 +131,38 @@
   apr_pool_t *pool;
 };
 
-/* Create a new directory baton in POOL. NAME is the directory name sans
- * path. ADDED is set if this directory is being added rather than
- * replaced. PARENT_BATON is the baton of the parent directory, it will be
- * null if this is the root of the comparison hierarchy. The directory and
- * its parent may or may not exist in the working copy. EDIT_BATON is the
- * overall crawler editor baton.
+/* Create a new directory baton for PATH in POOL.  ADDED is set if
+ * this directory is being added rather than replaced. PARENT_BATON is
+ * the baton of the parent directory, it will be null if this is the
+ * root of the comparison hierarchy. The directory and its parent may
+ * or may not exist in the working copy. EDIT_BATON is the overall
+ * crawler editor baton.
  */
 static struct dir_baton *
-make_dir_baton (const char *name,
+make_dir_baton (const char *path,
                 struct dir_baton *parent_baton,
-                struct edit_baton *edit_baton,
                 svn_boolean_t added,
                 apr_pool_t *pool)
 {
   struct dir_baton *dir_baton = apr_pcalloc (pool, sizeof (*dir_baton));
 
   dir_baton->dir_baton = parent_baton;
-  dir_baton->edit_baton = edit_baton;
+  dir_baton->edit_baton = parent_baton->edit_baton;
   dir_baton->added = added;
   dir_baton->pool = pool;
-
-  dir_baton->path = apr_pstrdup (pool, 
-                                 parent_baton ? parent_baton->path : "");
-
-  if (name)
-    dir_baton->path = svn_path_join (dir_baton->path, name, pool);
+  dir_baton->path = apr_pstrdup (pool, path);
 
   return dir_baton;
 }
 
-/* Create a new file baton in POOL. NAME is the directory name sans
- * path, which is a child of directory PARENT_PATH. ADDED is set if
- * this file is being added rather than replaced.  EDIT_BATON is a
- * pointer to the global edit baton.
+/* Create a new file baton for PATH in POOL, which is a child of
+ * directory PARENT_PATH. ADDED is set if this file is being added
+ * rather than replaced.  EDIT_BATON is a pointer to the global edit
+ * baton.
  */
 static struct file_baton *
-make_file_baton (const char *name,
+make_file_baton (const char *path,
                  svn_boolean_t added,
-                 const char *parent_path,
                  void *edit_baton,
                  apr_pool_t *pool)
 {
@@ -181,8 +171,7 @@
   file_baton->edit_baton = edit_baton;
   file_baton->added = added;
   file_baton->pool = pool;
-
-  file_baton->path = svn_path_join (parent_path, name, pool);
+  file_baton->path = apr_pstrdup (pool, path);
 
   return file_baton;
 }
@@ -355,10 +344,15 @@
            void **root_baton)
 {
   struct edit_baton *eb = edit_baton;
-  struct dir_baton *b;
+  struct dir_baton *dir_baton = apr_pcalloc (pool, sizeof (*dir_baton));
+
+  dir_baton->dir_baton = NULL;
+  dir_baton->edit_baton = eb;
+  dir_baton->added = FALSE;
+  dir_baton->pool = pool;
+  dir_baton->path = "";
 
-  b = make_dir_baton (NULL, NULL, eb, FALSE, pool);
-  *root_baton = b;
+  *root_baton = dir_baton;
 
   return SVN_NO_ERROR;
 }
@@ -385,8 +379,8 @@
     case svn_node_file:
       {
         /* Compare a file being deleted against an empty file */
-        struct file_baton *b = make_file_baton (svn_path_basename (path, pool),
-                                                FALSE, pb->path,
+        struct file_baton *b = make_file_baton (path,
+                                                FALSE,
                                                 pb->edit_baton,
                                                 pool);
         SVN_ERR (get_file_from_ra (b));
@@ -420,8 +414,7 @@
 
   /* ### TODO: support copyfrom? */
 
-  b = make_dir_baton (svn_path_basename (path, pool),
-                      pb, pb->edit_baton, TRUE, pool);
+  b = make_dir_baton (path, pb, TRUE, pool);
   *child_baton = b;
 
   return SVN_NO_ERROR;
@@ -439,8 +432,7 @@
   struct dir_baton *pb = parent_baton;
   struct dir_baton *b;
 
-  b = make_dir_baton (svn_path_basename (path, pool),
-                      pb, pb->edit_baton, FALSE, pool);
+  b = make_dir_baton (path, pb, FALSE, pool);
   *child_baton = b;
 
   return SVN_NO_ERROR;
@@ -462,8 +454,7 @@
 
   /* ### TODO: support copyfrom? */
 
-  b = make_file_baton (svn_path_basename (path, pool),
-                       TRUE, pb->path, pb->edit_baton, pool);
+  b = make_file_baton (path, TRUE, pb->edit_baton, pool);
   *file_baton = b;
 
   SVN_ERR (get_empty_file (b->edit_baton, &b->path_start_revision));
@@ -483,8 +474,7 @@
   struct dir_baton *pb = parent_baton;
   struct file_baton *b;
 
-  b = make_file_baton (svn_path_basename (path, pool), 
-                       FALSE, pb->path, pb->edit_baton, pool);
+  b = make_file_baton (path, FALSE, pb->edit_baton, pool);
   *file_baton = b;
 
   SVN_ERR (get_file_from_ra (b));


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic