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

Issue 767: Uses temporary files in current directory

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2005-10-02 00:26:56 CEST

Karl recently added comments to issue 767 regarding merge using temporary
files in the current working directory. Although Eric Gillespie has added that
aspect to the issue, it was originally only about svn-commit.tmp being written
in the current dir.

I want to split issue 767 into its original purpose - the commit-tempfile - and
the merge problem. I don't think the merge problem is an incarnation of the
same problem; rather, I'm convinced the merge problem is a left-over from
issue 748 (svn merge only happens in ".").

I have the included patch sitting in my working copy, which fixes the merge
part of the issue.

Since I can't reach tigris now to actually do this, I thought I'd post
here since
this is the primary forum to discuss issues anyway.

bye,

Erik

Log:
[[[
Fix merge of added files using the current working directory for temp files.

* subversion/libsvn_client/repos_diff.c
  (create_empty_file): Create a temporary in the adm_access temp
  dir if we have a write lock, use a temp dir otherwise.
  (get_empty_file, apply_text_delta): Update to new calling convention
  for create_empty_file().
]]]

Index: subversion/libsvn_client/repos_diff.c
===================================================================
--- subversion/libsvn_client/repos_diff.c (revision 16293)
+++ subversion/libsvn_client/repos_diff.c (working copy)
@@ -361,25 +361,28 @@
  */
 static svn_error_t *
 create_empty_file (const char **empty_file,
- svn_boolean_t have_write_lock,
+ svn_wc_adm_access_t *adm_access,
                    apr_pool_t *pool)
 {
   apr_file_t *file;
   const char *temp_path;

- if (have_write_lock)
+ if (adm_access && svn_wc_adm_locked (adm_access))
     {
- temp_path = "tmp";
+ SVN_ERR (svn_wc_create_tmp_file (&file,
+ svn_wc_adm_access_path (adm_access),
+ FALSE, pool));
+ apr_file_name_get (empty_file, file);
     }
- else
+ else
     {
       const char *temp_dir;
       SVN_ERR (svn_io_temp_dir (&temp_dir, pool));
       temp_path = svn_path_join (temp_dir, "tmp", pool);
+ SVN_ERR (svn_io_open_unique_file (&file, empty_file, temp_path,
+ "", FALSE, pool));
     }

- SVN_ERR (svn_io_open_unique_file (&file, empty_file, temp_path,
- "", FALSE, pool));
   SVN_ERR (svn_io_file_close (file, pool));

   return SVN_NO_ERROR;
@@ -446,9 +449,7 @@
   /* Create the file if it does not exist */
   if (!b->empty_file)
     {
- svn_boolean_t have_lock;
- have_lock = (b->adm_access && svn_wc_adm_locked (b->adm_access));
- SVN_ERR (create_empty_file (&(b->empty_file), have_lock, b->pool));
+ SVN_ERR (create_empty_file (&(b->empty_file), b->adm_access, b->pool));

       /* Install a pool cleanup handler to delete the file */
       SVN_ERR (temp_file_cleanup_register (b->empty_file, b->pool));
@@ -705,7 +706,7 @@
                  void **handler_baton)
 {
   struct file_baton *b = file_baton;
- svn_boolean_t have_lock;
+ svn_wc_adm_access_t *adm_access;

   /* Open the file to be used as the base for second revision */
   SVN_ERR (svn_io_file_open (&(b->file_start_revision),
@@ -714,9 +715,21 @@

   /* Open the file that will become the second revision after applying the
      text delta, it starts empty */
- have_lock = (b->edit_baton->adm_access
- && svn_wc_adm_locked (b->edit_baton->adm_access));
- SVN_ERR (create_empty_file (&(b->path_end_revision), have_lock, b->pool));
+ if (b->edit_baton->adm_access)
+ {
+ svn_error_t *err;
+
+ err = svn_wc_adm_probe_retrieve (&adm_access, b->edit_baton->adm_access,
+ b->wcpath, pool);
+ if (err)
+ {
+ svn_error_clear (err);
+ adm_access = NULL;
+ }
+ }
+ else
+ adm_access = NULL;
+ SVN_ERR (create_empty_file (&(b->path_end_revision), adm_access, b->pool));
   SVN_ERR (temp_file_cleanup_register (b->path_end_revision, b->pool));
   SVN_ERR (svn_io_file_open (&(b->file_end_revision), b->path_end_revision,
                              APR_WRITE, APR_OS_DEFAULT, b->pool));
Received on Sun Oct 2 00:27:36 2005

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.