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

[PATCH] Windows: Fix issue #2431 (blame ignores svn:eol-style)

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: 2005-11-21 23:00:51 CET

I can fix the bug, or at least come a long way, but have no way to
test atm. Could someone with easy windows access please test this
patch? Thanks!

Log:
[[[
Fix issue #2431 (blame ignores svn:eol-style).

* subversion/libsvn_client/blame.c
  (file_rev_baton): New members eol_style and eol_str for storing
  the requested file translation type.
  (get_eol_style): New. Function to adjust eol style from propdiff sent.
  (file_rev_handler): See if the file needs translation for the eol style,
  translate if it does.
  (svn_client_blame2): Initialize the new baton members.
]]]

Index: subversion/libsvn_client/blame.c
===================================================================
--- subversion/libsvn_client/blame.c (revision 17463)
+++ subversion/libsvn_client/blame.c (working copy)
@@ -21,6 +21,7 @@
 #include "client.h"

 #include "svn_client.h"
+#include "svn_subst.h"
 #include "svn_string.h"
 #include "svn_error.h"
 #include "svn_diff.h"
@@ -58,6 +59,8 @@
   const char *target;
   svn_client_ctx_t *ctx;
   const char *last_filename;
+ svn_subst_eol_style_t eol_style;
+ const char *eol_str;
   struct rev *rev; /* the rev for which blame is being assigned
                           during a diff */
   struct blame *blame; /* linked list of blame chunks */
@@ -326,6 +329,25 @@
     SVN_ERR (svn_io_file_close (dbaton->source_file, frb->currpool));
   SVN_ERR (svn_io_file_close (dbaton->file, frb->currpool));

+ if (svn_subst_translation_required (frb->eol_style, frb->eol_str,
+ NULL, FALSE, FALSE))
+ {
+ const char *translation_tgt;
+
+ SVN_ERR (svn_io_open_unique_file2 (NULL,
+ &translation_tgt,
+ frb->tmp_path,
+ ".tmp",
+ svn_io_file_del_on_pool_cleanup,
+ frb->currpool));
+ SVN_ERR (svn_subst_copy_and_translate3 (dbaton->filename,
+ translation_tgt,
+ frb->eol_str, FALSE,
+ NULL, FALSE, FALSE,
+ frb->currpool));
+ dbaton->filename = translation_tgt;
+ }
+
   /* Process this file. */
   SVN_ERR (add_file_blame (frb->last_filename,
                            dbaton->filename, frb));
@@ -367,6 +389,26 @@
   return SVN_NO_ERROR;
 }

+
+static void
+get_eol_style (svn_subst_eol_style_t *style,
+ const char **eol,
+ apr_array_header_t *prop_diffs)
+{
+ int i;
+
+ for (i = 0; i < prop_diffs->nelts; ++i)
+ {
+ const svn_prop_t *prop = &APR_ARRAY_IDX(prop_diffs, i, svn_prop_t);
+ if (strcmp (prop->name, SVN_PROP_EOL_STYLE) == 0)
+ {
+ svn_subst_eol_style_from_value
+ (style, eol, prop->value ? prop->value->data : NULL);
+ return;
+ }
+ }
+}
+
 static svn_error_t *
 file_rev_handler (void *baton, const char *path, svn_revnum_t revnum,
                   apr_hash_t *rev_props,
@@ -386,6 +428,9 @@
   /* If this file has a non-textual mime-type, bail out. */
   SVN_ERR (check_mimetype (prop_diffs, frb->target, frb->currpool));

+ /* */
+ get_eol_style (&frb->eol_style, &frb->eol_str, prop_diffs);
+
   if (frb->ctx->notify_func2)
     {
       svn_wc_notify_t *notify
@@ -526,6 +571,8 @@
   frb.target = target;
   frb.ctx = ctx;
   frb.last_filename = NULL;
+ frb.eol_style = svn_subst_eol_style_none;
+ frb.eol_str = NULL;
   frb.blame = NULL;
   frb.avail = NULL;
Received on Mon Nov 21 23:03:08 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.