Checkout
lundblad
committed
on 16 Mar 07
Fix issue #1976: Set arbitrary revision properties (revprops) during
commit.

Patch by: Gerco Ballintijn <gerco@ballintijn.com>
(heavily twe… Show more
Fix issue #1976: Set arbitrary revision properties (revprops) during

commit.

Patch by: Gerco Ballintijn <gerco@ballintijn.com>

(heavily tweaked by me)

Review by: malcolm

          glasser

This patch adds a "--with-revprop" option to the various URL-based

modification operations (e.g., commit, mkdir, delete, etc.).  This option

can be used multiple times to set multiple revision properties.  The

argument of the --with-revprop option is of the form "name=value".

* subversion/include/svn_client.h

 (svn_client_ctx_t): Added the revprop_table field.

* subversion/include/svn_props.h (svn_prop_has_svn_props): New function.

* subversion/include/svn_ra.h

 (svn_ra_get_commit_editor3): New prototype.

 (svn_ra_get_commit_editor2): Deprecate.

* subversion/include/svn_ra_svn.h

 (SVN_RA_SVN_CAP_COMMIT_REVPROPS): New macro.

 (svn_ra_svn_write_proplist,

 svn_ra_svn_parse_proplist): Existing functions, moved and made public.

* subversion/include/svn_repos.h

 (svn_repos_fs_begin_txn_for_commit2): New prototype.

 (svn_repos_fs_begin_txn_for_commit): Deprecate.

 (svn_repos_get_commit_editor5): New prototype.

 (svn_repos_get_commit_editor4): Deprecate.

* subversion/libsvn_repos/repos.h

 (svn_repos__change_txn_props): New function.

* subversion/libsvn_repos/commit.c

 (edit_baton): Replace log_msg with revprop_table.

 (open_root): Set all revprops on the transaction.

 (revprop_table_dup): New function.

 (svn_repos_get_commit_editor5): New.  Pass on a copy of revprop_table in

 edit_baton.

 (svn_repos_get_commit_editor4): Add backward-compatability wrapper.

* subversion/libsvn_repos/fs-wrap.c

 (svn_repos__change_txn_props): New function.

 (svn_repos_fs_begin_txn_for_commit2): Set the revision properties in

 the new transaction.

 (svn_repos_fs_begin_txn_for_commit): Add backward-compatability wrapper.

* subversion/libsvn_ra/ra_loader.h

 (svn_ra__vtable_t): Replaced log_msg parameter with revprop_table in

 the get_commit_editor field.

* subversion/libsvn_ra/wrapper_template.h

 (compat_get_commit_editor): Pass log message in a hash table.

* subversion/libsvn_ra/ra_loader.c

 (svn_ra_get_commit_editor3): Take revprop_table parameter.

 (svn_ra_get_commit_editor2): Add backward-compatability wrapper.

* subversion/libsvn_ra_local/ra_plugin.c

 (svn_ra_local__get_commit_editor): Adjust prototype and pass revprops

 table on.

* subversion/libsvn_ra_svn/protocol

 (2.1.): Add commit-revprops server capability.

 (3.1.1.): Adde revprops parameter.

* subversion/libsvn_ra_svn/client.c

 (parse_proplist): Moved to marshal.c and made public.

 (ra_svn_commit): Send the revprop_table to the server, erroring out if

 caller tries to set arbitrary props, but server doesn't support it.

 (ra_svn_rev_proplist, ra_svn_get_file, ra_svn_get_dir,

 ra_svn_get_file_revs): Use public version of parse_proplist.

* subversion/libsvn_ra_svn/marshal.c

 (svn_ra_svn_write_proplist): Extract from svnserve/serve.c and

 made public.

 (svn_ra_svn_parse_proplist): Extract from client.c and made public.

* subversion/libsvn_ra_dav/ra_dav.h

 (svn_ra_dav__get_commit_editor): Adjust prototype.

* subversion/libsvn_ra_dav/commit.c

 (apply_log_message): Rename ...

 (apply_revprops): ... to this, and add revprop_table marshalling.

 (svn_ra_dav__get_commit_editor): Call apply_revprops.

* subversion/libsvn_client/client.h (svn_client__get_revprop_table),

* subversion/libsvn_client/commit_util.c (svn_client__get_revprop_table):

 New function.

* subversion/libsvn_client/add.c (mkdir_urls),

* subversion/libsvn_client/commit.c (get_ra_editor),

* subversion/libsvn_client/copy.c (repos_to_repos_copy, wc_to_repos_copy),

* subversion/libsvn_client/delete.c (delete_urls),

* subversion/libsvn_client/prop_commands.c (propset_on_url):

 Pass revprop_table as parameter when creating commit editor.

* subversion/libsvn_subr/properties.c

 (svn_prop_has_svn_props): New function.

* subversion/svn/cl.h

 (svn_cl__longopt_t): Add svn_cl__with_revprop_opt enum value.

 (svn_cl__opt_state_t): Add revprop_table field.

* subversion/svn/main.c

 (svn_cl__options): Add --with-revprop option.

 (SVN_CL__LOG_MSG_OPTIONS): Add --with-revprop to other commit

 related options.

 (parse_revprop): New function.

 (main): Handle --with-revprop option.

* subversion/svn/commit-cmd.c (svn_cl__commit),

* subversion/svn/import-cmd.c (svn_cl__import):

 Pass on the revprop_table field.

* subversion/svn/copy-cmd.c (svn_cl__copy),

* subversion/svn/delete-cmd.c (svn_cl__delete),

* subversion/svn/mkdir-cmd.c (svn_cl__mkdir),

* subversion/svn/move-cmd.c (svn_cl__move),

* subversion/svn/propedit-cmd.c (svn_cl__propedit):

 Check whether the revprop_table field is set only when actually

 commiting, and pass on the revprop_table field.

* subversion/svnserve/serve.c

 (serve): Send commit-revprops capability in the greeting.

 (write_proplist): Move to libsvn_ra_svn/marshal.c and make public.

 (rev_proplist, get_file, get_dir, file_rev_handler): Use public version

 of write_proplist.

 (commit): Call unmarshalling code when needed, and pass on the

 revprop_table.

* subversion/tests/cmdline/commit_tests.py

 (mkdir_with_revprop, delete_with_revprop, commit_with_revprop,

  import_with_revprop, copy_R2R_with_revprop, copy_WC2R_with_revprop,

  move_R2R_with_revprop, propedit_with_revprop,

  set_multiple_props_with_revprop, use_empty_value_in_revprop_pair,

 set_invalid_revprops): New test functions.

 (test_list): Run 'm all.

* subversion/tests/cmdline/svneditor.py

 (append_foo): New function.

* subversion/tests/cmdline/svntest/actions.py

 (UnorderedOutput): New class.

 (run_and_verify_svn): Deal with unordered output.

 (display_lines): Print unordered output.

 (compare_unordered_and_display_lines): Added call to

 main.compare_unordered_output to do actual unordered comparison.

* subversion/libsvn_ra_serf/ra_serf.h

 (svn_ra_serf__get_commit_editor): Adjust prototype.

* subversion/libsvn_ra_serf/commit.c

 (commit_context_t): Replace log_msg field with revprop_table.

 (open_root): Pass all revprops to the server.

 (svn_ra_serf__get_commit_editor): Take revprop_table instead of log message.

Show less