Modified: subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/tree_conflict_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/tree_conflict_tests.py?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/tree_conflict_tests.py (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/tree_conflict_tests.py Thu Sep 26 13:47:21 2013 @@ -1455,6 +1455,67 @@ def update_dir_with_not_present(sbox): run_and_verify_svn(None, None, [], 'ci', '-m', '', wc_dir) +@XFail() +def update_delete_mixed_rev(sbox): + "update that deletes mixed-rev" + + sbox.build() + wc_dir = sbox.wc_dir + sbox.simple_move('A/B/E/alpha', 'A/B/E/alpha2') + sbox.simple_commit() + sbox.simple_update() + sbox.simple_rm('A/B') + sbox.simple_commit() + sbox.simple_update(revision=1) + sbox.simple_update(target='A/B/E', revision=2) + sbox.simple_mkdir('A/B/E2') + + # Update raises a tree conflict on A/B due to local mod A/B/E2 + expected_output = wc.State(wc_dir, { + 'A/B' : Item(status=' ', treeconflict='C'), + }) + expected_disk = main.greek_state.copy() + expected_disk.add({ + 'A/B/E2' : Item(), + 'A/B/E/alpha2' : Item(contents='This is the file \'alpha\'.\n'), + }) + expected_disk.remove('A/B/E/alpha') + expected_status = get_virginal_state(wc_dir, 3) + expected_status.remove('A/B/E/alpha') + expected_status.add({ + 'A/B/E2' : Item(status='A ', wc_rev='-'), + 'A/B/E/alpha2' : Item(status=' ', copied='+', wc_rev='-'), + }) + expected_status.tweak('A/B', + status='A ', copied='+', treeconflict='C', wc_rev='-') + expected_status.tweak('A/B/F', 'A/B/E', 'A/B/E/beta', 'A/B/lambda', + copied='+', wc_rev='-') + run_and_verify_update(wc_dir, + expected_output, expected_disk, expected_status, + None, None, None, None, None, 1, + wc_dir) + + # Resolving to working state should give a mixed-revision copy that + # gets committed as multiple copies + run_and_verify_resolved([sbox.ospath('A/B')], sbox.ospath('A/B')) + expected_output = wc.State(wc_dir, { + 'A/B' : Item(verb='Adding'), + 'A/B/E' : Item(verb='Replacing'), + 'A/B/E2' : Item(verb='Adding'), + }) + expected_status.tweak('A/B', 'A/B/E', 'A/B/E2', 'A/B/F', 'A/B/E/alpha2', + 'A/B/E/beta', 'A/B/lambda', + status=' ', wc_rev=4, copied=None, treeconflict=None) + run_and_verify_commit(wc_dir, + expected_output, expected_status, None, + wc_dir) + + expected_info = { + 'Name': 'alpha2', + 'Node Kind': 'file', + } + run_and_verify_info([expected_info], sbox.repo_url + '/A/B/E/alpha2') + ####################################################################### # Run the tests @@ -1485,6 +1546,7 @@ test_list = [ None, at_directory_external, actual_only_node_behaviour, update_dir_with_not_present, + update_delete_mixed_rev, ] if __name__ == '__main__':
Modified: subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/upgrade_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/upgrade_tests.py?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/upgrade_tests.py (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/tests/cmdline/upgrade_tests.py Thu Sep 26 13:47:21 2013 @@ -430,7 +430,10 @@ def basic_upgrade_1_0(sbox): url = sbox.repo_url - xml_entries_relocate(sbox.wc_dir, 'file:///1.0.0/repos', url) + # This is non-canonical by the rules of svn_uri_canonicalize, it gets + # written into the entries file and upgrade has to canonicalize. + non_canonical_url = url[:-1] + '%%%02x' % ord(url[-1]) + xml_entries_relocate(sbox.wc_dir, 'file:///1.0.0/repos', non_canonical_url) # Attempt to use the working copy, this should give an error expected_stderr = wc_is_too_old_regex Propchange: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_fs_fs/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Thu Sep 26 13:47:21 2013 @@ -10,4 +10,3 @@ test-get-set-revprop-packed-fs *~ .*~ *.exe - Propchange: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_fs_x/ ------------------------------------------------------------------------------ Reverse-merged /subversion/branches/fsx/subversion/tests/libsvn_fs_x:r1508077-1509914 Reverse-merged /subversion/branches/fsfs-format7/subversion/tests/libsvn_fs_x:r1507729-1507732,1507735-1507736 Merged /subversion/trunk/subversion/tests/libsvn_fs_x:r1507009-1507844,1509911-1509914,1516160-1526468 Merged /subversion/branches/fsfs-improvements/subversion/tests/libsvn_fs_x:r1499981-1517476 Propchange: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_fs_x/string-table-test.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/dirent_uri-test.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/dirent_uri-test.c (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/dirent_uri-test.c Thu Sep 26 13:47:21 2013 @@ -911,6 +911,9 @@ static const testcase_canonicalize_t uri { "file:///C:/temp/REPOS", "file:///C:/temp/REPOS" }, { "file:///c:/", "file:///c:" }, #endif /* SVN_USE_DOS_PATHS */ + /* Hostnames that look like non-canonical paths */ + { "file://./foo", "file://./foo" }, + { "http://./foo", "http://./foo" }, /* svn_uri_is_canonical() was a private function in the 1.6 API, and has since taken a MAJOR change of direction, namely that only absolute URLs are considered canonical uris now. */ Propchange: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/packed-data-test.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/prefix-string-test.c ------------------------------------------------------------------------------ svn:eol-style = native Propchange: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/priority-queue-test.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/string-test.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/string-test.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/string-test.c (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_subr/string-test.c Thu Sep 26 13:47:21 2013 @@ -656,7 +656,7 @@ test_string_similarity(apr_pool_t *pool) const char *stra; const char *strb; apr_size_t lcs; - int score; + unsigned int score; } tests[] = { #define SCORE(lcs, len) ((2000 * (lcs) + (len)/2) / (len)) Modified: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/op-depth-test.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/op-depth-test.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/op-depth-test.c (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/op-depth-test.c Thu Sep 26 13:47:21 2013 @@ -8207,6 +8207,61 @@ move_update_parent_replace(const svn_tes return SVN_NO_ERROR; } +static svn_error_t * +copy_mixed_rev_mods(const svn_test_opts_t *opts, apr_pool_t *pool) +{ + svn_test__sandbox_t b; + + SVN_ERR(svn_test__sandbox_create(&b, "copy_mixed_rev_mods", opts, + pool)); + + SVN_ERR(sbox_wc_mkdir(&b, "A")); + SVN_ERR(sbox_wc_mkdir(&b, "A/B")); + SVN_ERR(sbox_wc_commit(&b, "")); + SVN_ERR(sbox_wc_mkdir(&b, "A/B/C")); + SVN_ERR(sbox_wc_commit(&b, "")); + SVN_ERR(sbox_wc_update(&b, "", 1)); + SVN_ERR(sbox_wc_update(&b, "A/B", 2)); + SVN_ERR(sbox_wc_delete(&b, "A/B")); + SVN_ERR(sbox_wc_mkdir(&b, "A/B")); + + { + nodes_row_t nodes[] = { + {0, "", "normal", 1, ""}, + {0, "A", "normal", 1, "A"}, + {0, "A/B", "normal", 2, "A/B"}, + {0, "A/B/C", "normal", 2, "A/B/C"}, + {2, "A/B", "normal", NO_COPY_FROM}, + {2, "A/B/C", "base-deleted", NO_COPY_FROM}, + {0} + }; + SVN_ERR(check_db_rows(&b, "", nodes)); + } + + SVN_ERR(sbox_wc_copy(&b, "A", "X")); + { + nodes_row_t nodes[] = { + {1, "X", "normal", 1, "A"}, + {1, "X/B", "not-present", 2, "A/B"}, + {2, "X/B", "normal", NO_COPY_FROM}, + {0} + }; + SVN_ERR(check_db_rows(&b, "X", nodes)); + } + + SVN_ERR(sbox_wc_commit(&b, "X")); + { + nodes_row_t nodes[] = { + {0, "X", "normal", 3, "X"}, + {0, "X/B", "normal", 3, "X/B"}, + {0} + }; + SVN_ERR(check_db_rows(&b, "X", nodes)); + } + + return SVN_NO_ERROR; +} + /* ---------------------------------------------------------------------- */ /* The list of test functions */ @@ -8362,5 +8417,7 @@ struct svn_test_descriptor_t test_funcs[ "update with tree conflict (issue 4347)"), SVN_TEST_OPTS_PASS(move_update_parent_replace, "move update with replaced parent (issue 4388)"), + SVN_TEST_OPTS_XFAIL(copy_mixed_rev_mods, + "copy mixed-rev with mods"), SVN_TEST_NULL }; Modified: subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/wc-queries-test.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/wc-queries-test.c (original) +++ subversion/branches/invoke-diff-cmd-feature/subversion/tests/libsvn_wc/wc-queries-test.c Thu Sep 26 13:47:21 2013 @@ -165,7 +165,7 @@ test_sqlite_version(apr_pool_t *scratch_ printf("DBG: Using Sqlite %s\n", sqlite3_version); if (sqlite3_libversion_number() != SQLITE_VERSION_NUMBER) - printf("DBG: Compiled against Sqlite %s", SQLITE_VERSION); + printf("DBG: Compiled against Sqlite %s\n", SQLITE_VERSION); if (sqlite3_libversion_number() < SQLITE_VERSION_NUMBER) return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, Modified: subversion/branches/invoke-diff-cmd-feature/tools/dev/fsfs-access-map.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/tools/dev/fsfs-access-map.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/tools/dev/fsfs-access-map.c (original) +++ subversion/branches/invoke-diff-cmd-feature/tools/dev/fsfs-access-map.c Thu Sep 26 13:47:21 2013 @@ -52,9 +52,15 @@ typedef struct file_stats_t /* number of lseek calls to clusters not previously read */ apr_int64_t uncached_seek_count; + /* number of lseek counts not followed by a read */ + apr_int64_t unnecessary_seeks; + /* number of read() calls */ apr_int64_t read_count; + /* number of read() calls that returned 0 bytes */ + apr_int64_t empty_reads; + /* total number of bytes returned by those reads */ apr_int64_t read_size; @@ -86,6 +92,8 @@ typedef struct handle_info_t /* bytes read so far in the current series of reads started (default: 0) */ apr_int64_t last_read_size; + /* number of read() calls in this series */ + apr_int64_t read_count; } handle_info_t; /* useful typedef */ @@ -139,6 +147,11 @@ store_read_info(handle_info_t *handle_in ++*count; } } + else if (handle_info->read_count == 0) + { + /* two consecutive seeks */ + handle_info->file->unnecessary_seeks++; + } } /* Handle a open() call. Ensures that a file_info_t for the given NAME @@ -231,9 +244,13 @@ read_file(int handle, apr_int64_t count) { /* known file handle -> expand current read sequence */ + handle_info->read_count++; handle_info->last_read_size += count; handle_info->file->read_count++; handle_info->file->read_size += count; + + if (count == 0) + handle_info->file->empty_reads++; } } @@ -253,6 +270,7 @@ seek_file(int handle, apr_int64_t locati handle_info->last_read_size = 0; handle_info->last_read_start = location; + handle_info->read_count = 0; handle_info->file->seek_count++; /* if we seek to a location that had not been read from before, @@ -678,6 +696,8 @@ print_stats(apr_pool_t *pool) apr_int64_t clusters_read = 0; apr_int64_t unique_clusters_read = 0; apr_int64_t uncached_seek_count = 0; + apr_int64_t unnecessary_seek_count = 0; + apr_int64_t empty_read_count = 0; apr_hash_index_t *hi; for (hi = apr_hash_first(pool, files); hi; hi = apr_hash_next(hi)) @@ -695,13 +715,17 @@ print_stats(apr_pool_t *pool) clusters_read += file->clusters_read; unique_clusters_read += file->unique_clusters_read; uncached_seek_count += file->uncached_seek_count; + unnecessary_seek_count += file->unnecessary_seeks; + empty_read_count += file->empty_reads; } printf("%20s files\n", svn__i64toa_sep(apr_hash_count(files), ',', pool)); printf("%20s files opened\n", svn__i64toa_sep(open_count, ',', pool)); printf("%20s seeks\n", svn__i64toa_sep(seek_count, ',', pool)); + printf("%20s unnecessary seeks\n", svn__i64toa_sep(unnecessary_seek_count, ',', pool)); printf("%20s uncached seeks\n", svn__i64toa_sep(uncached_seek_count, ',', pool)); printf("%20s reads\n", svn__i64toa_sep(read_count, ',', pool)); + printf("%20s empty reads\n", svn__i64toa_sep(empty_read_count, ',', pool)); printf("%20s unique clusters read\n", svn__i64toa_sep(unique_clusters_read, ',', pool)); printf("%20s clusters read\n", svn__i64toa_sep(clusters_read, ',', pool)); printf("%20s bytes read\n", svn__i64toa_sep(read_size, ',', pool)); Modified: subversion/branches/invoke-diff-cmd-feature/tools/dev/unix-build/Makefile.svn URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/tools/dev/unix-build/Makefile.svn?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/tools/dev/unix-build/Makefile.svn (original) +++ subversion/branches/invoke-diff-cmd-feature/tools/dev/unix-build/Makefile.svn Thu Sep 26 13:47:21 2013 @@ -741,6 +741,7 @@ $(SERF_OBJDIR)/.compiled: $(SERF_OBJDIR) # install serf $(SERF_OBJDIR)/.installed: $(SERF_OBJDIR)/.compiled + rm -rf $(PREFIX)/serf # XXX scons cannot reinstall :( cd $(SERF_SRCDIR) && \ scons install touch $@ Modified: subversion/branches/invoke-diff-cmd-feature/tools/dist/backport.pl URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/tools/dist/backport.pl?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/tools/dist/backport.pl (original) +++ subversion/branches/invoke-diff-cmd-feature/tools/dist/backport.pl Thu Sep 26 13:47:21 2013 @@ -367,13 +367,14 @@ sub parse_entry { # summary do { push @logsummary, shift - } until $_[0] =~ /^\s*\w+:/ or not defined $_[0]; + } until $_[0] =~ /^\s*[][\w]+:/ or not defined $_[0]; # votes unshift @votes, pop until $_[-1] =~ /^\s*Votes:/ or not defined $_[-1]; pop; # depends, branch, notes + # Ignored headers: Changes[*] while (@_) { given (shift) { when (/^Depends:/) { Modified: subversion/branches/invoke-diff-cmd-feature/tools/server-side/fsfs-stats.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/tools/server-side/fsfs-stats.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/tools/server-side/fsfs-stats.c (original) +++ subversion/branches/invoke-diff-cmd-feature/tools/server-side/fsfs-stats.c Thu Sep 26 13:47:21 2013 @@ -271,6 +271,12 @@ typedef struct fs_fs_t /* history of sizes of changed nodes */ histogram_t node_size_histogram; + /* history of representation sizes */ + histogram_t added_rep_size_histogram; + + /* history of sizes of changed nodes */ + histogram_t added_node_size_histogram; + /* history of unused representations */ histogram_t unused_rep_histogram; @@ -487,6 +493,7 @@ add_to_histogram(histogram_t *histogram, /* Update data aggregators in FS with this representation of type KIND, on- * disk REP_SIZE and expanded node size EXPANDED_SIZE for PATH in REVSION. + * PLAIN_ADDED indicates whether the node has a deltification predecessor. */ static void add_change(fs_fs_t *fs, @@ -494,7 +501,8 @@ add_change(fs_fs_t *fs, apr_int64_t expanded_size, svn_revnum_t revision, const char *path, - rep_kind_t kind) + rep_kind_t kind, + svn_boolean_t plain_added) { /* identify largest reps */ if (rep_size >= fs->largest_changes->min_size) @@ -523,6 +531,12 @@ add_change(fs_fs_t *fs, add_to_histogram(&fs->rep_size_histogram, rep_size); add_to_histogram(&fs->node_size_histogram, expanded_size); + if (plain_added) + { + add_to_histogram(&fs->added_rep_size_histogram, rep_size); + add_to_histogram(&fs->added_node_size_histogram, expanded_size); + } + /* specific histograms by type */ switch (kind) { @@ -1289,6 +1303,7 @@ read_noderev(fs_fs_t *fs, representation_t *props = NULL; apr_size_t start_offset = offset; svn_boolean_t is_dir = FALSE; + svn_boolean_t has_predecessor = FALSE; const char *path = "???"; scratch_pool = svn_pool_create(scratch_pool); @@ -1349,15 +1364,17 @@ read_noderev(fs_fs_t *fs, } else if (key_matches(&key, "cpath")) path = value.data; + else if (key_matches(&key, "pred")) + has_predecessor = TRUE; } /* record largest changes */ if (text && text->ref_count == 1) add_change(fs, (apr_int64_t)text->size, (apr_int64_t)text->expanded_size, - text->revision, path, text->kind); + text->revision, path, text->kind, !has_predecessor); if (props && props->ref_count == 1) add_change(fs, (apr_int64_t)props->size, (apr_int64_t)props->expanded_size, - props->revision, path, props->kind); + props->revision, path, props->kind, !has_predecessor); /* if this is a directory and has not been processed, yet, read and * process it recursively */ @@ -2046,6 +2063,7 @@ print_stats(fs_fs_t *fs, printf(_("%20s bytes in %12s representations total\n" "%20s bytes in %12s directory representations\n" "%20s bytes in %12s file representations\n" + "%20s bytes in %12s representations of added file nodes\n" "%20s bytes in %12s directory property representations\n" "%20s bytes in %12s file property representations\n" "%20s bytes in header & footer overhead\n"), @@ -2055,6 +2073,8 @@ print_stats(fs_fs_t *fs, svn__i64toa_sep(dir_rep_stats.total.count, ',', pool), svn__i64toa_sep(file_rep_stats.total.packed_size, ',', pool), svn__i64toa_sep(file_rep_stats.total.count, ',', pool), + svn__i64toa_sep(fs->added_rep_size_histogram.total.sum, ',', pool), + svn__i64toa_sep(fs->added_rep_size_histogram.total.count, ',', pool), svn__i64toa_sep(dir_prop_rep_stats.total.packed_size, ',', pool), svn__i64toa_sep(dir_prop_rep_stats.total.count, ',', pool), svn__i64toa_sep(file_prop_rep_stats.total.packed_size, ',', pool), Modified: subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-populate-node-origins-index.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-populate-node-origins-index.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-populate-node-origins-index.c (original) +++ subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-populate-node-origins-index.c Thu Sep 26 13:47:21 2013 @@ -77,7 +77,8 @@ index_revision_adds(int *count, svn_fs_t *count = 0; SVN_ERR(svn_fs_revision_root(&root, fs, revision, pool)); - SVN_ERR(svn_fs_paths_changed2(&changes, root, pool)); + SVN_ERR(svn_fs_paths_changed3(&changes, root, + svn_move_behavior_explicit_moves, pool)); /* No paths changed in this revision? Nothing to do. */ if (apr_hash_count(changes) == 0) @@ -94,7 +95,9 @@ index_revision_adds(int *count, svn_fs_t apr_hash_this(hi, &path, NULL, &val); change = val; if ((change->change_kind == svn_fs_path_change_add) - || (change->change_kind == svn_fs_path_change_replace)) + || (change->change_kind == svn_fs_path_change_replace) + || (change->change_kind == svn_fs_path_change_move) + || (change->change_kind == svn_fs_path_change_movereplace)) { if (! (change->copyfrom_path && SVN_IS_VALID_REVNUM(change->copyfrom_rev))) Modified: subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-rep-sharing-stats.c URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-rep-sharing-stats.c?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-rep-sharing-stats.c (original) +++ subversion/branches/invoke-diff-cmd-feature/tools/server-side/svn-rep-sharing-stats.c Thu Sep 26 13:47:21 2013 @@ -33,6 +33,7 @@ #include "../../subversion/libsvn_fs_fs/fs_fs.h" /* for svn_fs_fs__id_* (used in assertions only) */ #include "../../subversion/libsvn_fs_fs/id.h" +#include "../../subversion/libsvn_fs_fs/cached_data.h" #include "private/svn_cmdline_private.h" @@ -183,7 +184,8 @@ struct key_t /* What we need to know about a rep. */ struct value_t { - svn_checksum_t *sha1_checksum; + svn_checksum_t checksum; + unsigned char sha1_digest[APR_SHA1_DIGESTSIZE]; apr_uint64_t refcount; }; @@ -201,7 +203,7 @@ static svn_error_t *record(apr_hash_t *r * exist or doesn't have the checksum we are after. (The latter case * often corresponds to node_rev->kind == svn_node_dir.) */ - if (records == NULL || rep == NULL || rep->sha1_checksum == NULL) + if (records == NULL || rep == NULL || !rep->has_sha1) return SVN_NO_ERROR; /* Construct the key. @@ -216,17 +218,19 @@ static svn_error_t *record(apr_hash_t *r if ((value = apr_hash_get(records, key, sizeof(*key)))) { /* Paranoia. */ - SVN_ERR_ASSERT(value->sha1_checksum != NULL); - SVN_ERR_ASSERT(svn_checksum_match(value->sha1_checksum, - rep->sha1_checksum)); + SVN_ERR_ASSERT(memcmp(value->sha1_digest, + rep->sha1_digest, + sizeof(value->sha1_digest))); /* Real work. */ value->refcount++; } else { value = apr_palloc(result_pool, sizeof(*value)); - value->sha1_checksum = svn_checksum_dup(rep->sha1_checksum, result_pool); + value->checksum.digest = value->sha1_digest; + value->checksum.kind = svn_checksum_sha1; value->refcount = 1; + memcpy(value->sha1_digest, rep->sha1_digest, sizeof(value->sha1_digest)); } /* Store them. */ @@ -265,7 +269,9 @@ process_one_revision(svn_fs_t *fs, /* Get the changed paths. */ SVN_ERR(svn_fs_revision_root(&rev_root, fs, revnum, scratch_pool)); - SVN_ERR(svn_fs_paths_changed2(&paths_changed, rev_root, scratch_pool)); + SVN_ERR(svn_fs_paths_changed3(&paths_changed, rev_root, + svn_move_behavior_explicit_moves, + scratch_pool)); /* Iterate them. */ /* ### use iterpool? */ @@ -341,7 +347,7 @@ pretty_print(const char *name, SVN_ERR(svn_cmdline_printf(scratch_pool, "%s %" APR_UINT64_T_FMT " %s\n", name, value->refcount, svn_checksum_to_cstring_display( - value->sha1_checksum, + &value->checksum, scratch_pool))); } Modified: subversion/branches/invoke-diff-cmd-feature/tools/server-side/svnpubsub/svnwcsub.py URL: http://svn.apache.org/viewvc/subversion/branches/invoke-diff-cmd-feature/tools/server-side/svnpubsub/svnwcsub.py?rev=1526487&r1=1526486&r2=1526487&view=diff ============================================================================== --- subversion/branches/invoke-diff-cmd-feature/tools/server-side/svnpubsub/svnwcsub.py (original) +++ subversion/branches/invoke-diff-cmd-feature/tools/server-side/svnpubsub/svnwcsub.py Thu Sep 26 13:47:21 2013 @@ -476,7 +476,15 @@ def handle_options(options): # Otherwise, we should write this (foreground) PID into the file. if options.pidfile and not options.daemon: pid = os.getpid() - open(options.pidfile, 'w').write('%s\n' % pid) + # Be wary of symlink attacks + try: + os.remove(options.pidfile) + except OSError: + pass + fd = os.open(options.pidfile, os.O_WRONLY | os.O_CREAT | os.O_EXCL, + 0444) + os.write(fd, '%d\n' % pid) + os.close(fd) logging.info('pid %d written to %s', pid, options.pidfile) if options.gid: @@ -536,7 +544,8 @@ def main(args): # We manage the logfile ourselves (along with possible rotation). The # daemon process can just drop stdout/stderr into /dev/null. - d = Daemon('/dev/null', options.pidfile, options.umask, bdec) + d = Daemon('/dev/null', os.path.abspath(options.pidfile), + options.umask, bdec) if options.daemon: # Daemonize the process and call sys.exit() with appropriate code d.daemonize_exit()
