You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2015/02/28 11:37:30 UTC
svn commit: r1662916 [6/15] - in /subversion/branches/1.9.x: ./ build/
build/generator/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/tests/org/apache/subversion/javahl/ subve...
Modified: subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.h?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/wc_db.h Sat Feb 28 10:37:27 2015
@@ -676,13 +676,15 @@ svn_wc__db_base_add_not_present_node(svn
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
+/* Remove a node and all its descendants from the BASE tree. This can
+ be done in two modes:
-/* Remove a node and all its descendants from the BASE tree. This handles
- the deletion of a tree from the update editor and some file external
- scenarios.
+ * Remove everything, scheduling wq operations to clean up
+ the working copy. (KEEP_WORKING = FALSE)
- The node to remove is indicated by LOCAL_ABSPATH from the local
- filesystem.
+ * Bump things to WORKING, so the BASE layer is free, but the working
+ copy unmodified, except that everything that was visible from
+ BASE is now a copy of what it used to be. (KEEP_WORKING = TRUE)
This operation *installs* workqueue operations to update the local
filesystem after the database operation.
@@ -693,21 +695,11 @@ svn_wc__db_base_add_not_present_node(svn
actual node will be removed if the actual node does not mark a
conflict.
- If KEEP_AS_WORKING is TRUE, then the base tree is copied to higher
- layers as a copy of itself before deleting the BASE nodes.
- If KEEP_AS_WORKING is FALSE, and QUEUE_DELETES is TRUE, also queue
- workqueue items to delete all in-wc representations that aren't
- shadowed by higher layers.
- (With KEEP_AS_WORKING TRUE, this is a no-op, as everything is
- automatically shadowed by the created copy)
-
- If REMOVE_LOCKS is TRUE, all locks of this node and any subnodes
- are also removed. This is to be done during commit of deleted nodes.
-
- If NOT_PRESENT_REVISION specifies a valid revision a not-present
- node is installed in BASE node with kind NOT_PRESENT_KIND after
- deleting.
+ If MARK_NOT_PRESENT or MARK_EXCLUDED is TRUE, install a marker
+ of the specified type at the root of the now removed tree, with
+ either the specified revision (or in case of SVN_INVALID_REVNUM)
+ the original revision.
If CONFLICT and/or WORK_ITEMS are passed they are installed as part
of the operation, after the work items inserted by the operation
@@ -716,10 +708,10 @@ svn_wc__db_base_add_not_present_node(svn
svn_error_t *
svn_wc__db_base_remove(svn_wc__db_t *db,
const char *local_abspath,
- svn_boolean_t keep_as_working,
- svn_boolean_t queue_deletes,
- svn_boolean_t remove_locks,
- svn_revnum_t not_present_revision,
+ svn_boolean_t keep_working,
+ svn_boolean_t mark_not_present,
+ svn_boolean_t mark_excluded,
+ svn_revnum_t marker_revision,
svn_skel_t *conflict,
svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -1421,8 +1413,8 @@ svn_wc__db_op_copy_dir(svn_wc__db_t *db,
const char *original_uuid,
svn_revnum_t original_revision,
const apr_array_header_t *children,
- svn_boolean_t is_move,
svn_depth_t depth,
+ svn_boolean_t is_move,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -1463,6 +1455,7 @@ svn_wc__db_op_copy_symlink(svn_wc__db_t
const char *original_uuid,
svn_revnum_t original_revision,
const char *target,
+ svn_boolean_t is_move,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -2026,6 +2019,7 @@ struct svn_wc__db_info_t {
svn_boolean_t moved_here; /* Only on op-roots. */
svn_boolean_t file_external;
+ svn_boolean_t has_descendants; /* Is dir, or has tc descendants */
};
/* Return in *NODES a hash mapping name->struct svn_wc__db_info_t for
@@ -2064,6 +2058,7 @@ svn_wc__db_read_single_info(const struct
/* Structure returned by svn_wc__db_read_walker_info. Only has the
fields needed by svn_wc__internal_walk_children(). */
struct svn_wc__db_walker_info_t {
+ const char *name;
svn_wc__db_status_t status;
svn_node_kind_t kind;
};
@@ -2124,11 +2119,10 @@ svn_wc__db_read_node_install_info(const
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/* Return in *NODES a hash mapping name->struct svn_wc__db_walker_info_t for
- the children of DIR_ABSPATH. "name" is the child's name relative to
- DIR_ABSPATH, not an absolute path. */
+/* Return in *ITEMS an array of struct svn_wc__db_walker_info_t* for
+ the direct children of DIR_ABSPATH. */
svn_error_t *
-svn_wc__db_read_children_walker_info(apr_hash_t **nodes,
+svn_wc__db_read_children_walker_info(const apr_array_header_t **items,
svn_wc__db_t *db,
const char *dir_abspath,
apr_pool_t *result_pool,
@@ -2136,15 +2130,26 @@ svn_wc__db_read_children_walker_info(apr
/**
- * Set *URL to the corresponding url for LOCAL_ABSPATH.
- * If the node is added, return the url it will have in the repository.
- */
-svn_error_t *
-svn_wc__db_read_url(const char **url,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool);
+ * Set *revision, *repos_relpath, *repos_root_url, *repos_uuid to
+ * the intended/commit location of LOCAL_ABSPATH. These arguments may be
+ * NULL if they are not needed.
+ *
+ * If the node is deleted, return the url it would have in the repository
+ * if it wouldn't be deleted. If the node is added return the url it will
+ * have in the repository, once committed.
+ *
+ * If the node is not added and has an existing repository location, set
+ * revision to its existing revision, otherwise to SVN_INVALID_REVNUM.
+ */
+svn_error_t *
+svn_wc__db_read_repos_info(svn_revnum_t *revision,
+ const char **repos_relpath,
+ const char **repos_root_url,
+ const char **repos_uuid,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Set *PROPS to the properties of the node LOCAL_ABSPATH in the ACTUAL
@@ -2308,6 +2313,14 @@ svn_wc__db_read_children_of_working_node
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+svn_error_t *
+svn_wc__db_base_read_not_present_children(
+ const apr_array_header_t **children,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* Like svn_wc__db_read_children_of_working_node(), except also include any
path that was a child of a deleted directory that existed at
LOCAL_ABSPATH, even if that directory is now scheduled to be replaced by
@@ -2396,16 +2409,6 @@ svn_wc__db_read_kind(svn_node_kind_t *ki
svn_boolean_t show_hidden,
apr_pool_t *scratch_pool);
-
-/* An analog to svn_wc__entry_is_hidden(). Set *HIDDEN to TRUE if
- LOCAL_ABSPATH in DB "is not present, and I haven't scheduled something
- over the top of it." */
-svn_error_t *
-svn_wc__db_node_hidden(svn_boolean_t *hidden,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *scratch_pool);
-
/* Checks if a node replaces a node in a different layer. Also check if it
replaces a BASE (op_depth 0) node or just a node in a higher layer (a copy).
Finally check if this is the root of the replacement, or if the replacement
@@ -2517,11 +2520,6 @@ svn_wc__db_global_relocate(svn_wc__db_t
CHANGED_AUTHOR is the (server-side) author of CHANGED_REVISION. It may be
NULL if the revprop is missing on the revision.
- One or both of NEW_CHECKSUM and NEW_CHILDREN should be NULL. For new:
- files: NEW_CHILDREN should be NULL
- dirs: NEW_CHECKSUM should be NULL
- symlinks: both should be NULL
-
WORK_ITEMS will be place into the work queue.
*/
svn_error_t *
@@ -2532,7 +2530,6 @@ svn_wc__db_global_commit(svn_wc__db_t *d
apr_time_t changed_date,
const char *changed_author,
const svn_checksum_t *new_checksum,
- const apr_array_header_t *new_children,
apr_hash_t *new_dav_cache,
svn_boolean_t keep_changelist,
svn_boolean_t no_unlock,
@@ -2935,34 +2932,6 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
const char *repos_uuid,
apr_pool_t *scratch_pool);
-
-svn_error_t *
-svn_wc__db_upgrade_apply_dav_cache(svn_sqlite__db_t *sdb,
- const char *dir_relpath,
- apr_hash_t *cache_values,
- apr_pool_t *scratch_pool);
-
-
-/* ### need much more docco
-
- ### this function should be called within a sqlite transaction. it makes
- ### assumptions around this fact.
-
- Apply the various sets of properties to the database nodes based on
- their existence/presence, the current state of the node, and the original
- format of the working copy which provided these property sets.
-*/
-svn_error_t *
-svn_wc__db_upgrade_apply_props(svn_sqlite__db_t *sdb,
- const char *dir_abspath,
- const char *local_relpath,
- apr_hash_t *base_props,
- apr_hash_t *revert_props,
- apr_hash_t *working_props,
- int original_format,
- apr_int64_t wc_id,
- apr_pool_t *scratch_pool);
-
/* Simply insert (or replace) one row in the EXTERNALS table. */
svn_error_t *
svn_wc__db_upgrade_insert_external(svn_wc__db_t *db,
@@ -2977,20 +2946,6 @@ svn_wc__db_upgrade_insert_external(svn_w
svn_revnum_t def_revision,
apr_pool_t *scratch_pool);
-/* Get the repository identifier corresponding to REPOS_ROOT_URL from the
- database in SDB. The value is returned in *REPOS_ID. All allocations
- are allocated in SCRATCH_POOL.
-
- NOTE: the row in REPOSITORY must exist. If not, then SVN_ERR_WC_DB_ERROR
- is returned.
-
- ### unclear on whether/how this interface will stay/evolve. */
-svn_error_t *
-svn_wc__db_upgrade_get_repos_id(apr_int64_t *repos_id,
- svn_sqlite__db_t *sdb,
- const char *repos_root_url,
- apr_pool_t *scratch_pool);
-
/* Upgrade the metadata concerning the WC at WCROOT_ABSPATH, in DB,
* to the SVN_WC__VERSION format.
*
@@ -3131,10 +3086,6 @@ svn_wc__db_wclock_owns_lock(svn_boolean_
This operation always recursively removes all nodes at and below
LOCAL_ABSPATH from NODES and ACTUAL.
- If NOT_PRESENT_REVISION specifies a valid revision, leave a not_present
- BASE node at local_abspath of the specified status and kind.
- (Requires an existing BASE node before removing)
-
If DESTROY_WC is TRUE, this operation *installs* workqueue operations to
update the local filesystem after the database operation. If DESTROY_CHANGES
is FALSE, modified and unversioned files are left after running this
@@ -3152,9 +3103,6 @@ svn_wc__db_op_remove_node(svn_boolean_t
const char *local_abspath,
svn_boolean_t destroy_wc,
svn_boolean_t destroy_changes,
- svn_revnum_t not_present_revision,
- svn_wc__db_status_t not_present_status,
- svn_node_kind_t not_present_kind,
const svn_skel_t *conflict,
const svn_skel_t *work_items,
svn_cancel_func_t cancel_func,
@@ -3317,7 +3265,8 @@ svn_wc__db_get_not_present_descendants(c
*
* Indicate in *IS_SPARSE_CHECKOUT whether any of the nodes within
* LOCAL_ABSPATH is sparse.
- * Indicate in *IS_MODIFIED whether the working copy has local modifications.
+ * Indicate in *IS_MODIFIED whether the working copy has local modifications
+ * recorded for it in DB.
*
* Indicate in *IS_SWITCHED whether any node beneath LOCAL_ABSPATH
* is switched. If TRAIL_URL is non-NULL, use it to determine if LOCAL_ABSPATH
@@ -3338,8 +3287,6 @@ svn_wc__db_revision_status(svn_revnum_t
const char *local_abspath,
const char *trail_url,
svn_boolean_t committed,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
apr_pool_t *scratch_pool);
/* Set *MIN_REVISION and *MAX_REVISION to the lowest and highest revision
@@ -3400,16 +3347,13 @@ svn_wc__db_get_excluded_subtrees(apr_has
/* Indicate in *IS_MODIFIED whether the working copy has local modifications,
* using DB. Use SCRATCH_POOL for temporary allocations.
*
- * This function provides a subset of the functionality of
- * svn_wc__db_revision_status() and is more efficient if the caller
- * doesn't need all information returned by svn_wc__db_revision_status(). */
+ * This function does not check the working copy state, but is a lot more
+ * efficient than a full status walk. */
svn_error_t *
-svn_wc__db_has_local_mods(svn_boolean_t *is_modified,
- svn_wc__db_t *db,
- const char *local_abspath,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *scratch_pool);
+svn_wc__db_has_db_mods(svn_boolean_t *is_modified,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ apr_pool_t *scratch_pool);
/* Verify the consistency of metadata concerning the WC that contains
@@ -3479,41 +3423,24 @@ svn_wc__db_vacuum(svn_wc__db_t *db,
comment in resolve_conflict_on_node about combining with another
function. */
svn_error_t *
-svn_wc__db_resolve_delete_raise_moved_away(svn_wc__db_t *db,
- const char *local_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool);
-
-/* Like svn_wc__db_resolve_delete_raise_moved_away this should be
- combined.
-
- ### LOCAL_ABSPATH specifies the move origin, but the move origin
- ### is not necessary unique enough. This function needs an op_root_abspath
- ### argument to differentiate between different origins.
-
- ### See move_tests.py: move_many_update_delete for an example case.
- */
-svn_error_t *
-svn_wc__db_resolve_break_moved_away(svn_wc__db_t *db,
- const char *local_abspath,
- const char *src_op_root_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool);
+svn_wc__db_op_raise_moved_away(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool);
-/* Break moves for all moved-away children of LOCAL_ABSPATH, within
- * a single transaction.
- *
- * ### Like svn_wc__db_resolve_delete_raise_moved_away this should be
- * combined. */
+/* Breaks all moves of nodes that exist at or below LOCAL_ABSPATH as
+ shadowed (read: deleted) by the opration rooted at
+ delete_op_root_abspath.
+ */
svn_error_t *
-svn_wc__db_resolve_break_moved_away_children(svn_wc__db_t *db,
- const char *local_abspath,
- const char *src_op_root_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool);
+svn_wc__db_op_break_moved_away(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *delete_op_root_abspath,
+ svn_boolean_t mark_tc_resolved,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool);
/* Set *REQUIRED_ABSPATH to the path that should be locked to ensure
* that the lock covers all paths affected by resolving the conflicts
@@ -3526,6 +3453,28 @@ svn_wc__required_lock_for_resolve(const
apr_pool_t *scratch_pool);
/* @} */
+typedef svn_error_t * (*svn_wc__db_verify_cb_t)(void *baton,
+ const char *wc_abspath,
+ const char *local_relpath,
+ int op_depth,
+ int id,
+ const char *description,
+ apr_pool_t *scratch_pool);
+
+/* Checks the database for FULL-correctness according to the spec.
+
+ Note that typical 1.7-1.9 databases WILL PRODUCE warnings.
+
+ This is mainly useful for WC-NG developers, as there will be
+ warnings without the database being corrupt
+*/
+svn_error_t *
+svn_wc__db_verify_db_full(svn_wc__db_t *db,
+ const char *wri_abspath,
+ svn_wc__db_verify_cb_t callback,
+ void *baton,
+ apr_pool_t *scratch_pool);
+
#ifdef __cplusplus
}
Modified: subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_private.h?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_private.h Sat Feb 28 10:37:27 2015
@@ -313,6 +313,32 @@ svn_wc__db_depth_get_info(svn_wc__db_sta
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+svn_error_t *
+svn_wc__db_scan_addition_internal(
+ svn_wc__db_status_t *status,
+ const char **op_root_relpath_p,
+ const char **repos_relpath,
+ apr_int64_t *repos_id,
+ const char **original_repos_relpath,
+ apr_int64_t *original_repos_id,
+ svn_revnum_t *original_revision,
+ svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+svn_error_t *
+svn_wc__db_scan_deletion_internal(
+ const char **base_del_relpath,
+ const char **moved_to_relpath,
+ const char **work_del_relpath,
+ const char **moved_to_op_root_relpath,
+ svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+
/* Look up REPOS_ID in WCROOT->SDB and set *REPOS_ROOT_URL and/or *REPOS_UUID
to its root URL and UUID respectively. If REPOS_ID is INVALID_REPOS_ID,
use NULL for both URL and UUID. Either or both output parameters may be
@@ -345,23 +371,6 @@ svn_wc__db_mark_conflict_internal(svn_wc
/* Transaction handling */
-/* A callback which supplies WCROOTs and LOCAL_RELPATHs. */
-typedef svn_error_t *(*svn_wc__db_txn_callback_t)(void *baton,
- svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- apr_pool_t *scratch_pool);
-
-
-/* Run CB_FUNC in a SQLite transaction with CB_BATON, using WCROOT and
- LOCAL_RELPATH. If callbacks require additional information, they may
- provide it using CB_BATON. */
-svn_error_t *
-svn_wc__db_with_txn(svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- svn_wc__db_txn_callback_t cb_func,
- void *cb_baton,
- apr_pool_t *scratch_pool);
-
/* Evaluate the expression EXPR within a transaction.
*
* Begin a transaction in WCROOT's DB; evaluate the expression EXPR, which would
@@ -400,6 +409,7 @@ svn_wc__db_op_copy_layer_internal(svn_wc
svn_error_t *
svn_wc__db_op_make_copy_internal(svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
+ svn_boolean_t move_move_info,
const svn_skel_t *conflicts,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
@@ -486,16 +496,27 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
svn_error_t *
svn_wc__db_op_break_move_internal(svn_wc__db_wcroot_t *wcroot,
const char *src_relpath,
- int src_op_depth,
+ int delete_op_depth,
const char *dst_relpath,
const svn_skel_t *work_items,
apr_pool_t *scratch_pool);
svn_error_t *
+svn_wc__db_op_mark_resolved_internal(svn_wc__db_wcroot_t *wcroot,
+ const char *local_relpath,
+ svn_wc__db_t *db,
+ svn_boolean_t resolved_text,
+ svn_boolean_t resolved_props,
+ svn_boolean_t resolved_tree,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool);
+
+/* op_depth is the depth at which the node is added. */
+svn_error_t *
svn_wc__db_op_raise_moved_away_internal(
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
- int delete_op_depth,
+ int op_depth,
svn_wc__db_t *db,
svn_wc_operation_t operation,
svn_wc_conflict_action_t action,
@@ -511,4 +532,10 @@ svn_wc__db_update_move_list_notify(svn_w
void *notify_baton,
apr_pool_t *scratch_pool);
+svn_error_t *
+svn_wc__db_verify_db_full_internal(svn_wc__db_wcroot_t *wcroot,
+ svn_wc__db_verify_cb_t callback,
+ void *baton,
+ apr_pool_t *scratch_pool);
+
#endif /* WC_DB_PRIVATE_H */
Modified: subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_update_move.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_update_move.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_update_move.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_update_move.c Sat Feb 28 10:37:27 2015
@@ -166,7 +166,7 @@ find_src_op_depth(int *src_op_depth,
*src_op_depth = svn_sqlite__column_int(stmt, 0);
SVN_ERR(svn_sqlite__reset(stmt));
if (!have_row)
- return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
_("'%s' is not deleted"),
path_for_error_message(wcroot, src_relpath,
scratch_pool));
@@ -1228,7 +1228,7 @@ tc_editor_delete(node_move_baton_t *nmb,
local_abspath = svn_dirent_join(b->wcroot->abspath, relpath, scratch_pool);
SVN_ERR(svn_wc__node_has_local_mods(&is_modified, &is_all_deletes,
- nmb->umb->db, local_abspath,
+ nmb->umb->db, local_abspath, FALSE,
NULL, NULL, scratch_pool));
if (is_modified)
{
@@ -1242,7 +1242,7 @@ tc_editor_delete(node_move_baton_t *nmb,
* it is not the/an op-root. (or we can't make us a copy)
*/
- SVN_ERR(svn_wc__db_op_make_copy_internal(b->wcroot, relpath,
+ SVN_ERR(svn_wc__db_op_make_copy_internal(b->wcroot, relpath, FALSE,
NULL, NULL, scratch_pool));
reason = svn_wc_conflict_reason_edited;
@@ -1343,68 +1343,6 @@ tc_editor_delete(node_move_baton_t *nmb,
* single-revision.
*/
-/* Set *OPERATION, *LOCAL_CHANGE, *INCOMING_CHANGE, *OLD_VERSION, *NEW_VERSION
- * to reflect the tree conflict on the victim SRC_ABSPATH in DB.
- *
- * If SRC_ABSPATH is not a tree-conflict victim, return an error.
- */
-static svn_error_t *
-get_tc_info(svn_wc_operation_t *operation,
- svn_wc_conflict_reason_t *local_change,
- svn_wc_conflict_action_t *incoming_change,
- const char **move_src_op_root_abspath,
- svn_wc_conflict_version_t **old_version,
- svn_wc_conflict_version_t **new_version,
- svn_wc__db_t *db,
- const char *src_abspath,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- const apr_array_header_t *locations;
- svn_boolean_t tree_conflicted;
- svn_skel_t *conflict_skel;
-
- /* Check for tree conflict on src. */
- SVN_ERR(svn_wc__db_read_conflict(&conflict_skel, NULL,
- db, src_abspath,
- scratch_pool, scratch_pool));
- if (!conflict_skel)
- return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
- _("'%s' is not in conflict"),
- svn_dirent_local_style(src_abspath,
- scratch_pool));
-
- SVN_ERR(svn_wc__conflict_read_info(operation, &locations,
- NULL, NULL, &tree_conflicted,
- db, src_abspath,
- conflict_skel, result_pool,
- scratch_pool));
- if ((*operation != svn_wc_operation_update
- && *operation != svn_wc_operation_switch)
- || !tree_conflicted)
- return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
- _("'%s' is not a tree-conflict victim"),
- svn_dirent_local_style(src_abspath,
- scratch_pool));
- if (locations)
- {
- SVN_ERR_ASSERT(locations->nelts >= 2);
- *old_version = APR_ARRAY_IDX(locations, 0,
- svn_wc_conflict_version_t *);
- *new_version = APR_ARRAY_IDX(locations, 1,
- svn_wc_conflict_version_t *);
- }
-
- SVN_ERR(svn_wc__conflict_read_tree_conflict(local_change,
- incoming_change,
- move_src_op_root_abspath,
- db, src_abspath,
- conflict_skel, scratch_pool,
- scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
/* Return *PROPS, *CHECKSUM, *CHILDREN and *KIND for LOCAL_RELPATH at
OP_DEPTH provided the row exists. Return *KIND of svn_node_none if
the row does not exist, or only describes a delete of a lower op-depth.
@@ -2330,11 +2268,103 @@ svn_wc__db_bump_moved_away(svn_wc__db_wc
return SVN_NO_ERROR;
}
+/* Set *OPERATION, *LOCAL_CHANGE, *INCOMING_CHANGE, *OLD_VERSION, *NEW_VERSION
+ * to reflect the tree conflict on the victim SRC_ABSPATH in DB.
+ *
+ * If SRC_ABSPATH is not a tree-conflict victim, return an error.
+ */
+static svn_error_t *
+fetch_conflict_details(int *src_op_depth,
+ svn_wc_operation_t *operation,
+ svn_wc_conflict_action_t *action,
+ svn_wc_conflict_version_t **left_version,
+ svn_wc_conflict_version_t **right_version,
+ svn_wc__db_wcroot_t *wcroot,
+ svn_wc__db_t *db,
+ const char *local_relpath,
+ const svn_skel_t *conflict_skel,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const apr_array_header_t *locations;
+ svn_boolean_t text_conflicted;
+ svn_boolean_t prop_conflicted;
+ svn_boolean_t tree_conflicted;
+ const char *move_src_op_root_abspath;
+ svn_wc_conflict_reason_t reason;
+ const char *local_abspath = svn_dirent_join(wcroot->abspath, local_relpath,
+ scratch_pool);
+
+ if (!conflict_skel)
+ return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+ _("'%s' is not in conflict"),
+ path_for_error_message(wcroot, local_relpath,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__conflict_read_info(operation, &locations,
+ &text_conflicted, &prop_conflicted,
+ &tree_conflicted,
+ db, local_abspath,
+ conflict_skel, result_pool,
+ scratch_pool));
+
+ if (text_conflicted || prop_conflicted || !tree_conflicted)
+ return svn_error_createf(SVN_ERR_WC_CONFLICT_RESOLVER_FAILURE, NULL,
+ _("'%s' is not a valid tree-conflict victim"),
+ path_for_error_message(wcroot, local_relpath,
+ scratch_pool));
+
+ SVN_ERR(svn_wc__conflict_read_tree_conflict(&reason,
+ action,
+ &move_src_op_root_abspath,
+ db, local_abspath,
+ conflict_skel, result_pool,
+ scratch_pool));
+
+ if (reason == svn_wc_conflict_reason_moved_away)
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
+ _("'%s' is already a moved away tree-conflict"),
+ path_for_error_message(wcroot, local_relpath,
+ scratch_pool));
+
+ if (left_version)
+ {
+ if (locations && locations->nelts > 0)
+ *left_version = APR_ARRAY_IDX(locations, 0,
+ svn_wc_conflict_version_t *);
+ else
+ *left_version = NULL;
+ }
+
+ if (right_version)
+ {
+ if (locations && locations->nelts > 1)
+ *right_version = APR_ARRAY_IDX(locations, 1,
+ svn_wc_conflict_version_t *);
+ else
+ *right_version = NULL;
+ }
+
+ {
+ int del_depth = relpath_depth(local_relpath);
+
+ if (move_src_op_root_abspath)
+ del_depth = relpath_depth(
+ svn_dirent_skip_ancestor(wcroot->abspath,
+ move_src_op_root_abspath));
+
+ SVN_ERR(find_src_op_depth(src_op_depth, wcroot, local_relpath, del_depth,
+ scratch_pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc__db_op_raise_moved_away_internal(
svn_wc__db_wcroot_t *wcroot,
const char *local_relpath,
- int delete_op_depth,
+ int src_op_depth,
svn_wc__db_t *db,
svn_wc_operation_t operation,
svn_wc_conflict_action_t action,
@@ -2350,13 +2380,14 @@ svn_wc__db_op_raise_moved_away_internal(
STMT_CREATE_UPDATE_MOVE_LIST));
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_MOVED_DESCENDANTS_SHD));
+ STMT_SELECT_MOVED_DESCENDANTS_SRC));
SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
- delete_op_depth));
+ src_op_depth));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
while(have_row)
{
svn_error_t *err;
+ int delete_op_depth = svn_sqlite__column_int(stmt, 0);
const char *src_relpath = svn_sqlite__column_text(stmt, 1, NULL);
svn_node_kind_t src_kind = svn_sqlite__column_token(stmt, 2, kind_map);
const char *src_repos_relpath = svn_sqlite__column_text(stmt, 3, NULL);
@@ -2399,42 +2430,52 @@ svn_wc__db_op_raise_moved_away_internal(
}
svn_error_t *
-svn_wc__db_resolve_delete_raise_moved_away(svn_wc__db_t *db,
- const char *local_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool)
+svn_wc__db_op_raise_moved_away(svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
svn_wc_operation_t operation;
- svn_wc_conflict_reason_t reason;
svn_wc_conflict_action_t action;
- svn_wc_conflict_version_t *old_version, *new_version;
+ svn_wc_conflict_version_t *left_version, *right_version;
+ int move_src_op_depth;
+ svn_skel_t *conflict;
SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
db, local_abspath,
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- SVN_ERR(get_tc_info(&operation, &reason, &action, NULL,
- &old_version, &new_version,
- db, local_abspath, scratch_pool, scratch_pool));
-
- SVN_WC__DB_WITH_TXN(
+ SVN_WC__DB_WITH_TXN4(
+ svn_wc__db_read_conflict_internal(&conflict, NULL,
+ wcroot, local_relpath,
+ scratch_pool, scratch_pool),
+ fetch_conflict_details(&move_src_op_depth,
+ &operation, &action,
+ &left_version, &right_version,
+ wcroot, db, local_relpath, conflict,
+ scratch_pool, scratch_pool),
+ svn_wc__db_op_mark_resolved_internal(wcroot, local_relpath, db,
+ FALSE, FALSE, TRUE,
+ NULL, scratch_pool),
svn_wc__db_op_raise_moved_away_internal(wcroot, local_relpath,
- relpath_depth(local_relpath),
+ move_src_op_depth,
db, operation, action,
- old_version, new_version,
+ left_version, right_version,
scratch_pool),
wcroot);
+ /* These version numbers are valid for update/switch notifications
+ only! */
SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
- (old_version
- ? old_version->peg_rev
+ (left_version
+ ? left_version->peg_rev
: SVN_INVALID_REVNUM),
- (new_version
- ? new_version->peg_rev
+ (right_version
+ ? right_version->peg_rev
: SVN_INVALID_REVNUM),
notify_func, notify_baton,
scratch_pool));
@@ -2444,44 +2485,15 @@ svn_wc__db_resolve_delete_raise_moved_aw
static svn_error_t *
break_moved_away(svn_wc__db_wcroot_t *wcroot,
+ svn_wc__db_t *db,
const char *local_relpath,
- int op_depth,
+ int parent_src_op_depth,
apr_pool_t *scratch_pool)
{
- const char *dst_relpath;
- int src_op_depth;
- const char *delete_relpath;
-
- SVN_ERR(find_src_op_depth(&src_op_depth, wcroot,
- local_relpath, op_depth,
- scratch_pool));
-
-
- SVN_ERR(svn_wc__db_scan_moved_to_internal(NULL, &dst_relpath,
- &delete_relpath,
- wcroot, local_relpath,
- src_op_depth,
- scratch_pool, scratch_pool));
-
- SVN_ERR_ASSERT(dst_relpath != NULL && delete_relpath != NULL);
-
- SVN_ERR(svn_wc__db_op_break_move_internal(wcroot, local_relpath,
- relpath_depth(delete_relpath),
- dst_relpath, NULL,
- scratch_pool));
-
- return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-break_moved_away_children(svn_wc__db_wcroot_t *wcroot,
- svn_wc__db_t *db,
- const char *local_relpath,
- apr_pool_t *scratch_pool)
-{
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
apr_pool_t *iterpool;
+ svn_error_t *err = NULL;
SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
STMT_CREATE_UPDATE_MOVE_LIST));
@@ -2489,112 +2501,92 @@ break_moved_away_children(svn_wc__db_wcr
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_MOVED_DESCENDANTS_SRC));
SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id, local_relpath,
- relpath_depth(local_relpath)));
+ parent_src_op_depth));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
iterpool = svn_pool_create(scratch_pool);
while (have_row)
{
- int src_op_depth = svn_sqlite__column_int(stmt, 0) ;
+ int src_op_depth = svn_sqlite__column_int(stmt, 0);
const char *src_relpath = svn_sqlite__column_text(stmt, 1, NULL);
svn_node_kind_t src_kind = svn_sqlite__column_token(stmt, 2, kind_map);
const char *dst_relpath = svn_sqlite__column_text(stmt, 4, NULL);
- svn_error_t *err;
svn_pool_clear(iterpool);
- err = svn_wc__db_op_break_move_internal(wcroot,
- src_relpath, src_op_depth,
- dst_relpath, NULL, iterpool);
+ err = verify_write_lock(wcroot, src_relpath, iterpool);
- if (! err)
- {
- err = update_move_list_add(wcroot, src_relpath, db,
- svn_wc_notify_move_broken,
- src_kind,
- svn_wc_notify_state_inapplicable,
- svn_wc_notify_state_inapplicable,
- NULL, NULL, scratch_pool);
- }
+ if (!err)
+ err = verify_write_lock(wcroot, dst_relpath, iterpool);
if (err)
- {
- return svn_error_trace(
- svn_error_compose_create(err,
- svn_sqlite__reset(stmt)));
- }
-
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- }
- svn_pool_destroy(iterpool);
-
- SVN_ERR(svn_sqlite__reset(stmt));
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_wc__db_resolve_break_moved_away(svn_wc__db_t *db,
- const char *local_abspath,
- const char *src_op_root_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool)
-{
- svn_wc__db_wcroot_t *wcroot;
- const char *local_relpath;
- const char *src_relpath;
+ break;
- SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
- db, local_abspath,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_WCROOT(wcroot);
+ err = svn_error_trace(
+ svn_wc__db_op_break_move_internal(wcroot,
+ src_relpath, src_op_depth,
+ dst_relpath, NULL, iterpool));
- src_relpath = svn_dirent_skip_ancestor(wcroot->abspath, src_op_root_abspath);
- SVN_ERR_ASSERT(src_relpath != NULL);
+ if (err)
+ break;
- SVN_WC__DB_WITH_TXN(break_moved_away(wcroot, local_relpath,
- relpath_depth(src_relpath),
- scratch_pool),
- wcroot);
+ err = svn_error_trace(
+ update_move_list_add(wcroot, src_relpath, db,
+ svn_wc_notify_move_broken,
+ src_kind,
+ svn_wc_notify_state_inapplicable,
+ svn_wc_notify_state_inapplicable,
+ NULL, NULL, scratch_pool));
- if (notify_func)
- {
- svn_wc_notify_t *notify;
+ if (err)
+ break;
- notify = svn_wc_create_notify(svn_dirent_join(wcroot->abspath,
- local_relpath,
- scratch_pool),
- svn_wc_notify_move_broken,
- scratch_pool);
- notify->kind = svn_node_unknown;
- notify->content_state = svn_wc_notify_state_inapplicable;
- notify->prop_state = svn_wc_notify_state_inapplicable;
- notify->revision = SVN_INVALID_REVNUM;
- notify_func(notify_baton, notify, scratch_pool);
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
}
+ svn_pool_destroy(iterpool);
- return SVN_NO_ERROR;
+ return svn_error_compose_create(err, svn_sqlite__reset(stmt));
}
svn_error_t *
-svn_wc__db_resolve_break_moved_away_children(svn_wc__db_t *db,
- const char *local_abspath,
- const char *src_op_root_abspath,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool)
+svn_wc__db_op_break_moved_away(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *del_op_root_abspath,
+ svn_boolean_t mark_tc_resolved,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
+ const char *del_relpath;
+ int src_op_depth;
SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &local_relpath,
db, local_abspath,
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- SVN_WC__DB_WITH_TXN(
- break_moved_away_children(wcroot, db, local_relpath, scratch_pool),
+ if (del_op_root_abspath)
+ del_relpath = svn_dirent_skip_ancestor(wcroot->abspath,
+ del_op_root_abspath);
+ else
+ del_relpath = NULL;
+
+
+ SVN_WC__DB_WITH_TXN4(
+ find_src_op_depth(&src_op_depth, wcroot, local_relpath,
+ del_relpath ? relpath_depth(del_relpath)
+ : relpath_depth(local_relpath),
+ scratch_pool),
+ break_moved_away(wcroot, db, local_relpath, src_op_depth,
+ scratch_pool),
+ mark_tc_resolved
+ ? svn_wc__db_op_mark_resolved_internal(wcroot, local_relpath, db,
+ FALSE, FALSE, TRUE,
+ NULL, scratch_pool)
+ : SVN_NO_ERROR,
+ SVN_NO_ERROR,
wcroot);
SVN_ERR(svn_wc__db_update_move_list_notify(wcroot,
Modified: subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_util.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_util.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_util.c Sat Feb 28 10:37:27 2015
@@ -83,7 +83,7 @@ static svn_error_t *
relpath_depth_sqlite(svn_sqlite__context_t *sctx,
int argc,
svn_sqlite__value_t *values[],
- apr_pool_t *scratch_pool)
+ void *baton)
{
const char *path = NULL;
apr_int64_t depth;
@@ -152,63 +152,3 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
return SVN_NO_ERROR;
}
-
-/* Some helpful transaction helpers.
-
- Instead of directly using SQLite transactions, these wrappers
- relieve the consumer from the need to wrap the wcroot and
- local_relpath, which are almost always used within the transaction.
-
- This also means if we later want to implement some wc_db-specific txn
- handling, we have a convenient place to do it.
- */
-
-/* A callback which supplies WCROOTs and LOCAL_RELPATHs. */
-typedef svn_error_t *(*db_txn_callback_t)(void *baton,
- svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- apr_pool_t *scratch_pool);
-
-/* Baton for use with run_txn() and with_db_txn(). */
-struct txn_baton_t
-{
- svn_wc__db_wcroot_t *wcroot;
- const char *local_relpath;
-
- db_txn_callback_t cb_func;
- void *cb_baton;
-};
-
-
-/* Unwrap the sqlite transaction into a wc_db txn.
- Implements svn_sqlite__transaction_callback_t. */
-static svn_error_t *
-run_txn(void *baton, svn_sqlite__db_t *db, apr_pool_t *scratch_pool)
-{
- struct txn_baton_t *tb = baton;
-
- return svn_error_trace(
- tb->cb_func(tb->cb_baton, tb->wcroot, tb->local_relpath, scratch_pool));
-}
-
-
-/* Run CB_FUNC in a SQLite transaction with CB_BATON, using WCROOT and
- LOCAL_RELPATH. If callbacks require additional information, they may
- provide it using CB_BATON. */
-svn_error_t *
-svn_wc__db_with_txn(svn_wc__db_wcroot_t *wcroot,
- const char *local_relpath,
- svn_wc__db_txn_callback_t cb_func,
- void *cb_baton,
- apr_pool_t *scratch_pool)
-{
- struct txn_baton_t tb;
-
- tb.wcroot = wcroot;
- tb.local_relpath = local_relpath;
- tb.cb_func = cb_func;
- tb.cb_baton = cb_baton;
-
- return svn_error_trace(
- svn_sqlite__with_lock(wcroot->sdb, run_txn, &tb, scratch_pool));
-}
Modified: subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_wcroot.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/wc_db_wcroot.c Sat Feb 28 10:37:27 2015
@@ -164,32 +164,23 @@ svn_wc__db_verify_no_work(svn_sqlite__db
}
#if defined(VERIFY_ON_CLOSE) && defined(SVN_DEBUG)
+/* Implements svn_wc__db_verify_cb_t */
static svn_error_t *
-verify_sqlite(svn_sqlite__db_t *sdb,
- const char *wc_abspath,
- apr_pool_t *scratch_pool)
+verify_db_cb(void *baton,
+ const char *wc_abspath,
+ const char *local_relpath,
+ int op_depth,
+ int id,
+ const char *msg,
+ apr_pool_t *scratch_pool)
{
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_STATIC_VERIFY));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
- while (have_row)
- {
- const char *item = svn_sqlite__column_text(stmt, 0, scratch_pool);
- int op_depth = svn_sqlite__column_int(stmt, 1);
- const char *msg = svn_sqlite__column_text(stmt, 2, scratch_pool);
-
- if (op_depth >= 0)
- SVN_DBG(("DB-VRFY: %s: %s:%d: %s", wc_abspath, item, op_depth, msg));
- else
- SVN_DBG(("DB-VRFY: %s: %s: %s", wc_abspath, item, msg));
-
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
- }
+ if (op_depth >= 0)
+ SVN_DBG(("DB-VRFY: %s: %s (%d): SV%04d %s",
+ wc_abspath, local_relpath, op_depth, id, msg));
+ else
+ SVN_DBG(("DB-VRFY: %s: %s: SV%04d %s",
+ wc_abspath, local_relpath, id, msg));
- SVN_ERR(svn_sqlite__reset(stmt));
return SVN_NO_ERROR;
}
#endif
@@ -208,8 +199,8 @@ close_wcroot(void *data)
{
apr_pool_t *scratch_pool = svn_pool_create(NULL);
- svn_error_clear(verify_sqlite(wcroot->sdb, wcroot->abspath,
- scratch_pool));
+ svn_error_clear(svn_wc__db_verify_db_full_internal(
+ wcroot, verify_db_cb, NULL, scratch_pool));
svn_pool_destroy(scratch_pool);
}
@@ -711,11 +702,9 @@ try_symlink_as_dir:
if (err)
{
if (err->apr_err == SVN_ERR_WC_CORRUPT)
- return svn_error_quick_wrap(
- err, apr_psprintf(scratch_pool,
- _("Missing a row in WCROOT for '%s'."),
- svn_dirent_local_style(original_abspath,
- scratch_pool)));
+ return svn_error_quick_wrapf(
+ err, _("Missing a row in WCROOT for '%s'."),
+ svn_dirent_local_style(original_abspath, scratch_pool));
return svn_error_trace(err);
}
Modified: subversion/branches/1.9.x/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_wc/workqueue.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_wc/workqueue.c Sat Feb 28 10:37:27 2015
@@ -143,8 +143,7 @@ run_base_remove(work_item_baton_t *wqb,
SVN_ERR(svn_wc__db_base_remove(db, local_abspath,
FALSE /* keep_as_working */,
- TRUE /* queue_deletes */,
- FALSE /* remove_locks */,
+ SVN_IS_VALID_REVNUM(not_present_rev), FALSE,
not_present_rev,
NULL, NULL, scratch_pool));
Modified: subversion/branches/1.9.x/subversion/svn/blame-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/svn/blame-cmd.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/svn/blame-cmd.c (original)
+++ subversion/branches/1.9.x/subversion/svn/blame-cmd.c Sat Feb 28 10:37:27 2015
@@ -31,6 +31,7 @@
#include "svn_pools.h"
#include "svn_props.h"
#include "svn_cmdline.h"
+#include "svn_sorts.h"
#include "svn_xml.h"
#include "svn_time.h"
#include "cl.h"
@@ -42,6 +43,8 @@ typedef struct blame_baton_t
svn_cl__opt_state_t *opt_state;
svn_stream_t *out;
svn_stringbuf_t *sbuf;
+
+ int rev_maxlength;
} blame_baton_t;
@@ -63,9 +66,9 @@ blame_receiver_xml(void *baton,
svn_boolean_t local_change,
apr_pool_t *pool)
{
- svn_cl__opt_state_t *opt_state =
- ((blame_baton_t *) baton)->opt_state;
- svn_stringbuf_t *sb = ((blame_baton_t *) baton)->sbuf;
+ blame_baton_t *bb = baton;
+ svn_cl__opt_state_t *opt_state = bb->opt_state;
+ svn_stringbuf_t *sb = bb->sbuf;
/* "<entry ...>" */
/* line_no is 0-based, but the rest of the world is probably Pascal
@@ -119,23 +122,13 @@ print_line_info(svn_stream_t *out,
const char *date,
const char *path,
svn_boolean_t verbose,
- svn_revnum_t end_revnum,
+ int rev_maxlength,
apr_pool_t *pool)
{
const char *time_utf8;
const char *time_stdout;
const char *rev_str;
- int rev_maxlength;
- /* The standard column width for the revision number is 6 characters.
- If the revision number can potentially be larger (i.e. if the end_revnum
- is larger than 1000000), we increase the column width as needed. */
- rev_maxlength = 6;
- while (end_revnum >= 1000000)
- {
- rev_maxlength++;
- end_revnum = end_revnum / 10;
- }
rev_str = SVN_IS_VALID_REVNUM(revision)
? apr_psprintf(pool, "%*ld", rev_maxlength, revision)
: apr_psprintf(pool, "%*s", rev_maxlength, "-");
@@ -189,11 +182,26 @@ blame_receiver(void *baton,
svn_boolean_t local_change,
apr_pool_t *pool)
{
- svn_cl__opt_state_t *opt_state =
- ((blame_baton_t *) baton)->opt_state;
- svn_stream_t *out = ((blame_baton_t *)baton)->out;
+ blame_baton_t *bb = baton;
+ svn_cl__opt_state_t *opt_state = bb->opt_state;
+ svn_stream_t *out = bb->out;
svn_boolean_t use_merged = FALSE;
+ if (!bb->rev_maxlength)
+ {
+ svn_revnum_t max_revnum = MAX(start_revnum, end_revnum);
+ /* The standard column width for the revision number is 6 characters.
+ If the revision number can potentially be larger (i.e. if the end_revnum
+ is larger than 1000000), we increase the column width as needed. */
+
+ bb->rev_maxlength = 6;
+ while (max_revnum >= 1000000)
+ {
+ bb->rev_maxlength++;
+ max_revnum = max_revnum / 10;
+ }
+ }
+
if (opt_state->use_merge_history)
{
/* Choose which revision to use. If they aren't equal, prefer the
@@ -216,7 +224,8 @@ blame_receiver(void *baton,
SVN_PROP_REVISION_AUTHOR),
svn_prop_get_value(merged_rev_props,
SVN_PROP_REVISION_DATE),
- merged_path, opt_state->verbose, end_revnum,
+ merged_path, opt_state->verbose,
+ bb->rev_maxlength,
pool));
else
SVN_ERR(print_line_info(out, revision,
@@ -224,7 +233,8 @@ blame_receiver(void *baton,
SVN_PROP_REVISION_AUTHOR),
svn_prop_get_value(rev_props,
SVN_PROP_REVISION_DATE),
- NULL, opt_state->verbose, end_revnum,
+ NULL, opt_state->verbose,
+ bb->rev_maxlength,
pool));
return svn_stream_printf(out, pool, "%s%s", line, APR_EOL_STR);
@@ -286,6 +296,7 @@ svn_cl__blame(apr_getopt_t *os,
bl.sbuf = svn_stringbuf_create_empty(pool);
bl.opt_state = opt_state;
+ bl.rev_maxlength = 0;
subpool = svn_pool_create(pool);
Modified: subversion/branches/1.9.x/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/svn/cl.h?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/svn/cl.h (original)
+++ subversion/branches/1.9.x/subversion/svn/cl.h Sat Feb 28 10:37:27 2015
@@ -167,7 +167,6 @@ typedef struct svn_cl__opt_state_t
svn_boolean_t version; /* print version information */
svn_boolean_t verbose; /* be verbose */
svn_boolean_t update; /* contact the server for the full story */
- svn_boolean_t strict; /* do strictly what was requested */
svn_stringbuf_t *filedata; /* contents of file used as option data
(not converted to UTF-8) */
const char *encoding; /* the locale/encoding of 'message' and of
@@ -249,6 +248,7 @@ typedef struct svn_cl__opt_state_t
svn_boolean_t no_newline; /* do not output the trailing newline */
svn_boolean_t show_passwords; /* show cached passwords */
svn_boolean_t pin_externals; /* pin externals to last-changed revisions */
+ const char *show_item; /* print only the given item */
} svn_cl__opt_state_t;
@@ -855,6 +855,48 @@ svn_cl__deprecated_merge_reintegrate(con
svn_client_ctx_t *ctx,
apr_pool_t *pool);
+
+/* Forward declaration of the similarity check context. */
+typedef struct svn_cl__simcheck_context_t svn_cl__simcheck_context_t;
+
+/* Token definition for the similarity check. */
+typedef struct svn_cl__simcheck_t
+{
+ /* The token we're checking for similarity. */
+ svn_string_t token;
+
+ /* User data associated with this token. */
+ const void *data;
+
+ /*
+ * The following fields are populated by svn_cl__similarity_check.
+ */
+
+ /* Similarity score [0..SVN_STRING__SIM_RANGE_MAX] */
+ apr_size_t score;
+
+ /* Number of characters of difference from the key. */
+ apr_size_t diff;
+
+ /* Similarity check context (private) */
+ svn_cl__simcheck_context_t *context;
+} svn_cl__simcheck_t;
+
+/* Find the entries in TOKENS that are most similar to KEY.
+ * TOKEN_COUNT is the number of entries in the (mutable) TOKENS array.
+ * Use SCRATCH_POOL for temporary allocations.
+ *
+ * On return, the TOKENS array will be sorted according to similarity
+ * to KEY, in descending order. The return value will be zero if the
+ * first token is an exact match; otherwise, it will be one more than
+ * the number of tokens that are at least two-thirds similar to KEY.
+ */
+apr_size_t
+svn_cl__similarity_check(const char *key,
+ svn_cl__simcheck_t **tokens,
+ apr_size_t token_count,
+ apr_pool_t *scratch_pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Modified: subversion/branches/1.9.x/subversion/svn/copy-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/svn/copy-cmd.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/svn/copy-cmd.c (original)
+++ subversion/branches/1.9.x/subversion/svn/copy-cmd.c Sat Feb 28 10:37:27 2015
@@ -169,6 +169,7 @@ svn_cl__copy(apr_getopt_t *os,
err = svn_client_copy7(sources, dst_path, TRUE,
opt_state->parents, opt_state->ignore_externals,
+ FALSE /* metadata_only */,
opt_state->pin_externals,
NULL, /* pin all externals */
opt_state->revprop_table,
Modified: subversion/branches/1.9.x/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/svn/info-cmd.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/svn/info-cmd.c (original)
+++ subversion/branches/1.9.x/subversion/svn/info-cmd.c Sat Feb 28 10:37:27 2015
@@ -76,6 +76,167 @@ schedule_str(svn_wc_schedule_t schedule)
}
}
+/* Return a relative URL from information in INFO using POOL for
+ temporary allocation. */
+static const char*
+relative_url(const svn_client_info2_t *info, apr_pool_t *pool)
+{
+ return apr_pstrcat(pool, "^/",
+ svn_path_uri_encode(
+ svn_uri_skip_ancestor(info->repos_root_URL,
+ info->URL, pool),
+ pool), SVN_VA_NULL);
+}
+
+
+/* The kinds of items for print_info_item(). */
+typedef enum
+{
+ /* Entry kind */
+ info_item_kind,
+
+ /* Repository location. */
+ info_item_url,
+ info_item_relative_url,
+ info_item_repos_root_url,
+ info_item_repos_uuid,
+
+ /* Working copy revision or repository HEAD revision */
+ info_item_revision,
+
+ /* Commit details. */
+ info_item_last_changed_rev,
+ info_item_last_changed_date,
+ info_item_last_changed_author,
+
+ /* Working copy information */
+ info_item_wc_root
+} info_item_t;
+
+/* Mapping between option keywords and info_item_t. */
+typedef struct info_item_map_t
+{
+ const svn_string_t keyword;
+ const info_item_t print_what;
+} info_item_map_t;
+
+#define MAKE_STRING(x) { x, sizeof(x) - 1 }
+static const info_item_map_t info_item_map[] =
+ {
+ { MAKE_STRING("kind"), info_item_kind },
+ { MAKE_STRING("url"), info_item_url },
+ { MAKE_STRING("relative-url"), info_item_relative_url },
+ { MAKE_STRING("repos-root-url"), info_item_repos_root_url },
+ { MAKE_STRING("repos-uuid"), info_item_repos_uuid },
+ { MAKE_STRING("revision"), info_item_revision },
+ { MAKE_STRING("last-changed-rev"), info_item_last_changed_rev },
+ { MAKE_STRING("last-changed-date"), info_item_last_changed_date },
+ { MAKE_STRING("last-changed-author"), info_item_last_changed_author },
+ { MAKE_STRING("wc-root"), info_item_wc_root }
+ };
+#undef MAKE_STRING
+
+static const apr_size_t info_item_map_len =
+ (sizeof(info_item_map) / sizeof(info_item_map[0]));
+
+
+/* The baton type used by the info receiver functions. */
+typedef struct print_info_baton_t
+{
+ /* The path prefix that output paths should be normalized to. */
+ const char *path_prefix;
+
+ /*
+ * The following fields are used by print_info_item().
+ */
+
+ /* Which item to print. */
+ info_item_t print_what;
+
+ /* Do we expect to show info for multiple targets? */
+ svn_boolean_t multiple_targets;
+
+ /* TRUE iff the current is a local path. */
+ svn_boolean_t target_is_path;
+
+ /* Did we already print a line of output? */
+ svn_boolean_t start_new_line;
+} print_info_baton_t;
+
+
+/* Find the appropriate info_item_t for KEYWORD and initialize
+ * RECEIVER_BATON for print_info_item(). Use SCRATCH_POOL for
+ * temporary allocation.
+ */
+static svn_error_t *
+find_print_what(const char *keyword,
+ print_info_baton_t *receiver_baton,
+ apr_pool_t *scratch_pool)
+{
+ svn_cl__simcheck_t **keywords = apr_palloc(
+ scratch_pool, info_item_map_len * sizeof(svn_cl__simcheck_t*));
+ svn_cl__simcheck_t *kwbuf = apr_palloc(
+ scratch_pool, info_item_map_len * sizeof(svn_cl__simcheck_t));
+ apr_size_t i;
+
+ for (i = 0; i < info_item_map_len; ++i)
+ {
+ keywords[i] = &kwbuf[i];
+ kwbuf[i].token.data = info_item_map[i].keyword.data;
+ kwbuf[i].token.len = info_item_map[i].keyword.len;
+ kwbuf[i].data = &info_item_map[i];
+ }
+
+ switch (svn_cl__similarity_check(keyword, keywords,
+ info_item_map_len, scratch_pool))
+ {
+ const info_item_map_t *kw0;
+ const info_item_map_t *kw1;
+ const info_item_map_t *kw2;
+
+ case 0: /* Exact match. */
+ kw0 = keywords[0]->data;
+ receiver_baton->print_what = kw0->print_what;
+ return SVN_NO_ERROR;
+
+ case 1:
+ /* The best alternative isn't good enough */
+ return svn_error_createf(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid value for --show-item"),
+ keyword);
+
+ case 2:
+ /* There is only one good candidate */
+ kw0 = keywords[0]->data;
+ return svn_error_createf(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid value for --show-item;"
+ " did you mean '%s'?"),
+ keyword, kw0->keyword.data);
+
+ case 3:
+ /* Suggest a list of the most likely candidates */
+ kw0 = keywords[0]->data;
+ kw1 = keywords[1]->data;
+ return svn_error_createf(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid value for --show-item;"
+ " did you mean '%s' or '%s'?"),
+ keyword, kw0->keyword.data, kw1->keyword.data);
+
+ default:
+ /* Never suggest more than three candidates */
+ kw0 = keywords[0]->data;
+ kw1 = keywords[1]->data;
+ kw2 = keywords[2]->data;
+ return svn_error_createf(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid value for --show-item;"
+ " did you mean '%s', '%s' or '%s'?"),
+ keyword, kw0->keyword.data, kw1->keyword.data, kw2->keyword.data);
+ }
+}
/* A callback of type svn_client_info_receiver2_t.
Prints svn info in xml mode to standard out */
@@ -87,7 +248,7 @@ print_info_xml(void *baton,
{
svn_stringbuf_t *sb = svn_stringbuf_create_empty(pool);
const char *rev_str;
- const char *path_prefix = baton;
+ print_info_baton_t *const receiver_baton = baton;
if (SVN_IS_VALID_REVNUM(info->rev))
rev_str = apr_psprintf(pool, "%ld", info->rev);
@@ -97,7 +258,7 @@ print_info_xml(void *baton,
/* "<entry ...>" */
svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "entry",
"path", svn_cl__local_style_skip_ancestor(
- path_prefix, target, pool),
+ receiver_baton->path_prefix, target, pool),
"kind", svn_cl__node_kind_str_xml(info->kind),
"revision", rev_str,
SVN_VA_NULL);
@@ -109,13 +270,7 @@ print_info_xml(void *baton,
{
/* "<relative-url> xx </relative-url>" */
svn_cl__xml_tagged_cdata(&sb, pool, "relative-url",
- apr_pstrcat(pool, "^/",
- svn_path_uri_encode(
- svn_uri_skip_ancestor(
- info->repos_root_URL,
- info->URL, pool),
- pool),
- SVN_VA_NULL));
+ relative_url(info, pool));
}
if (info->repos_root_URL || info->repos_UUID)
@@ -263,11 +418,11 @@ print_info(void *baton,
const svn_client_info2_t *info,
apr_pool_t *pool)
{
- const char *path_prefix = baton;
+ print_info_baton_t *const receiver_baton = baton;
SVN_ERR(svn_cmdline_printf(pool, _("Path: %s\n"),
svn_cl__local_style_skip_ancestor(
- path_prefix, target, pool)));
+ receiver_baton->path_prefix, target, pool)));
/* ### remove this someday: it's only here for cmdline output
compatibility with svn 1.1 and older. */
@@ -285,11 +440,8 @@ print_info(void *baton,
SVN_ERR(svn_cmdline_printf(pool, _("URL: %s\n"), info->URL));
if (info->URL && info->repos_root_URL)
- SVN_ERR(svn_cmdline_printf(pool, _("Relative URL: ^/%s\n"),
- svn_path_uri_encode(
- svn_uri_skip_ancestor(info->repos_root_URL,
- info->URL, pool),
- pool)));
+ SVN_ERR(svn_cmdline_printf(pool, _("Relative URL: %s\n"),
+ relative_url(info, pool)));
if (info->repos_root_URL)
SVN_ERR(svn_cmdline_printf(pool, _("Repository Root: %s\n"),
@@ -391,14 +543,14 @@ print_info(void *baton,
if (info->wc_info->moved_from_abspath)
SVN_ERR(svn_cmdline_printf(pool, _("Moved From: %s\n"),
svn_cl__local_style_skip_ancestor(
- path_prefix,
+ receiver_baton->path_prefix,
info->wc_info->moved_from_abspath,
pool)));
if (info->wc_info->moved_to_abspath)
SVN_ERR(svn_cmdline_printf(pool, _("Moved To: %s\n"),
svn_cl__local_style_skip_ancestor(
- path_prefix,
+ receiver_baton->path_prefix,
info->wc_info->moved_to_abspath,
pool)));
}
@@ -446,21 +598,24 @@ print_info(void *baton,
SVN_ERR(svn_cmdline_printf(pool,
_("Conflict Previous Base File: %s\n"),
svn_cl__local_style_skip_ancestor(
- path_prefix, conflict->base_abspath,
+ receiver_baton->path_prefix,
+ conflict->base_abspath,
pool)));
if (conflict->my_abspath)
SVN_ERR(svn_cmdline_printf(pool,
_("Conflict Previous Working File: %s\n"),
svn_cl__local_style_skip_ancestor(
- path_prefix, conflict->my_abspath,
+ receiver_baton->path_prefix,
+ conflict->my_abspath,
pool)));
if (conflict->their_abspath)
SVN_ERR(svn_cmdline_printf(pool,
_("Conflict Current Base File: %s\n"),
svn_cl__local_style_skip_ancestor(
- path_prefix, conflict->their_abspath,
+ receiver_baton->path_prefix,
+ conflict->their_abspath,
pool)));
break;
@@ -469,7 +624,7 @@ print_info(void *baton,
SVN_ERR(svn_cmdline_printf(pool,
_("Conflict Properties File: %s\n"),
svn_cl__local_style_skip_ancestor(
- path_prefix,
+ receiver_baton->path_prefix,
conflict->prop_reject_abspath,
pool)));
printed_prop_conflict_file = TRUE;
@@ -577,6 +732,123 @@ print_info(void *baton,
}
+/* Helper for print_info_item(): Print the value TEXT for TARGET_PATH,
+ either of which may be NULL. Use POOL for temporary allocation. */
+static svn_error_t *
+print_info_item_string(const char *text, const char *target_path,
+ apr_pool_t *pool)
+{
+ if (text)
+ {
+ if (target_path)
+ SVN_ERR(svn_cmdline_printf(pool, "%-10s %s", text, target_path));
+ else
+ SVN_ERR(svn_cmdline_fputs(text, stdout, pool));
+ }
+ else if (target_path)
+ SVN_ERR(svn_cmdline_printf(pool, "%-10s %s", "", target_path));
+
+ return SVN_NO_ERROR;
+}
+
+/* Helper for print_info_item(): Print the revision number REV, which
+ may be SVN_INVALID_REVNUM, for TARGET_PATH, which may be NULL. Use
+ POOL for temporary allocation. */
+static svn_error_t *
+print_info_item_revision(svn_revnum_t rev, const char *target_path,
+ apr_pool_t *pool)
+{
+ if (SVN_IS_VALID_REVNUM(rev))
+ {
+ if (target_path)
+ SVN_ERR(svn_cmdline_printf(pool, "%-10ld %s", rev, target_path));
+ else
+ SVN_ERR(svn_cmdline_printf(pool, "%-10ld", rev));
+ }
+ else if (target_path)
+ SVN_ERR(svn_cmdline_printf(pool, "%-10s %s", "", target_path));
+
+ return SVN_NO_ERROR;
+}
+
+/* A callback of type svn_client_info_receiver2_t. */
+static svn_error_t *
+print_info_item(void *baton,
+ const char *target,
+ const svn_client_info2_t *info,
+ apr_pool_t *pool)
+{
+ print_info_baton_t *const receiver_baton = baton;
+ const char *const target_path =
+ (!receiver_baton->multiple_targets ? NULL
+ : (!receiver_baton->target_is_path ? info->URL
+ : svn_cl__local_style_skip_ancestor(
+ receiver_baton->path_prefix, target, pool)));
+
+ if (receiver_baton->start_new_line)
+ SVN_ERR(svn_cmdline_fputs("\n", stdout, pool));
+
+ switch (receiver_baton->print_what)
+ {
+ case info_item_kind:
+ SVN_ERR(print_info_item_string(svn_node_kind_to_word(info->kind),
+ target_path, pool));
+ break;
+
+ case info_item_url:
+ SVN_ERR(print_info_item_string(info->URL, target_path, pool));
+ break;
+
+ case info_item_relative_url:
+ SVN_ERR(print_info_item_string(relative_url(info, pool),
+ target_path, pool));
+ break;
+
+ case info_item_repos_root_url:
+ SVN_ERR(print_info_item_string(info->repos_root_URL, target_path, pool));
+ break;
+
+ case info_item_repos_uuid:
+ SVN_ERR(print_info_item_string(info->repos_UUID, target_path, pool));
+ break;
+
+ case info_item_revision:
+ SVN_ERR(print_info_item_revision(info->rev, target_path, pool));
+ break;
+
+ case info_item_last_changed_rev:
+ SVN_ERR(print_info_item_revision(info->last_changed_rev,
+ target_path, pool));
+ break;
+
+ case info_item_last_changed_date:
+ SVN_ERR(print_info_item_string(
+ (!info->last_changed_date ? NULL
+ : svn_time_to_cstring(info->last_changed_date, pool)),
+ target_path, pool));
+ break;
+
+ case info_item_last_changed_author:
+ SVN_ERR(print_info_item_string(info->last_changed_author,
+ target_path, pool));
+ break;
+
+ case info_item_wc_root:
+ SVN_ERR(print_info_item_string(
+ (info->wc_info && info->wc_info->wcroot_abspath
+ ? info->wc_info->wcroot_abspath : NULL),
+ target_path, pool));
+ break;
+
+ default:
+ SVN_ERR_MALFUNCTION();
+ }
+
+ receiver_baton->start_new_line = TRUE;
+ return SVN_NO_ERROR;
+}
+
+
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
svn_cl__info(apr_getopt_t *os,
@@ -592,7 +864,7 @@ svn_cl__info(apr_getopt_t *os,
svn_boolean_t seen_nonexistent_target = FALSE;
svn_opt_revision_t peg_revision;
svn_client_info_receiver2_t receiver;
- const char *path_prefix;
+ print_info_baton_t receiver_baton = { 0 };
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -605,26 +877,59 @@ svn_cl__info(apr_getopt_t *os,
{
receiver = print_info_xml;
+ if (opt_state->show_item)
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--show-item is not valid in --xml mode"));
+ if (opt_state->no_newline)
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--no-newline' is not valid in --xml mode"));
+
/* If output is not incremental, output the XML header and wrap
everything in a top-level element. This makes the output in
its entirety a well-formed XML document. */
if (! opt_state->incremental)
SVN_ERR(svn_cl__xml_print_header("info", pool));
}
+ else if (opt_state->show_item)
+ {
+ receiver = print_info_item;
+
+ if (opt_state->incremental)
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--incremental is only valid in --xml mode"));
+
+ receiver_baton.multiple_targets = (opt_state->depth > svn_depth_empty
+ || targets->nelts > 1);
+ if (receiver_baton.multiple_targets && opt_state->no_newline)
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--no-newline is only available for single-target,"
+ " non-recursive info operations"));
+
+ SVN_ERR(find_print_what(opt_state->show_item, &receiver_baton, pool));
+ receiver_baton.start_new_line = FALSE;
+ }
else
{
receiver = print_info;
if (opt_state->incremental)
- return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("'incremental' option only valid in XML "
- "mode"));
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--incremental is only valid in --xml mode"));
+ if (opt_state->no_newline)
+ return svn_error_create(
+ SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--no-newline' is only valid with --show-item"));
}
if (opt_state->depth == svn_depth_unknown)
opt_state->depth = svn_depth_empty;
- SVN_ERR(svn_dirent_get_absolute(&path_prefix, "", pool));
+ SVN_ERR(svn_dirent_get_absolute(&receiver_baton.path_prefix, "", pool));
for (i = 0; i < targets->nelts; i++)
{
@@ -642,10 +947,12 @@ svn_cl__info(apr_getopt_t *os,
{
if (peg_revision.kind == svn_opt_revision_unspecified)
peg_revision.kind = svn_opt_revision_head;
+ receiver_baton.target_is_path = FALSE;
}
else
{
SVN_ERR(svn_dirent_get_absolute(&truepath, truepath, subpool));
+ receiver_baton.target_is_path = TRUE;
}
err = svn_client_info4(truepath,
@@ -655,7 +962,7 @@ svn_cl__info(apr_getopt_t *os,
TRUE /* fetch_actual_only */,
opt_state->include_externals,
opt_state->changelists,
- receiver, (void *) path_prefix,
+ receiver, &receiver_baton,
ctx, subpool);
if (err)
@@ -682,6 +989,9 @@ svn_cl__info(apr_getopt_t *os,
if (opt_state->xml && (! opt_state->incremental))
SVN_ERR(svn_cl__xml_print_footer("info", pool));
+ else if (opt_state->show_item && !opt_state->no_newline
+ && receiver_baton.start_new_line)
+ SVN_ERR(svn_cmdline_fputs("\n", stdout, pool));
if (seen_nonexistent_target)
return svn_error_create(
Modified: subversion/branches/1.9.x/subversion/svn/propget-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/svn/propget-cmd.c?rev=1662916&r1=1662915&r2=1662916&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/svn/propget-cmd.c (original)
+++ subversion/branches/1.9.x/subversion/svn/propget-cmd.c Sat Feb 28 10:37:27 2015
@@ -322,11 +322,11 @@ svn_cl__propget(apr_getopt_t *os,
svn_stream_t *out;
svn_boolean_t warned = FALSE;
- if (opt_state->verbose && (opt_state->revprop || opt_state->strict
+ if (opt_state->verbose && (opt_state->revprop || opt_state->no_newline
|| opt_state->xml))
return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
_("--verbose cannot be used with --revprop or "
- "--strict or --xml"));
+ "--no-newline or --xml"));
/* PNAME is first argument (and PNAME_UTF8 will be a UTF-8 version
thereof) */
@@ -411,7 +411,7 @@ svn_cl__propget(apr_getopt_t *os,
SVN_ERR(stream_write(out, printable_val->data,
printable_val->len));
- if (! opt_state->strict)
+ if (! opt_state->no_newline)
SVN_ERR(stream_write(out, APR_EOL_STR, strlen(APR_EOL_STR)));
}
}
@@ -427,16 +427,16 @@ svn_cl__propget(apr_getopt_t *os,
if (opt_state->depth == svn_depth_unknown)
opt_state->depth = svn_depth_empty;
- /* Strict mode only makes sense for a single target. So make
+ /* No-newline mode only makes sense for a single target. So make
sure we have only a single target, and that we're not being
asked to recurse on that target. */
- if (opt_state->strict
+ if (opt_state->no_newline
&& ((targets->nelts > 1) || (opt_state->depth != svn_depth_empty)
|| (opt_state->show_inherited_props)))
return svn_error_create
(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Strict output of property values only available for single-"
- "target, non-recursive propget operations"));
+ _("--no-newline is only available for single-target,"
+ " non-recursive propget operations"));
for (i = 0; i < targets->nelts; i++)
{
@@ -472,15 +472,15 @@ svn_cl__propget(apr_getopt_t *os,
/* Any time there is more than one thing to print, or where
the path associated with a printed thing is not obvious,
we'll print filenames. That is, unless we've been told
- not to do so with the --strict option. */
+ not to do so with the --no-newline option. */
print_filenames = ((opt_state->depth > svn_depth_empty
|| targets->nelts > 1
|| apr_hash_count(props) > 1
|| opt_state->verbose
|| opt_state->show_inherited_props)
- && (! opt_state->strict));
- omit_newline = opt_state->strict;
- like_proplist = opt_state->verbose && !opt_state->strict;
+ && (! opt_state->no_newline));
+ omit_newline = opt_state->no_newline;
+ like_proplist = opt_state->verbose && !opt_state->no_newline;
/* If there are no properties, and exactly one node was queried,
then warn. */