Author: julianfoad Date: Wed Nov 16 12:51:31 2011 New Revision: 1202682 URL: http://svn.apache.org/viewvc?rev=1202682&view=rev Log: On the 'showing-merge-info' branch: Catch up to trunk@1202674.
Modified: subversion/branches/showing-merge-info/ (props changed) subversion/branches/showing-merge-info/subversion/libsvn_wc/entries.c subversion/branches/showing-merge-info/subversion/libsvn_wc/wc_db.c subversion/branches/showing-merge-info/subversion/svn/cl.h subversion/branches/showing-merge-info/subversion/svn/status-cmd.c subversion/branches/showing-merge-info/subversion/svn/status.c subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tests.py subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tree_conflict_tests.py Propchange: subversion/branches/showing-merge-info/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Nov 16 12:51:31 2011 @@ -57,4 +57,4 @@ /subversion/branches/tree-conflicts:868291-873154 /subversion/branches/tree-conflicts-notify:873926-874008 /subversion/branches/uris-as-urls:1060426-1064427 -/subversion/trunk:1177607-1202384 +/subversion/trunk:1177607-1202674 Modified: subversion/branches/showing-merge-info/subversion/libsvn_wc/entries.c URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_wc/entries.c?rev=1202682&r1=1202681&r2=1202682&view=diff ============================================================================== --- subversion/branches/showing-merge-info/subversion/libsvn_wc/entries.c (original) +++ subversion/branches/showing-merge-info/subversion/libsvn_wc/entries.c Wed Nov 16 12:51:31 2011 @@ -1476,8 +1476,20 @@ insert_node(svn_sqlite__db_t *sdb, svn_node_kind_to_word(node->kind))); if (node->kind == svn_node_file) - SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, node->checksum, - scratch_pool)); + { + if (!node->checksum + && node->op_depth == 0 + && node->presence != svn_wc__db_status_not_present + && node->presence != svn_wc__db_status_excluded + && node->presence != svn_wc__db_status_server_excluded) + return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL, + _("The file '%s' has no checksum"), + svn_dirent_local_style(node->local_relpath, + scratch_pool)); + + SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, node->checksum, + scratch_pool)); + } if (node->properties) /* ### Never set, props done later */ SVN_ERR(svn_sqlite__bind_properties(stmt, 15, node->properties, Modified: subversion/branches/showing-merge-info/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/libsvn_wc/wc_db.c?rev=1202682&r1=1202681&r2=1202682&view=diff ============================================================================== --- subversion/branches/showing-merge-info/subversion/libsvn_wc/wc_db.c (original) +++ subversion/branches/showing-merge-info/subversion/libsvn_wc/wc_db.c Wed Nov 16 12:51:31 2011 @@ -842,6 +842,15 @@ insert_base_node(void *baton, moved_to_relpath /* 21 */)); if (pibb->kind == svn_kind_file) { + if (!pibb->checksum + && pibb->status != svn_wc__db_status_not_present + && pibb->status != svn_wc__db_status_excluded + && pibb->status != svn_wc__db_status_server_excluded) + return svn_error_createf(SVN_ERR_WC_CORRUPT, svn_sqlite__reset(stmt), + _("The file '%s' has no checksum."), + path_for_error_message(wcroot, local_relpath, + scratch_pool)); + SVN_ERR(svn_sqlite__bind_checksum(stmt, 14, pibb->checksum, scratch_pool)); Modified: subversion/branches/showing-merge-info/subversion/svn/cl.h URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/cl.h?rev=1202682&r1=1202681&r2=1202682&view=diff ============================================================================== --- subversion/branches/showing-merge-info/subversion/svn/cl.h (original) +++ subversion/branches/showing-merge-info/subversion/svn/cl.h Wed Nov 16 12:51:31 2011 @@ -393,9 +393,14 @@ svn_cl__time_cstring_to_human_cstring(co Increment *TEXT_CONFLICTS, *PROP_CONFLICTS, or *TREE_CONFLICTS if a conflict was encountered. - */ + + Use CWD_ABSPATH -- the absolute path of the current working + directory -- to shorten PATH into something relative to that + directory as necessary. +*/ svn_error_t * -svn_cl__print_status(const char *path, +svn_cl__print_status(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_boolean_t detailed, svn_boolean_t show_last_committed, @@ -409,9 +414,15 @@ svn_cl__print_status(const char *path, /* Print STATUS for PATH in XML to stdout. Use POOL for temporary - allocations. */ + allocations. + + Use CWD_ABSPATH -- the absolute path of the current working + directory -- to shorten PATH into something relative to that + directory as necessary. + */ svn_error_t * -svn_cl__print_status_xml(const char *path, +svn_cl__print_status_xml(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_client_ctx_t *ctx, apr_pool_t *pool); Modified: subversion/branches/showing-merge-info/subversion/svn/status-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/status-cmd.c?rev=1202682&r1=1202681&r2=1202682&view=diff ============================================================================== --- subversion/branches/showing-merge-info/subversion/svn/status-cmd.c (original) +++ subversion/branches/showing-merge-info/subversion/svn/status-cmd.c Wed Nov 16 12:51:31 2011 @@ -50,6 +50,7 @@ struct status_baton { /* These fields all correspond to the ones in the svn_cl__print_status() interface. */ + const char *cwd_abspath; svn_boolean_t detailed; svn_boolean_t show_last_committed; svn_boolean_t skip_unrecognized; @@ -149,9 +150,11 @@ print_status_normal_or_xml(void *baton, struct status_baton *sb = baton; if (sb->xml_mode) - return svn_cl__print_status_xml(path, status, sb->ctx, pool); + return svn_cl__print_status_xml(sb->cwd_abspath, path, status, + sb->ctx, pool); else - return svn_cl__print_status(path, status, sb->detailed, + return svn_cl__print_status(sb->cwd_abspath, path, status, + sb->detailed, sb->show_last_committed, sb->skip_unrecognized, sb->repos_locks, @@ -298,6 +301,7 @@ svn_cl__status(apr_getopt_t *os, "mode")); } + SVN_ERR(svn_dirent_get_absolute(&(sb.cwd_abspath), "", scratch_pool)); sb.detailed = (opt_state->verbose || opt_state->update); sb.show_last_committed = opt_state->verbose; sb.skip_unrecognized = opt_state->quiet; Modified: subversion/branches/showing-merge-info/subversion/svn/status.c URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/svn/status.c?rev=1202682&r1=1202681&r2=1202682&view=diff ============================================================================== --- subversion/branches/showing-merge-info/subversion/svn/status.c (original) +++ subversion/branches/showing-merge-info/subversion/svn/status.c Wed Nov 16 12:51:31 2011 @@ -187,7 +187,7 @@ make_relpath(const char *relative_to_pat /* Print STATUS and PATH in a format determined by DETAILED and SHOW_LAST_COMMITTED. */ static svn_error_t * -print_status(const char *path, +print_status(const char *cwd_abspath, const char *path, svn_boolean_t detailed, svn_boolean_t show_last_committed, svn_boolean_t repos_locks, @@ -205,6 +205,8 @@ print_status(const char *path, const char *moved_from_line = ""; const char *moved_to_line = ""; + path = make_relpath(cwd_abspath, path, pool, pool); + /* For historic reasons svn ignores the property status for added nodes, even if these nodes were copied and have local property changes. @@ -277,13 +279,12 @@ print_status(const char *path, * move info for in 'svn status'. See also comments in svn_wc_status3_t. */ if (status->moved_from_abspath || status->moved_to_abspath) { - const char *cwd; const char *relpath; - SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool)); if (status->moved_from_abspath) { - relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_from_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); moved_from_line = apr_pstrcat(pool, "\n > ", apr_psprintf(pool, _("moved from %s"), @@ -293,7 +294,8 @@ print_status(const char *path, if (status->moved_to_abspath) { - relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_to_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); moved_to_line = apr_pstrcat(pool, "\n > ", apr_psprintf(pool, _("moved to %s"), @@ -419,7 +421,8 @@ print_status(const char *path, svn_error_t * -svn_cl__print_status_xml(const char *path, +svn_cl__print_status_xml(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_client_ctx_t *ctx, apr_pool_t *pool) @@ -436,6 +439,8 @@ svn_cl__print_status_xml(const char *pat SVN_ERR(svn_wc_conflicted_p3(NULL, NULL, &tree_conflicted, ctx->wc_ctx, local_abspath, pool)); + path = make_relpath(cwd_abspath, path, pool, pool); + svn_xml_make_open_tag(&sb, pool, svn_xml_normal, "entry", "path", svn_dirent_local_style(path, pool), NULL); @@ -464,18 +469,19 @@ svn_cl__print_status_xml(const char *pat "true"); if (status->moved_from_abspath || status->moved_to_abspath) { - const char *cwd; const char *relpath; - SVN_ERR(svn_dirent_get_absolute(&cwd, "", pool)); + if (status->moved_from_abspath) { - relpath = make_relpath(cwd, status->moved_from_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_from_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); apr_hash_set(att_hash, "moved-from", APR_HASH_KEY_STRING, relpath); } if (status->moved_to_abspath) { - relpath = make_relpath(cwd, status->moved_to_abspath, pool, pool); + relpath = make_relpath(cwd_abspath, status->moved_to_abspath, + pool, pool); relpath = svn_dirent_local_style(relpath, pool); apr_hash_set(att_hash, "moved-to", APR_HASH_KEY_STRING, relpath); } @@ -519,7 +525,8 @@ svn_cl__print_status_xml(const char *pat /* Called by status-cmd.c */ svn_error_t * -svn_cl__print_status(const char *path, +svn_cl__print_status(const char *cwd_abspath, + const char *path, const svn_client_status_t *status, svn_boolean_t detailed, svn_boolean_t show_last_committed, @@ -540,7 +547,7 @@ svn_cl__print_status(const char *path, && status->repos_node_status == svn_wc_status_none)) return SVN_NO_ERROR; - return print_status(svn_dirent_local_style(path, pool), + return print_status(cwd_abspath, svn_dirent_local_style(path, pool), detailed, show_last_committed, repos_locks, status, text_conflicts, prop_conflicts, tree_conflicts, ctx, pool); Modified: subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tests.py?rev=1202682&r1=1202681&r2=1202682&view=diff ============================================================================== --- subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tests.py (original) +++ subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tests.py Wed Nov 16 12:51:31 2011 @@ -51,13 +51,21 @@ from svntest.actions import inject_confl def expected_merge_output(rev_ranges, additional_lines=None, foreign=False, elides=False, two_url=False): """Generate an (inefficient) regex representing the expected merge - output and mergeinfo notifications from REV_RANGES (a list of 'range' lists - of the form [start, end] or [single_rev] --> [single_rev - 1, single_rev]), - and ADDITIONAL_LINES (a list of strings). If REV_RANGES is None then only - the standard notification for a 3-way merge is expected. If ELIDES is true - add to the regex an expression representing elision notification. If TWO_URL - us true tweak the regex to expect the appropriate mergeinfo notification - for a 3-way merge.""" + output and mergeinfo notifications from REV_RANGES and ADDITIONAL_LINES. + + REV_RANGES is a list of revision ranges for which mergeinfo is being + recorded. Each range is of the form [start, end] (where both START and + END are inclusive, unlike in '-rX:Y') or the form [single_rev] (which is + like '-c SINGLE_REV'). If REV_RANGES is None then only the standard + notification for a 3-way merge is expected. + + ADDITIONAL_LINES is a list of regular expression strings to match the + other lines of output. + + If ELIDES is true, add to the regex an expression representing elision + notification. If TWO_URL is true, tweak the regex to expect the + appropriate mergeinfo notification for a 3-way merge.""" + if rev_ranges is None: lines = [svntest.main.merge_notify_line(None, None, False, foreign)] else: @@ -12509,24 +12517,44 @@ def svn_copy(s_rev, path1, path2): svntest.actions.run_and_verify_svn(None, None, [], 'copy', '--parents', '-r', s_rev, path1, path2) -def svn_merge(rev_spec, source, target, exp_out=None, *args): - """Merge a single change from path 'source' to path 'target'. - SRC_CHANGE_NUM is either a number (to cherry-pick that specific change) - or a command-line option revision range string such as '-r10:20'. - *ARGS are additional arguments passed to svn merge.""" +def svn_merge(rev_range, source, target, lines=None, + text_conflicts=0, prop_conflicts=0, tree_conflicts=0, args=[]): + """Merge a single change from path SOURCE to path TARGET and verify the + output and that there is no error. (The changes made are not verified.) + + REV_RANGE is either a number (to cherry-pick that specific change) or a + two-element list [X,Y] to pick the revision range '-r(X-1):Y'. + + LINES is a list of regular expressions to match other lines of output; if + LINES is 'None' then match all normal (non-conflicting) merges. + + TEXT_CONFLICTS, PROP_CONFLICTS and TREE_CONFLICTS specify the number of + each kind of conflict to expect. + + ARGS are additional arguments passed to svn merge.""" + source = local_path(source) target = local_path(target) - if isinstance(rev_spec, int): - rev_spec = '-c' + str(rev_spec) - if exp_out is None: + if isinstance(rev_range, int): + mi_rev_range = [rev_range] + rev_arg = '-c' + str(rev_range) + else: + mi_rev_range = rev_range + rev_arg = '-r' + str(rev_range[0] - 1) + ':' + str(rev_range[1]) + if lines is None: target_re = re.escape(target) - exp_1 = "--- Merging r.* into '" + target_re + ".*':" - exp_2 = "(A |D |[UG] | [UG]|[UG][UG]) " + target_re + ".*" - exp_3 = "--- Recording mergeinfo for merge of r.* into '" + \ - target_re + ".*':" - exp_out = svntest.verify.RegexOutput(exp_1 + "|" + exp_2 + "|" + exp_3) + lines = ["(A |D |[UG] | [UG]|[UG][UG]) " + target_re + ".*"] + if text_conflicts or prop_conflicts or tree_conflicts: + lines.append("Summary of conflicts:\n") + if text_conflicts: + lines.append(" Text conflicts: %d\n" % text_conflicts) + if prop_conflicts: + lines.append(" Property conflicts: %d\n" % prop_conflicts) + if tree_conflicts: + lines.append(" Tree conflicts: %d\n" % tree_conflicts) + exp_out = expected_merge_output([mi_rev_range], lines) svntest.actions.run_and_verify_svn(None, exp_out, [], - 'merge', rev_spec, source, target, *args) + 'merge', rev_arg, source, target, *args) #---------------------------------------------------------------------- # Tests for merging the deletion of a node, where the node to be deleted @@ -12558,7 +12586,7 @@ def del_identical_file(sbox): svn_copy(s_rev_mod, source, target) sbox.simple_commit(target) # Should be deleted quietly. - svn_merge(s_rev_del, source, target, '--- Merging|D |--- Recording| U') + svn_merge(s_rev_del, source, target, ['D ', ' U']) # Make a differing copy, locally modify it so it's the same, # and merge a deletion to it. @@ -12567,7 +12595,7 @@ def del_identical_file(sbox): sbox.simple_commit(target) svn_modfile(target+"/tau") # Should be deleted quietly. - svn_merge(s_rev_del, source, target, '--- Merging|D |--- Recording| U') + svn_merge(s_rev_del, source, target, ['D ', ' U']) os.chdir(saved_cwd) @@ -12594,10 +12622,9 @@ def del_sched_add_hist_file(sbox): svn_copy(s_rev_orig, source, target) sbox.simple_commit(target) s_rev = 3 - svn_merge(s_rev_add, source, target, '--- Merging|A |--- Recording| U') + svn_merge(s_rev_add, source, target, ['A ', ' U']) # Should be deleted quietly. - svn_merge(-s_rev_add, source, target, - '--- Reverse-merging|D |--- Recording| U| G|--- Eliding') + svn_merge(-s_rev_add, source, target, ['D ', ' U', ' G', '--- Eliding']) os.chdir(saved_cwd) @@ -13052,15 +13079,10 @@ def merge_two_edits_to_same_prop(sbox): rev4 = initial_rev + 4 # Merge the two changes together to source. - svn_merge('-r'+str(rev3-1)+':'+str(rev4), A_COPY_path, A_path, [ - "--- Merging r9 through r10 into '%s':\n" % A_path, + svn_merge([rev3, rev4], A_COPY_path, A_path, [ " C %s\n" % mu_path, - "--- Recording mergeinfo for merge of r9 through r10 into '%s':\n" \ - % A_path, " U A\n", - "Summary of conflicts:\n", - " Property conflicts: 1\n"], - '--allow-mixed-revisions') + ], prop_conflicts=1, args=['--allow-mixed-revisions']) # Revert changes to source wc, to test next scenario of #3250 svntest.actions.run_and_verify_svn(None, None, [], @@ -13068,21 +13090,13 @@ def merge_two_edits_to_same_prop(sbox): # Merge the first change, then the second, to source. svn_merge(rev3, A_COPY_path, A_path, [ - "--- Merging r9 into '%s':\n" % A_path, " C %s\n" % mu_path, - "--- Recording mergeinfo for merge of r9 into '%s':\n" % A_path, " U A\n", - "Summary of conflicts:\n", - " Property conflicts: 1\n"], - '--allow-mixed-revisions') + ], prop_conflicts=1, args=['--allow-mixed-revisions']) svn_merge(rev4, A_COPY_path, A_path, [ - "--- Merging r10 into '%s':\n" % A_path, " C %s\n" % mu_path, - "--- Recording mergeinfo for merge of r10 into '%s':\n" % A_path, " G A\n", - "Summary of conflicts:\n", - " Property conflicts: 1\n"], - '--allow-mixed-revisions') + ], prop_conflicts=1, args=['--allow-mixed-revisions']) os.chdir(was_cwd) @@ -13131,8 +13145,8 @@ def merge_an_eol_unification_and_set_svn sbox.simple_commit('A_COPY') # Merge the two changes together to the target branch. - svn_merge('-r'+str(rev1)+':'+str(rev3), 'A', 'A_COPY', None, - '--allow-mixed-revisions') + svn_merge([rev2, rev3], 'A', 'A_COPY', + args=['--allow-mixed-revisions']) # That merge should succeed. # Surprise: setting svn:eol-style='LF' instead of 'native' doesn't fail. Modified: subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tree_conflict_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tree_conflict_tests.py?rev=1202682&r1=1202681&r2=1202682&view=diff ============================================================================== --- subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tree_conflict_tests.py (original) +++ subversion/branches/showing-merge-info/subversion/tests/cmdline/merge_tree_conflict_tests.py Wed Nov 16 12:51:31 2011 @@ -685,20 +685,14 @@ def del_differing_file(sbox): pi = os.path.join(dir_D, 'G2', 'pi') # Should complain and "skip" it. svn_merge(s_rev_tau, source, target, [ - "--- Merging r2 into '%s':\n" % dir_G2, - " C %s\n" % tau, - "--- Recording mergeinfo for merge of r2 into '%s':\n" % (dir_G2), - " U %s\n" % (dir_G2), - "Summary of conflicts:\n", - " Tree conflicts: 1\n"]) + " C %s\n" % tau, # merge + " U %s\n" % (dir_G2), # mergeinfo + ], tree_conflicts=1) svn_merge(s_rev_pi, source, target, [ - "--- Merging r3 into '%s':\n" % dir_G2, - " C %s\n" % pi, - "--- Recording mergeinfo for merge of r3 into '%s':\n" % (dir_G2), - " G %s\n" % (dir_G2), - "Summary of conflicts:\n", - " Tree conflicts: 1\n"]) + " C %s\n" % pi, # merge + " G %s\n" % (dir_G2), # mergeinfo + ], tree_conflicts=1) # Copy a file, modify it, commit, and merge a deletion to it. @@ -716,20 +710,14 @@ def del_differing_file(sbox): # Should complain and "skip" it. svn_merge(s_rev_tau, source, target, [ - "--- Merging r2 into '%s':\n" % dir_G3, - " C %s\n" % tau, - "--- Recording mergeinfo for merge of r2 into '%s':\n" % (dir_G3), - " U %s\n" % (dir_G3), - "Summary of conflicts:\n", - " Tree conflicts: 1\n"]) + " C %s\n" % tau, # merge + " U %s\n" % (dir_G3), # mergeinfo + ], tree_conflicts=1) svn_merge(s_rev_pi, source, target, [ - "--- Merging r3 into '%s':\n" % dir_G3, - " C %s\n" % pi, - "--- Recording mergeinfo for merge of r3 into '%s':\n" % (dir_G3), - " G %s\n" % (dir_G3), - "Summary of conflicts:\n", - " Tree conflicts: 1\n"]) + " C %s\n" % pi, # merge + " G %s\n" % (dir_G3), # mergeinfo + ], tree_conflicts=1) os.chdir(saved_cwd)