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

Re: [PATCH] Stop 'svn import' from importing empty paths

From: S.Ramaswamy <ramaswamy_at_collab.net>
Date: 2005-04-11 17:14:07 CEST

> "S.Ramaswamy" <ramaswamy@collab.net> writes:
>
>> > Oh. Dude, when I said "some context structure", I meant one that was
private to the import operation. The svn_client_ctx_t is a very
inappropriate place for this new boolean.
>>
>> Yeah, I was feeling uneasy about changing a top level struct like
svn_client_ctx_t that is used all over libsvn_client. The other option is to
use a single member struct that only commit.c uses and add an extra
parameter to import*() functions. If that sounds like a
>> reasonable option, I can try that.
>
> This is exactly what I was going to suggest as a follow-up to my last mail
before having to run AFK for a bit.
>
>> Another option is a variant of the first patch - in addition to checking
for an empty src dir, let's also check for an empty
>> new_entries array (array of new parent directories to be created in the
repo). That should take care of "svn import -m "" empty-dir
URL-OF-REPOS/new-dir".
>
> I thought of that, but there's another problem. 'svn import' will skip
over stuff in the global_ignores list, and skip over .svn
> subdirs, etc. That means that you might have a non-empty directory
containing only stuff that import would skip, which would cause your
special-case checks not to fire, and still cause an empty commit.
>
> The first solution is the better one.
>
> (And I see that import_file() *always* calls add_file() in a
> non-errorful situation, so it doesn't have to grow this parameter at all
-- it's caller can just know that if it calls import_file, the server is
being changed.)
>

Yes, import_file() doesn't need to be modified. The current import doesn't
allow a file to be imported without a parent directory being created - so
checking if parent directories are getting added is sufficient when a

v3 of the patch attached.

Changelog:

* subversion/libsvn_client/commit.c
  (repos_change_baton_t) : New struct with a single boolean
    member to remember if changes were made to the repository.

  (import_dir) : Added an extra function parameter -
    'repos_change_baton'. Set repos_changed in the baton to
    true if parent directories are created and when directories
    or files are added to the repository.

  (import) : Abort an edit if no changes are made to the repository.

* subversion/tests/clients/cmdline/basic_tests.py
  (basic_import_empty_dir) : New. Verify that empty revisions
    cannot be created.

  (test_list) : Added basic_empty_revision to list of tests.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Mon Apr 11 17:19:59 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.