Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 88568200BC7 for ; Fri, 25 Nov 2016 12:43:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 87094160B01; Fri, 25 Nov 2016 11:43:57 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A9237160AF6 for ; Fri, 25 Nov 2016 12:43:56 +0100 (CET) Received: (qmail 87100 invoked by uid 500); 25 Nov 2016 11:43:55 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 87090 invoked by uid 99); 25 Nov 2016 11:43:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Nov 2016 11:43:55 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 5672E1AB367 for ; Fri, 25 Nov 2016 11:43:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id MYh0AGC2yiVa for ; Fri, 25 Nov 2016 11:43:54 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id D28415F649 for ; Fri, 25 Nov 2016 11:43:53 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 3EE94E0045 for ; Fri, 25 Nov 2016 11:43:53 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 3E6093A0254 for ; Fri, 25 Nov 2016 11:43:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1771298 - /subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Date: Fri, 25 Nov 2016 11:43:53 -0000 To: commits@subversion.apache.org From: stsp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161125114353.3E6093A0254@svn01-us-west.apache.org> archived-at: Fri, 25 Nov 2016 11:43:57 -0000 Author: stsp Date: Fri Nov 25 11:43:53 2016 New Revision: 1771298 URL: http://svn.apache.org/viewvc?rev=1771298&view=rev Log: Introduce a special 'delete' editor callback for updates of incoming moves. * subversion/libsvn_wc/wc_db_update_move.c (tc_incoming_editor_delete): New. Deletes a working node instead of removing a row at a particular op-depth as in the local-move update case. (update_incoming_moved_node): Invoke the new function. Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Modified: subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c?rev=1771298&r1=1771297&r2=1771298&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c (original) +++ subversion/trunk/subversion/libsvn_wc/wc_db_update_move.c Fri Nov 25 11:43:53 2016 @@ -1484,6 +1484,93 @@ tc_editor_delete(node_move_baton_t *nmb, return SVN_NO_ERROR; } +/* Handle node deletion for an incoming move. */ +static svn_error_t * +tc_incoming_editor_delete(node_move_baton_t *nmb, + const char *relpath, + svn_node_kind_t old_kind, + svn_node_kind_t new_kind, + apr_pool_t *scratch_pool) +{ + update_move_baton_t *b = nmb->umb; + svn_sqlite__stmt_t *stmt; + const char *local_abspath; + svn_boolean_t is_modified, is_all_deletes; + svn_skel_t *work_items = NULL; + svn_skel_t *conflict = NULL; + + SVN_ERR(mark_parent_edited(nmb, scratch_pool)); + if (nmb->skip) + return SVN_NO_ERROR; + + /* Check before retracting delete to catch delete-delete + conflicts. This catches conflicts on the node itself; deleted + children are caught as local modifications below.*/ + if (nmb->shadowed) + { + SVN_ERR(mark_tc_on_op_root(nmb, + old_kind, new_kind, + svn_wc_conflict_action_delete, + scratch_pool)); + return SVN_NO_ERROR; + } + + 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, FALSE, + NULL, NULL, scratch_pool)); + if (is_modified) + { + svn_wc_conflict_reason_t reason; + + /* No conflict means no NODES rows at the relpath op-depth + so it's easy to convert the modified tree into a copy. + + Note the following assumptions for relpath: + * it is not shadowed + * 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, FALSE, + NULL, NULL, scratch_pool)); + + reason = svn_wc_conflict_reason_edited; + + SVN_ERR(create_node_tree_conflict(&conflict, nmb, relpath, + old_kind, new_kind, reason, + (new_kind == svn_node_none) + ? svn_wc_conflict_action_delete + : svn_wc_conflict_action_replace, + NULL, + scratch_pool, scratch_pool)); + nmb->skip = TRUE; + } + else + { + /* Delete the WORKING node at DST_RELPATH. */ + SVN_ERR(svn_sqlite__get_statement(&stmt, b->wcroot->sdb, + STMT_INSERT_DELETE_FROM_NODE_RECURSIVE)); + SVN_ERR(svn_sqlite__bindf(stmt, "isdd", + b->wcroot->wc_id, relpath, + 0, relpath_depth(relpath))); + SVN_ERR(svn_sqlite__step_done(stmt)); + } + + /* Only notify if add_file/add_dir is not going to notify */ + if (conflict || (new_kind == svn_node_none)) + SVN_ERR(update_move_list_add(b->wcroot, relpath, b->db, + svn_wc_notify_update_delete, + new_kind, + svn_wc_notify_state_inapplicable, + svn_wc_notify_state_inapplicable, + conflict, work_items, scratch_pool)); + else if (work_items) + SVN_ERR(svn_wc__db_wq_add_internal(b->wcroot, work_items, + scratch_pool)); + + return SVN_NO_ERROR; +} + /* * Driver code. * @@ -2094,8 +2181,8 @@ update_incoming_moved_node(node_move_bat if (working_kind == svn_node_none || (orig_kind != svn_node_none && orig_kind != working_kind)) { - SVN_ERR(tc_editor_delete(nmb, dst_relpath, orig_kind, working_kind, - scratch_pool)); + SVN_ERR(tc_incoming_editor_delete(nmb, dst_relpath, orig_kind, + working_kind, scratch_pool)); } if (nmb->skip)