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

[PATCH] 'svn patch' should remove empty dir

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Sat, 27 Feb 2010 21:09:52 +0100

Hi!

Puh, 363 lines added. That's the biggest patch I've written so far. Sad
to think that once we have implemented git diff format this code will be
obsolute :).

Reviews welcome!

[[[
Make 'svn patch' able to remove dirs beeing empty after patching, taken
into account both versioned and unversioned files and dirs.

* subversion/tests/cmdline/patch_tests.py
  (patch_remove_empty_dir): New.
  (test_list): Add new test.

* subversion/libsvn_client/patch.c
  (status_baton): New.
  (find_existing_children, is_dir_empty,
    add_target_to_hash_keyed_by_parent_dir, is_dir_empty,
    sort_compare_nr_of_path_elements,
    maybe_condense_deleted_targets): New functions
  (apply_patches): Call maybe_condense_deleted_targets(). Check if a
    target has a patch associated with it before calling
    svn_diff__close_patch() since we're creating targets to delete dirs
    and those have no associated patch.

Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
Review by: julianf, stsp, neels
]]]

What target fields must be set for the parent dir target? I've just set
deleted, abs_path and deleted. May be a bit hard to maintain. Would be
better with a central initialize_basic_target() func.

In find_existing_children() I've said that if a path has text_status
svn_wc_status{none,deleted} or is the name of the parent_dir we'll
ignore it, all else states means that we have a file or dir at the path.

I haven't taken file externals into account. If a patch says that a
target should be removed I'm assuming the user knows what they're doing.

Daniel

Received on 2010-02-27 21:10:35 CET

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