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

[RFC] Committing and backporting a small portion of (initially) unused code for forward compatibility

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2006-06-26 23:45:37 CEST

After some discussion with Philip in an earlier thread, I'm working at
making svn_wc_merge2 loggy.

While doing so, I found that the log subsystem is missing 1 semantic
specific to merge: the ability to translate and install a file to a
non-versioned name based on the properties of a versioned target.
svn_wc_merge2 does this with the conflict files (.left, .right and
.mine).

Even though I'm adding code to trunk, I'd like all clients of the
current working copy format to be able to execute a
to-be-newly-invented command. When adding this now, we can prevent
another wc-format bump later.

I'd like to commit and (propose for) backport the patch below. Soon
after committing this patch, I'll also commit code which actually uses
the added code. It's already sitting in my working copy.

bye,

Erik.

Log
[[[
Allow installation of a file to a non-versioned target by
specifying which target to take translation-settings from.

* subversion/libsvn_wc/log.c
  (file_xfer_under_path): Take an extra versioned argument
   and use it to (de)translate file contents when specified.

  (log_do_file_xfer): Retrieve (optional) ARG_2 xml attribute
   which stores the versioned target and pass it to
   file_xfer_under_path.
]]]

Index: subversion/libsvn_wc/log.c
===================================================================
--- subversion/libsvn_wc/log.c (revision 20248)
+++ subversion/libsvn_wc/log.c (working copy)
@@ -207,10 +207,12 @@
       svn_wc__xfer_append: append contents of NAME to DEST
       svn_wc__xfer_cp_and_translate: copy NAME to DEST, doing any eol
                                        and keyword expansion according to
- the current property vals of DEST.
+ the current property vals of VERSIONED
+ or, if that's NULL, those of DEST.
       svn_wc__xfer_cp_and_detranslate: copy NAME to DEST, converting to LF
                                        and contracting keywords according to
- the current property vals of NAME.
+ the current property vals of VERSIONED
+ or, if that's NULL, those of NAME.

       When SPECIAL_ONLY is TRUE, only translate special,
       not keywords and eol-style.
@@ -220,18 +222,24 @@
 file_xfer_under_path(svn_wc_adm_access_t *adm_access,
                      const char *name,
                      const char *dest,
+ const char *versioned,
                      enum svn_wc__xfer_action action,
                      svn_boolean_t special_only,
                      svn_boolean_t rerun,
                      apr_pool_t *pool)
 {
   svn_error_t *err;
- const char *full_from_path, *full_dest_path;
+ const char *full_from_path, *full_dest_path, *full_versioned_path;

   full_from_path = svn_path_join(svn_wc_adm_access_path(adm_access), name,
                                  pool);
   full_dest_path = svn_path_join(svn_wc_adm_access_path(adm_access), dest,
                                  pool);
+ if (versioned)
+ full_versioned_path = svn_path_join(svn_wc_adm_access_path(adm_access),
+ versioned, pool);
+ else
+ full_versioned_path = NULL; /* Silence GCC uninitialised warning */

   switch (action)
     {
@@ -254,7 +262,8 @@

         err = svn_wc_translated_file2
           (&tmp_file,
- full_from_path, full_dest_path, adm_access,
+ full_from_path, versioned ? full_versioned_path : full_dest_path,
+ adm_access,
            SVN_WC_TRANSLATE_FROM_NF
            | SVN_WC_TRANSLATE_FORCE_COPY,
            pool);
@@ -282,7 +291,7 @@
         SVN_ERR(svn_wc_translated_file2
                 (&tmp_file,
                  full_from_path,
- full_from_path, adm_access,
+ versioned ? full_versioned_path : full_from_path, adm_access,
                  SVN_WC_TRANSLATE_TO_NF
                  | SVN_WC_TRANSLATE_FORCE_COPY,
                  pool));
@@ -538,12 +547,16 @@
 {
   svn_error_t *err;
   const char *dest = NULL;
+ const char *versioned;
   svn_boolean_t special_only;

   /* We have the name (src), and the destination is absolutely required. */
   dest = svn_xml_get_attr_value(SVN_WC__LOG_ATTR_DEST, atts);
   special_only =
     svn_xml_get_attr_value(SVN_WC__LOG_ATTR_ARG_1, atts) != NULL;
+ versioned =
+ svn_xml_get_attr_value(SVN_WC__LOG_ATTR_ARG_2, atts);
+
   if (! dest)
     return svn_error_createf(pick_error_code(loggy), NULL,
                              _("Missing 'dest' attribute in '%s'"),
@@ -551,8 +564,8 @@
                              (svn_wc_adm_access_path(loggy->adm_access),
                               loggy->pool));

- err = file_xfer_under_path(loggy->adm_access, name, dest, action,
- special_only, loggy->rerun, loggy->pool);
+ err = file_xfer_under_path(loggy->adm_access, name, dest, versioned,
+ action, special_only, loggy->rerun, loggy->pool);
   if (err)
     signal_error(loggy, err);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jun 26 23:46:05 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.