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

Re: [PATCH] Refactor install_file

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-11-14 17:06:30 CET

I'm sorry that I don't currently have the brain power to review the
implementation, but I've commented on the log message, doc strings and function
signatures. Style nits are in parentheses.

Peter N. Lundblad wrote:
> ------------------------------------------------------------------------
>
> Refactor that big baby of sussman (aka install_file in libsvn_wc)
> into some (hopefully) more managable functions and don't use this
> beast when adding a file with svn_wc_add_repos_file2.
>
> * subversion/libsvn_wc/props.h
> * subversion/libsvn_wc/props.c
> (svn_wc__has_magic_property): Const qualify
> an argument.

That change looks fine. (Strange early line wrapping here in the log, though.)

> * subversion/libsvn_wc/update_editor.c
> (merge_props, tweak_entry): New function, factored out of install_file.
> (install_file): Don't handle scheduleing a file for addition. Move some

Yay! A very nice improvement. (Sp.: "scheduling".)

> parts to separate functions. Dedoxygenify docstring while updating it.
> Expect new text to be in .svn/tmp and don't move it in place if it isn't.
> Don't support a full property list as input.
> (close_file): Adjust call to install_file().
> (install_added_props): New function.
> (svn_wc_add_repos_file2): Don't use install_file to install our base files
> (and do other things), because that tries to merge the working props
> and text which is both wrong and confusing. Instead, handle our own
> bussiness.

(Sp.: "business". A bit of indentation on the continuation lines would make it
easier to see which functions have been changed.)

> Index: subversion/libsvn_wc/update_editor.c
> ===================================================================
> --- subversion/libsvn_wc/update_editor.c (revision 17295)
> +++ subversion/libsvn_wc/update_editor.c (arbetskopia)
> @@ -1701,17 +1701,153 @@
[...]
> +/* Write log commands to merge PROP_CHANGES into the existing properties of
> + FILE_PATH. PROP_CHANGES can contain regular properties as well as
> + entryprops and wcprops. Update *PROP_STATE (which may be NULL)

You don't update NULL, so say: "Update *PROP_STATE (unless PROP_STATE is NULL)".

(The rest of this doc string and function signature is fine.)

> +tweak_entry (svn_stringbuf_t *log_accum,

(This doc string and function signature is fine.)

> /* This is the small planet. It has the complex responsibility of
> * "integrating" a new revision of a file into a working copy.
> *
> - * Given a @a file_path either already under version control, or
> - * prepared (see below) to join revision control, fully install a @a
> - * new_revision of the file; @a adm_access is an access
> - * baton with a write lock for the directory containing @a file_path.
> + * Given a FILE_PATH either already under version control, or
> + * prepared (see below) to join revision control, fully install a

(You might as well change "revision control" to "version control" to match the
previous line, while you're editing this.)

> + * NEW_REVISION of the file; ADM_ACCESS is an access baton with a
> + * write lock for the directory containing FILE_PATH.
[...]
> @@ -1720,89 +1856,70 @@
[...]
> * The caller also provides the new properties for the file in the

Careful: does it provide the "new properties" or does it provide the changes?
This line says "new", ...

> - * @a props array; if there are no new props, then caller must pass
> - * @c NULL instead. This argument is an array of @c svn_prop_t structures,
> - * and can be interpreted in one of two ways:
> + * PROP_CHANGES array; if there are no new props, then caller must pass

... this line says "CHANGES" but then says "new props" ...

> + * NULL instead. This argument is an array of svn_prop_t structures,
> + * representing differences against the files existing base properties.

... and this says "differences". Some parts of this description must be wrong.
  (Sp.: "file's")

> + * (A deletion is represented by setting an svn_prop_t's 'value'
> + * field to NULL.)

(The rest of this doc string and function signature is fine.)

> +/* Write, to LOG_ACCUM, commands to install properties for an added DST_PATH.
> + NEW_BASE_PROPS and NEW_PROPS are base and working properties, respectively.
> + BASE_PROPS can contain entryprops and wcprops as well.
> + Use @a POOL for temporary allocations. */

Mention ADM_ACCESS for completeness.

> +static svn_error_t *
> +install_added_props (svn_stringbuf_t *log_accum,
> + svn_wc_adm_access_t *adm_access,
> + const char *dst_path,
> + apr_hash_t *new_base_props,
> + apr_hash_t *new_props,
> + apr_pool_t *pool)
> +{
[...]
> +}

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Nov 14 17:12:21 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.