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

[PATCH] Re: Bug in exporting externals?

From: Noorul Islam K M <noorul_at_collab.net>
Date: Wed, 01 Jun 2011 14:56:04 +0530

Noorul Islam K M <noorul_at_collab.net> writes:

> Noorul Islam K M <noorul_at_collab.net> writes:
>
>> Noorul Islam K M <noorul_at_collab.net> writes:
>>
>>> While working on issue 3799, in one of the review comments julianf said
>>> the following about number 10 test in external_tests.py.
>>>
>>> <quote>
>>> A/B/gamma is only an external: it does not appear in the WC until
>>> Subversion processes the external definitions.
>>>
>>> It looks to me like that failure was showing us a bug. If I run the
>>> test, without your patch, in verbose mode, I see:
>>>
>>> CMD: svn export svn-test-work/working_copies/externals_tests-10
>>> svn-test-work/working_copies/externals_tests-10.export [...]
>>> A svn-test-work/working_copies/externals_tests-10.export/A
>>> A svn-test-work/working_copies/externals_tests-10.export/A/B
>>> A svn-test-work/working_copies/externals_tests-10.export/A/B/lambda
>>> A svn-test-work/working_copies/externals_tests-10.export/A/B/gamma
>>> [...]
>>> A svn-test-work/working_copies/externals_tests-10.export/A/B/gamma
>>> [...]
>>> CMD: svn export --ignore-externals
>>> svn-test-work/working_copies/externals_tests-10
>>> svn-test-work/working_copies/externals_tests-10.export [...]
>>> A svn-test-work/working_copies/externals_tests-10.export/A
>>> A svn-test-work/working_copies/externals_tests-10.export/A/B
>>> A svn-test-work/working_copies/externals_tests-10.export/A/B/lambda
>>> A svn-test-work/working_copies/externals_tests-10.export/A/B/gamma
>>> [...]
>>>
>>> There is a comment in the test about --ignore-externals not ignoring
>>> A/B/gamma. That's a bug. And the first export (without
>>> --ignore-externals) is also buggy. It shouldn't export A/B/gamma twice.
>>>
>>> We shouldn't just quietly tweak the test to hide the bug. We should
>>> write a new test specifically to check for that bug, or fix the bug, or
>>> file an issue, or write to the dev@ list about it. Something.
>>>
>>> - Julian
>>> </quote>
>>>
>>> I tried to re-create this out of test environment and I came up with a
>>> reproduction script which is attached.
>>>
>>> Here I have a repository with the following files
>>>
>>> A/B/lambda
>>> A/D/gamma
>>>
>>> Along with this I have an external set on A/B as
>>>
>>> "^/A/D/gamma gamma"
>>>
>>> Now while exporting the working copy. A/B/gamma is exported twice which
>>> looks like a bug and while exporting the WC with --ignore-externals
>>> A/B/gamma is exported once which also seems to be a bug since A/B/gamma
>>> is an external.
>>>
>>> I can go ahead and create an issue for this if people can confirm this.
>>>
>>
>> Somehow I missed the attachment. Here is it.
>>
>> Thanks and Regards
>> Noorul
>>
>
> Really sorry about the previous mail in which I attached the script
> inline and also script had some issues. Please find attached the correct
> one.
>

Attached is the patch which fixes this issue.

Log

[[[

Fix a bug in 'svn export' because of which externals are exported twice
when exporting a working copy having externals.

* subversion/libsvn_client/export.c
  (copy_versioned_files): Do not copy an external file here. This is
    done down the line in the function.

* subversion/tests/cmdline/externals_tests.py
  (export_wc_with_externals): Remove XFail marker.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
]]]

Thanks and Regards
Noorul

Index: subversion/tests/cmdline/externals_tests.py
===================================================================
--- subversion/tests/cmdline/externals_tests.py (revision 1130008)
+++ subversion/tests/cmdline/externals_tests.py (working copy)
@@ -737,7 +737,6 @@
 
 # Test for issue #2429
 @Issue(2429)
-_at_XFail()
 def export_wc_with_externals(sbox):
   "test exports from working copies with externals"
 
Index: subversion/libsvn_client/export.c
===================================================================
--- subversion/libsvn_client/export.c (revision 1130008)
+++ subversion/libsvn_client/export.c (working copy)
@@ -505,10 +505,20 @@
           else if (child_kind == svn_node_file
                    && depth >= svn_depth_files)
             {
- SVN_ERR(copy_one_versioned_file(child_abspath, target_abspath,
- ctx, revision,
- native_eol, ignore_keywords,
- iterpool));
+ svn_node_kind_t external_kind;
+
+ SVN_ERR(svn_wc__read_external_info(&external_kind,
+ NULL, NULL, NULL,
+ NULL, ctx->wc_ctx,
+ child_abspath,
+ child_abspath, TRUE,
+ pool, pool));
+
+ if (external_kind != svn_node_file)
+ SVN_ERR(copy_one_versioned_file(child_abspath, target_abspath,
+ ctx, revision,
+ native_eol, ignore_keywords,
+ iterpool));
             }
         }
 
Received on 2011-06-01 11:28:13 CEST

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.