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

[PATCH] Enable use of internal diff when performing merge

From: <striker_at_apache.org>
Date: 2003-01-27 03:15:38 CET

Hi,

This is a rough implementation of replacing the external
diff3 call with our own merge code. In hand testing it
works.

Anyone have a problem with me committing this on a branch?

'make check' shows one buglet:

=============================================================
Expected rho and actual rho are different!
=============================================================
EXPECTED NODE TO BE:
=============================================================
 * Node name: rho
    Path: working_copies/trans_tests-5/A/D/G/rho
    Contents: None
    Properties: {}
    Attributes: {'status': 'CU'}
    Children: is a file.
=============================================================
ACTUAL NODE FOUND:
=============================================================
 * Node name: rho
    Path: working_copies/trans_tests-5/A/D/G/rho
    Contents: None
    Properties: {}
    Attributes: {'status': 'GU'}
    Children: is a file.
Unequal at node rho
Unequal at node G
Unequal at node D
Unequal at node A
Unequal at node trans_tests-5
Unequal at node working_copies
FAIL: trans_tests.py 5: update locally modified file with eol-style 'native'

If someone could explain to me what the idea is behind the test
that would be great. I looked at it for a few minutes and I don't
really see why it should be a conflict. Then again, that might just
be my mind tricking me into giving up for today and catching some
sleep...

Sander

PS. I get these failures when setting the display_original_in_conflicts flag
     to TRUE:
FAIL: basic_tests.py 7: basic conflict creation and resolution
FAIL: update_tests.py 6: delete files and update to resolve text conflicts
FAIL: merge_tests.py 1: performing a merge, with mixed results

Which seems logical, since they all expect diff3 -E output, not
diff3 -A output.

Index: subversion/libsvn_wc/merge.c
===================================================================
--- subversion/libsvn_wc/merge.c (revision 4529)
+++ subversion/libsvn_wc/merge.c (working copy)
@@ -19,6 +19,7 @@

 
 #include svn_wc.h
+#include svn_diff.h
 #include wc.h
 #include entries.h
 #include translate.h
@@ -46,8 +47,8 @@
   svn_subst_keywords_t *keywords;
   const char *eol;
   apr_status_t apr_err;
- int exit_code;
   const svn_wc_entry_t *entry;
+ svn_diff_t *diff;

   svn_path_split (merge_target, mt_pt, mt_bn, pool);

@@ -122,13 +123,32 @@
       SVN_ERR (svn_io_copy_file (right, tmp_right, TRUE, pool));

       /* Do the Deed, using all four scratch files. */
- SVN_ERR (svn_io_run_diff3 (.,
- tmp_target, tmp_left, tmp_right,
- target_label, left_label, right_label,
- result_f,
- exit_code,
- pool));
-
+ SVN_ERR (svn_diff3_file (diff, tmp_left, tmp_target, tmp_right, pool));
+
+ /* Labels fall back to sensible defaults if not specified. */
+ if (target_label)
+ target_label = apr_psprintf(pool, %s, target_label);
+ else
+ target_label = .working;
+
+ if (left_label)
+ left_label = apr_psprintf(pool, ||||||| %s, left_label);
+ else
+ left_label = ||||||| .old;
+
+ if (right_label)
+ right_label = apr_psprintf(pool, %s, right_label);
+ else
+ right_label = .new;
+
+ SVN_ERR (svn_diff3_file_output (result_f, diff,
+ tmp_left, tmp_target, tmp_right,
+ left_label, target_label, right_label,
+ =======, /* seperator */
+ FALSE, /* display original in conflict */
+ FALSE, /* try to resolve conflicts */
+ pool));
+
       /* Close the output file */
       apr_err = apr_file_close (result_f);
       if (apr_err)
@@ -136,7 +156,7 @@
           (apr_err, NULL,
            svn_wc_merge: unable to close tmp file `%s', result_target);

- if (exit_code == 1 ! dry_run) /* got a conflict */
+ if (svn_diff_contains_conflicts (diff) ! dry_run) /* got a conflict */
         {
           /* Preserve the three pre-merge files, and modify the
              entry (mark as conflicted, track the preserved files). */
@@ -249,7 +269,7 @@
           *merge_outcome = svn_wc_merge_conflict;

         }
- else if (exit_code == 1 dry_run)
+ else if (svn_diff_contains_conflicts (diff) dry_run)
         {
           *merge_outcome = svn_wc_merge_conflict;
         } /* end of conflict handling */

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 14 02:18:44 2006

This is an archived mail posted to the Subversion Dev mailing list.