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

[WIP] Make the patch code accept dirs as targets for prop only patches

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Mon, 26 Jul 2010 09:59:01 +0200

Hi Stefan!

A few questions and a WIP patch for making the patch code deal with
property targets being dirs.

* How should we deal with SVN_ERR_ILLEGAL_TARGET? svn_wc_prop_set()
  throws one of those if we for instance try to set svn:executable on a
  dir or svn:ignore on a file. Should we do some kind of skipped prop
  notification?

* Are you ok with the change I made in resolve_target_path()? If we only
  have property changes to a file than it's ok to have a dir as a
  target.

* What should we do if the target dir for a property is locally_deleted?
  I think we should skip it (that's what the code does right now).

I said to you earlier on IRC that I didn't quite understand how we
determined if we had a valid patch target. Do you agree with my doc
change for resolve_target_path() and the two sections below?

* Do you agree on this definition:
  ! target->skipped => We have an add/del/mod for target
  target->node_kind_on_disk => We have a mod for target. (special case:
  if we're adding to an existing file we might have an add if the target
  already is the expected result after patching).

* For properties I have:
  ! target->skipped && is_prop_hunk => We have an add/del/mod for
  prop_target.
  prop_target->content_info->stream => We have a mod for prop_target.

My recent work has been an attempt to make the matching/applying part as
generic as possible, e.g. work for both properties and texts. My limited
testing suggests I've succeeded with that. But I'll have to introduce a
couple of if statements and flags to distinguish between props and text
changes.

[[[
Enable the patch code to use dirs as targets if we only have property
changes.

* subversion/libsvn_client/patch.c
  (patch_target_t): Add fields 'has_text_changes' and 'has_prop_changes'
    to be able to decide if we should install tmp files for text and/or
    props. It's needed since we may have a dir as a target for a
    property. If we'd try to copy the tmp file for the text changes onto
    a dir we get an error.
  (resolve_target_path): Add new parameter 'only_prop_changes' to help
    us determine the case when a dir is a valid target.
  (init_patch_target): Update caller of resolve_target_path().
  (apply_hunk): Record if we've done any changes to props or text
    content.
  (apply_patches): Only call install_patched_target() if we have changed
    the text contents.
]]]

Thanks,
Daniel

Received on 2010-07-26 10:00:38 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.