You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2016/10/11 09:11:54 UTC
svn commit: r1764214 [20/21] - in /subversion/branches/ra-git: ./ build/
build/ac-macros/ build/generator/ build/win32/ contrib/client-side/
contrib/client-side/svnmerge/ contrib/hook-scripts/ contrib/server-side/
contrib/server-side/fsfsfixer/fixer/ c...
Modified: subversion/branches/ra-git/subversion/tests/libsvn_subr/stream-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/libsvn_subr/stream-test.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/libsvn_subr/stream-test.c (original)
+++ subversion/branches/ra-git/subversion/tests/libsvn_subr/stream-test.c Tue Oct 11 09:11:50 2016
@@ -848,6 +848,158 @@ test_stream_compressed_read_full(apr_poo
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_stream_checksum(apr_pool_t *pool)
+{
+ svn_string_t *str =
+ svn_string_create("The quick brown fox jumps over the lazy dog", pool);
+ svn_checksum_t *actual;
+
+ SVN_ERR(svn_stream_contents_checksum(&actual,
+ svn_stream_from_string(str, pool),
+ svn_checksum_md5, pool, pool));
+ SVN_TEST_STRING_ASSERT("9e107d9d372bb6826bd81d3542a419d6",
+ svn_checksum_to_cstring(actual, pool));
+
+ SVN_ERR(svn_stream_contents_checksum(&actual,
+ svn_stream_from_string(str, pool),
+ svn_checksum_sha1, pool, pool));
+ SVN_TEST_STRING_ASSERT("2fd4e1c67a2d28fced849ee1bb76e7391b93eb12",
+ svn_checksum_to_cstring(actual, pool));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_stream_readline_file(const char *testname,
+ const char *eol,
+ apr_pool_t *pool)
+{
+ const char *tmp_dir;
+ const char *tmp_file;
+ svn_stream_t *stream;
+ svn_stringbuf_t *line;
+ svn_boolean_t eof;
+ static const char long_line[] =
+ "The quick brown fox jumps over the lazy dog, and "
+ "jackdaws love my big sphinx of quartz, and "
+ "pack my box with five dozen liquor jugs.";
+
+ SVN_ERR(svn_dirent_get_absolute(&tmp_dir, testname, pool));
+ SVN_ERR(svn_io_remove_dir2(tmp_dir, TRUE, NULL, NULL, pool));
+ SVN_ERR(svn_io_make_dir_recursively(tmp_dir, pool));
+ svn_test_add_dir_cleanup(tmp_dir);
+
+ /* Test 1: Read empty file. */
+ tmp_file = svn_dirent_join(tmp_dir, "empty", pool);
+ SVN_ERR(svn_io_file_create(tmp_file, "", pool));
+ SVN_ERR(svn_stream_open_readonly(&stream, tmp_file, pool, pool));
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 0);
+ SVN_TEST_STRING_ASSERT(line->data, "");
+ SVN_TEST_ASSERT(eof);
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 0);
+ SVN_TEST_STRING_ASSERT(line->data, "");
+ SVN_TEST_ASSERT(eof);
+
+ SVN_ERR(svn_stream_close(stream));
+
+ /* Test 2: Read empty line. */
+ tmp_file = svn_dirent_join(tmp_dir, "empty-line", pool);
+ SVN_ERR(svn_io_file_create(tmp_file, eol, pool));
+ SVN_ERR(svn_stream_open_readonly(&stream, tmp_file, pool, pool));
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 0);
+ SVN_TEST_STRING_ASSERT(line->data, "");
+ SVN_TEST_ASSERT(!eof);
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 0);
+ SVN_TEST_STRING_ASSERT(line->data, "");
+ SVN_TEST_ASSERT(eof);
+
+ SVN_ERR(svn_stream_close(stream));
+
+ /* Test 3: Read two lines. */
+ tmp_file = svn_dirent_join(tmp_dir, "lines", pool);
+ SVN_ERR(svn_io_file_create(tmp_file,
+ apr_pstrcat(pool,
+ "first", eol, "second", eol,
+ SVN_VA_NULL),
+ pool));
+ SVN_ERR(svn_stream_open_readonly(&stream, tmp_file, pool, pool));
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 5);
+ SVN_TEST_STRING_ASSERT(line->data, "first");
+ SVN_TEST_ASSERT(!eof);
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 6);
+ SVN_TEST_STRING_ASSERT(line->data, "second");
+ SVN_TEST_ASSERT(!eof);
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 0);
+ SVN_TEST_STRING_ASSERT(line->data, "");
+ SVN_TEST_ASSERT(eof);
+
+ SVN_ERR(svn_stream_close(stream));
+
+ /* Test 4: Content without end-of-line. */
+ tmp_file = svn_dirent_join(tmp_dir, "no-eol", pool);
+ SVN_ERR(svn_io_file_create(tmp_file, "text", pool));
+ SVN_ERR(svn_stream_open_readonly(&stream, tmp_file, pool, pool));
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 4);
+ SVN_TEST_STRING_ASSERT(line->data, "text");
+ SVN_TEST_ASSERT(eof);
+
+ SVN_ERR(svn_stream_close(stream));
+
+ /* Test 5: Read long line. */
+ tmp_file = svn_dirent_join(tmp_dir, "long-line", pool);
+ SVN_ERR(svn_io_file_create(tmp_file,
+ apr_pstrcat(pool, long_line, eol, SVN_VA_NULL),
+ pool));
+ SVN_ERR(svn_stream_open_readonly(&stream, tmp_file, pool, pool));
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == strlen(long_line));
+ SVN_TEST_STRING_ASSERT(line->data, long_line);
+ SVN_TEST_ASSERT(!eof);
+
+ SVN_ERR(svn_stream_readline(stream, &line, eol, &eof, pool));
+ SVN_TEST_ASSERT(line->len == 0);
+ SVN_TEST_STRING_ASSERT(line->data, "");
+ SVN_TEST_ASSERT(eof);
+
+ SVN_ERR(svn_stream_close(stream));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_stream_readline_file_lf(apr_pool_t *pool)
+{
+ SVN_ERR(test_stream_readline_file("test_stream_readline_file_lf",
+ "\n", pool));
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+test_stream_readline_file_crlf(apr_pool_t *pool)
+{
+ SVN_ERR(test_stream_readline_file("test_stream_readline_file_crlf",
+ "\r\n", pool));
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
static int max_threads = 1;
@@ -879,6 +1031,12 @@ static struct svn_test_descriptor_t test
"test svn_stringbuf_from_stream"),
SVN_TEST_PASS2(test_stream_compressed_read_full,
"test compression for streams without partial read"),
+ SVN_TEST_PASS2(test_stream_checksum,
+ "test svn_stream_contents_checksum()"),
+ SVN_TEST_PASS2(test_stream_readline_file_lf,
+ "test reading LF-terminated lines from file"),
+ SVN_TEST_PASS2(test_stream_readline_file_crlf,
+ "test reading CRLF-terminated lines from file"),
SVN_TEST_NULL
};
Modified: subversion/branches/ra-git/subversion/tests/libsvn_subr/string-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/libsvn_subr/string-test.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/libsvn_subr/string-test.c (original)
+++ subversion/branches/ra-git/subversion/tests/libsvn_subr/string-test.c Tue Oct 11 09:11:50 2016
@@ -873,7 +873,7 @@ test_string_matching(apr_pool_t *pool)
}
static svn_error_t *
-test_string_skip_prefix(apr_pool_t *pool)
+test_cstring_skip_prefix(apr_pool_t *pool)
{
SVN_TEST_STRING_ASSERT(svn_cstring_skip_prefix("12345", "12345"),
"");
@@ -893,6 +893,33 @@ test_string_skip_prefix(apr_pool_t *pool
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_stringbuf_set(apr_pool_t *pool)
+{
+ svn_stringbuf_t *str = svn_stringbuf_create_empty(pool);
+
+ SVN_TEST_STRING_ASSERT(str->data, "");
+ SVN_TEST_INT_ASSERT(str->len, 0);
+
+ svn_stringbuf_set(str, "0123456789");
+ SVN_TEST_STRING_ASSERT(str->data, "0123456789");
+ SVN_TEST_INT_ASSERT(str->len, 10);
+
+ svn_stringbuf_set(str, "");
+ SVN_TEST_STRING_ASSERT(str->data, "");
+ SVN_TEST_INT_ASSERT(str->len, 0);
+
+ svn_stringbuf_set(str, "0123456789abcdef");
+ SVN_TEST_STRING_ASSERT(str->data, "0123456789abcdef");
+ SVN_TEST_INT_ASSERT(str->len, 16);
+
+ svn_stringbuf_set(str, "t");
+ SVN_TEST_STRING_ASSERT(str->data, "t");
+ SVN_TEST_INT_ASSERT(str->len, 1);
+
+ return SVN_NO_ERROR;
+}
+
/*
====================================================================
If you add a new test to this file, update this array.
@@ -967,8 +994,10 @@ static struct svn_test_descriptor_t test
"test string similarity scores"),
SVN_TEST_PASS2(test_string_matching,
"test string matching"),
- SVN_TEST_PASS2(test_string_skip_prefix,
+ SVN_TEST_PASS2(test_cstring_skip_prefix,
"test svn_cstring_skip_prefix()"),
+ SVN_TEST_PASS2(test_stringbuf_set,
+ "test svn_stringbuf_set()"),
SVN_TEST_NULL
};
Modified: subversion/branches/ra-git/subversion/tests/libsvn_subr/utf-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/libsvn_subr/utf-test.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/libsvn_subr/utf-test.c (original)
+++ subversion/branches/ra-git/subversion/tests/libsvn_subr/utf-test.c Tue Oct 11 09:11:50 2016
@@ -823,6 +823,155 @@ test_utf_conversions(apr_pool_t *pool)
}
+static svn_error_t *
+test_utf_normalize(apr_pool_t *pool)
+{
+ /* Normalized: NFC */
+ static const char nfc[] =
+ "\xe1\xb9\xa8" /* S with dot above and below */
+ "\xc5\xaf" /* u with ring */
+ "\xe1\xb8\x87" /* b with macron below */
+ "\xe1\xb9\xbd" /* v with tilde */
+ "\xe1\xb8\x9d" /* e with breve and cedilla */
+ "\xc8\x91" /* r with double grave */
+ "\xc5\xa1" /* s with caron */
+ "\xe1\xb8\xaf" /* i with diaeresis and acute */
+ "\xe1\xbb\x9d" /* o with grave and hook */
+ "\xe1\xb9\x8b"; /* n with circumflex below */
+
+ /* Normalized: NFD */
+ static const char nfd[] =
+ "S\xcc\xa3\xcc\x87" /* S with dot above and below */
+ "u\xcc\x8a" /* u with ring */
+ "b\xcc\xb1" /* b with macron below */
+ "v\xcc\x83" /* v with tilde */
+ "e\xcc\xa7\xcc\x86" /* e with breve and cedilla */
+ "r\xcc\x8f" /* r with double grave */
+ "s\xcc\x8c" /* s with caron */
+ "i\xcc\x88\xcc\x81" /* i with diaeresis and acute */
+ "o\xcc\x9b\xcc\x80" /* o with grave and hook */
+ "n\xcc\xad"; /* n with circumflex below */
+
+ /* Mixed, denormalized */
+ static const char mixup[] =
+ "S\xcc\x87\xcc\xa3" /* S with dot above and below */
+ "\xc5\xaf" /* u with ring */
+ "b\xcc\xb1" /* b with macron below */
+ "\xe1\xb9\xbd" /* v with tilde */
+ "e\xcc\xa7\xcc\x86" /* e with breve and cedilla */
+ "\xc8\x91" /* r with double grave */
+ "s\xcc\x8c" /* s with caron */
+ "\xe1\xb8\xaf" /* i with diaeresis and acute */
+ "o\xcc\x80\xcc\x9b" /* o with grave and hook */
+ "\xe1\xb9\x8b"; /* n with circumflex below */
+
+ /* Invalid UTF-8 */
+ static const char invalid[] =
+ "\xe1\xb9\xa8" /* S with dot above and below */
+ "\xc5\xaf" /* u with ring */
+ "\xe1\xb8\x87" /* b with macron below */
+ "\xe1\xb9\xbd" /* v with tilde */
+ "\xe1\xb8\x9d" /* e with breve and cedilla */
+ "\xc8\x91" /* r with double grave */
+ "\xc5\xa1" /* s with caron */
+ "\xe1\xb8\xaf" /* i with diaeresis and acute */
+ "\xe6" /* Invalid byte */
+ "\xe1\xb9\x8b"; /* n with circumflex below */
+
+ const char *result;
+ svn_membuf_t buf;
+
+ svn_membuf__create(&buf, 0, pool);
+ SVN_ERR(svn_utf__normalize(&result, nfc, strlen(nfc), &buf));
+ SVN_TEST_STRING_ASSERT(result, nfc);
+ SVN_ERR(svn_utf__normalize(&result, nfd, strlen(nfd), &buf));
+ SVN_TEST_STRING_ASSERT(result, nfc);
+ SVN_ERR(svn_utf__normalize(&result, mixup, strlen(mixup), &buf));
+ SVN_TEST_STRING_ASSERT(result, nfc);
+
+ SVN_TEST_ASSERT_ERROR(svn_utf__normalize(&result, invalid, strlen(invalid),
+ &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+test_utf_xfrm(apr_pool_t *pool)
+{
+ const char *str;
+ const char *result;
+ svn_membuf_t buf;
+
+ svn_membuf__create(&buf, 0, pool);
+
+ /* ASCII string */
+ str = "Subversion";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Subversion");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "subversion");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Subversion");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "subversion");
+
+ /* M (u with diaeresis) (sharp s) en */
+ str = "M" "\xc3\xbc" "\xc3\x9f" "en";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "M" "\xc3\xbc" "\xc3\x9f" "en");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "m" "\xc3\xbc" "ssen");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Mu" "\xc3\x9f" "en");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "mussen");
+
+ /* Na (i with diaeresis) vet (e with acute), decomposed */
+ str = "Nai" "\xcc\x88" "vete" "\xcc\x81";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Na" "\xc3\xaf" "vet" "\xc3\xa9");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "na" "\xc3\xaf" "vet" "\xc3\xa9");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Naivete");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "naivete");
+
+ /* (I with dot above) stanbul */
+ str = "\xc4\xb0" "stanbul";
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "\xc4\xb0" "stanbul");
+
+ /* The Latin Capital Letter I with Dot Above (0130) should fold into
+ Latin Small Letter I (0069) with Combining Dot Above (0307) per full
+ mapping in http://www.unicode.org/Public/UNIDATA/CaseFolding.txt */
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, FALSE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "i" "\xcc\x87" "stanbul");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), FALSE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "Istanbul");
+ SVN_ERR(svn_utf__xfrm(&result, str, strlen(str), TRUE, TRUE, &buf));
+ SVN_TEST_STRING_ASSERT(result, "istanbul");
+
+ /* Invalid UTF-8 */
+ str = "a" "\xe6" "bc";
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ FALSE, FALSE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ TRUE, FALSE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ FALSE, TRUE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+ SVN_TEST_ASSERT_ERROR(svn_utf__xfrm(&result, str, strlen(str),
+ TRUE, TRUE, &buf),
+ SVN_ERR_UTF8PROC_ERROR);
+
+ return SVN_NO_ERROR;
+}
+
/* The test table. */
@@ -849,6 +998,10 @@ static struct svn_test_descriptor_t test
"test svn_utf__is_normalized"),
SVN_TEST_PASS2(test_utf_conversions,
"test svn_utf__utf{16,32}_to_utf8"),
+ SVN_TEST_PASS2(test_utf_normalize,
+ "test svn_utf__normalize"),
+ SVN_TEST_PASS2(test_utf_xfrm,
+ "test svn_utf__xfrm"),
SVN_TEST_NULL
};
Modified: subversion/branches/ra-git/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/libsvn_wc/op-depth-test.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/branches/ra-git/subversion/tests/libsvn_wc/op-depth-test.c Tue Oct 11 09:11:50 2016
@@ -12032,7 +12032,7 @@ static struct svn_test_descriptor_t test
"move depth expansion"),
SVN_TEST_OPTS_XFAIL(move_retract,
"move retract (issue 4336)"),
- SVN_TEST_OPTS_PASS(move_delete_file_externals,
+ SVN_TEST_OPTS_XFAIL(move_delete_file_externals,
"move/delete file externals (issue 4293)"),
SVN_TEST_OPTS_PASS(update_with_tree_conflict,
"update with tree conflict (issue 4347)"),
Modified: subversion/branches/ra-git/subversion/tests/libsvn_wc/utils.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/libsvn_wc/utils.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/branches/ra-git/subversion/tests/libsvn_wc/utils.c Tue Oct 11 09:11:50 2016
@@ -530,6 +530,9 @@ sbox_wc_update_depth(svn_test__sandbox_t
APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, path);
SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
+ /* Note: Tree conflict resolver tests for libsvn_client depend on this
+ * passing FALSE for adds_as_modifications so that tree conflicts are
+ * created in case of add vs add upon update. */
return svn_client_update4(&result_revs, paths, &revision, depth,
sticky, FALSE, FALSE, FALSE, FALSE,
ctx, b->pool);
Modified: subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-queries-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-queries-test.c (original)
+++ subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-queries-test.c Tue Oct 11 09:11:50 2016
@@ -101,6 +101,7 @@ static const int slow_statements[] =
STMT_SELECT_REVERT_LIST_RECURSIVE,
STMT_SELECT_DELETE_LIST,
STMT_SELECT_UPDATE_MOVE_LIST,
+ STMT_FIND_REPOS_PATH_IN_WC,
/* Designed as slow to avoid penalty on other queries */
STMT_SELECT_UNREFERENCED_PRISTINES,
Modified: subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-test.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-test.c (original)
+++ subversion/branches/ra-git/subversion/tests/libsvn_wc/wc-test.c Tue Oct 11 09:11:50 2016
@@ -434,6 +434,65 @@ test_legacy_commit2(const svn_test_opts_
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_internal_file_modified(const svn_test_opts_t *opts, apr_pool_t *pool)
+{
+ svn_test__sandbox_t b;
+ svn_boolean_t modified;
+ const char *iota_path;
+ apr_time_t time;
+
+ SVN_ERR(svn_test__sandbox_create(&b, "internal_file_modified_p",
+ opts, pool));
+ SVN_ERR(sbox_add_and_commit_greek_tree(&b));
+
+ iota_path = sbox_wc_path(&b, "iota");
+
+ /* No modification, timestamps match.*/
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, FALSE, pool));
+ SVN_TEST_ASSERT(!modified);
+
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, TRUE, pool));
+ SVN_TEST_ASSERT(!modified);
+
+ /* Change timestamp on 'iota' and check. */
+ SVN_ERR(svn_io_file_affected_time(&time, iota_path, pool));
+ SVN_ERR(svn_io_set_file_affected_time(time + apr_time_from_sec(1),
+ iota_path, pool));
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, FALSE, pool));
+ SVN_TEST_ASSERT(!modified);
+
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, TRUE, pool));
+ SVN_TEST_ASSERT(!modified);
+
+ /* Modify 'iota' to be different size. */
+ SVN_ERR(sbox_file_write(&b, iota_path, "new iota"));
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, FALSE, pool));
+ SVN_TEST_ASSERT(modified);
+
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, TRUE, pool));
+ SVN_TEST_ASSERT(modified);
+
+ /* Working copy is smart and able to detect changes in files of different
+ * size even if timestamp didn't change. */
+ SVN_ERR(svn_io_set_file_affected_time(time, iota_path, pool));
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, FALSE, pool));
+ SVN_TEST_ASSERT(modified);
+
+ SVN_ERR(svn_wc__internal_file_modified_p(&modified, b.wc_ctx->db,
+ iota_path, TRUE, pool));
+ SVN_TEST_ASSERT(modified);
+
+ return SVN_NO_ERROR;
+}
+
/* ---------------------------------------------------------------------- */
/* The list of test functions */
@@ -454,6 +513,8 @@ static struct svn_test_descriptor_t test
"test legacy commit1"),
SVN_TEST_OPTS_PASS(test_legacy_commit2,
"test legacy commit2"),
+ SVN_TEST_OPTS_PASS(test_internal_file_modified,
+ "test internal_file_modified"),
SVN_TEST_NULL
};
Modified: subversion/branches/ra-git/subversion/tests/manual/tree-conflicts-add-vs-add.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/manual/tree-conflicts-add-vs-add.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/manual/tree-conflicts-add-vs-add.py (original)
+++ subversion/branches/ra-git/subversion/tests/manual/tree-conflicts-add-vs-add.py Tue Oct 11 09:11:50 2016
@@ -39,9 +39,9 @@ from itertools import product
def run_cmd(cmd, verbose=True, shell=False):
if verbose:
if shell:
- print '\n---', cmd
+ print('\n---', cmd)
else:
- print '\n---', ' '.join(cmd)
+ print('\n---', ' '.join(cmd))
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=shell)
stdout,stderr = p.communicate()[0:2]
if verbose and stdout:
@@ -254,7 +254,7 @@ def co(name, local_action, local_kind, i
svn('up', ctx.WC)
head = ctx.head()
- print head
+ print(head)
ctx.create_wc2()
target = ctx.wc2(name)
@@ -289,7 +289,7 @@ def up(name, local_action, local_kind, i
svn('up', ctx.WC)
head = ctx.head()
- print head
+ print(head)
target = ctx.wc(name)
incoming_action(ctx, target, incoming_kind, 'incoming')
@@ -401,12 +401,12 @@ try:
if skip(row):
continue
name = nameof(row)
- print name
+ print(name)
test_func = row[0]
results.append( (name, analyze( name, test_func( name, *row[1:] ) )) )
except:
if name:
- print 'Error during', name
+ print('Error during', name)
raise
finally:
lines = []
@@ -419,5 +419,5 @@ finally:
else:
lines.append('----- ' + name + ': nothing.')
dump = '\n'.join(lines)
- print dump
+ print(dump)
rewrite_file('tree-conflicts-add-vs-add.py.results', dump)
Modified: subversion/branches/ra-git/subversion/tests/svn_test_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/svn_test_fs.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/svn_test_fs.c (original)
+++ subversion/branches/ra-git/subversion/tests/svn_test_fs.c Tue Oct 11 09:11:50 2016
@@ -646,10 +646,27 @@ svn_test__validate_changes(svn_fs_root_t
apr_hash_t *expected,
apr_pool_t *pool)
{
+ svn_fs_path_change_iterator_t *iter;
apr_hash_t *actual;
apr_hash_index_t *hi;
+ svn_fs_path_change3_t *change;
- SVN_ERR(svn_fs_paths_changed2(&actual, root, pool));
+ SVN_ERR(svn_fs_paths_changed3(&iter, root, pool, pool));
+ SVN_ERR(svn_fs_path_change_get(&change, iter));
+
+ /* We collect all changes b/c this is the easiest way to check for an
+ exact match against EXPECTED. */
+ actual = apr_hash_make(pool);
+ while (change)
+ {
+ const char *path = apr_pstrmemdup(pool, change->path.data,
+ change->path.len);
+ /* No duplicates! */
+ SVN_TEST_ASSERT(!apr_hash_get(actual, path, change->path.len));
+ apr_hash_set(actual, path, change->path.len, path);
+
+ SVN_ERR(svn_fs_path_change_get(&change, iter));
+ }
#if 0
/* Print ACTUAL and EXPECTED. */
Modified: subversion/branches/ra-git/subversion/tests/svn_test_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/svn_test_fs.h?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/svn_test_fs.h (original)
+++ subversion/branches/ra-git/subversion/tests/svn_test_fs.h Tue Oct 11 09:11:50 2016
@@ -134,7 +134,7 @@ svn_test__validate_tree(svn_fs_root_t *r
int num_entries,
apr_pool_t *pool);
-/* Verify that svn_fs_paths_changed2(ROOT) returns a hash with exactly
+/* Verify that svn_fs_paths_changed3(ROOT) returns a hash with exactly
the same keys as EXPECTED_KEYS. Values are not currently verified.
*/
svn_error_t *
Modified: subversion/branches/ra-git/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/tests/svn_test_main.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/tests/svn_test_main.c (original)
+++ subversion/branches/ra-git/subversion/tests/svn_test_main.c Tue Oct 11 09:11:50 2016
@@ -407,26 +407,29 @@ do_test_num(const char *progname,
apr_pool_t *pool)
{
svn_boolean_t skip, xfail, wimp;
- svn_error_t *err = NULL;
+ svn_error_t *err;
const char *msg = NULL; /* the message this individual test prints out */
const struct svn_test_descriptor_t *desc;
const int array_size = get_array_size(test_funcs);
svn_boolean_t run_this_test; /* This test's mode matches DESC->MODE. */
enum svn_test_mode_t test_mode;
+ volatile int adjusted_num = test_num; /* volatile for setjmp */
+
+ /* This allows './some-test -- -1' to run the last test. */
+ if (adjusted_num < 0)
+ adjusted_num += array_size + 1;
/* Check our array bounds! */
- if (test_num < 0)
- test_num += array_size + 1;
- if ((test_num > array_size) || (test_num <= 0))
+ if ((adjusted_num > array_size) || (adjusted_num <= 0))
{
if (header_msg && *header_msg)
printf("%s", *header_msg);
- printf("FAIL: %s: THERE IS NO TEST NUMBER %2d\n", progname, test_num);
+ printf("FAIL: %s: THERE IS NO TEST NUMBER %2d\n", progname, adjusted_num);
skip_cleanup = TRUE;
return TRUE; /* BAIL, this test number doesn't exist. */
}
- desc = &test_funcs[test_num];
+ desc = &test_funcs[adjusted_num];
/* Check the test predicate. */
if (desc->predicate.func
&& desc->predicate.func(opts, desc->predicate.value, pool))
@@ -462,7 +465,7 @@ do_test_num(const char *progname,
{
/* Do test */
if (msg_only || skip || !run_this_test)
- ; /* pass */
+ err = NULL; /* pass */
else if (desc->func2)
err = (*desc->func2)(pool);
else
@@ -480,7 +483,7 @@ do_test_num(const char *progname,
}
/* Failure means unexpected results -- FAIL or XPASS. */
- skip_cleanup = log_results(progname, test_num, msg_only, run_this_test,
+ skip_cleanup = log_results(progname, adjusted_num, msg_only, run_this_test,
skip, xfail, wimp, err, msg, desc);
return skip_cleanup;
Modified: subversion/branches/ra-git/tools/backup/hot-backup.py.in
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/backup/hot-backup.py.in?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/backup/hot-backup.py.in (original)
+++ subversion/branches/ra-git/tools/backup/hot-backup.py.in Tue Oct 11 09:11:50 2016
@@ -70,7 +70,7 @@ def chmod_tree(path, mode, mask):
def safe_rmtree(dirname, retry=0):
"Remove the tree at DIRNAME, making it writable first"
def rmtree(dirname):
- chmod_tree(dirname, 0666, 0666)
+ chmod_tree(dirname, 0o666, 0o666)
shutil.rmtree(dirname)
if not os.path.exists(dirname):
@@ -117,7 +117,7 @@ try:
"num-backups=",
"verify",
"help"])
-except getopt.GetoptError, e:
+except getopt.GetoptError as e:
sys.stderr.write("ERROR: %s\n\n" % e)
sys.stderr.flush()
usage(sys.stderr)
@@ -137,6 +137,11 @@ for o, a in opts:
usage()
sys.exit()
+if archive_type not in (None, 'bz2', 'gz', 'zip', 'zip64'):
+ sys.stderr.write("ERROR: Bad --archive-type\n")
+ usage(sys.stderr)
+ sys.exit(2)
+
if len(args) != 2:
sys.stderr.write("ERROR: only two arguments allowed.\n\n")
sys.stderr.flush()
@@ -198,7 +203,7 @@ def get_youngest_revision():
"""Examine the repository REPO_DIR using the svnlook binary
specified by SVNLOOK, and return the youngest revision."""
- p = subprocess.Popen([svnlook, 'youngest', repo_dir],
+ p = subprocess.Popen([svnlook, 'youngest', '--', repo_dir],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
@@ -226,7 +231,7 @@ print("Beginning hot backup of '"+ repo_
try:
youngest = get_youngest_revision()
-except Exception, e:
+except Exception as e:
sys.stderr.write("%s\n" % e)
sys.stderr.flush()
sys.exit(1)
@@ -245,7 +250,7 @@ backup_subdir = os.path.join(backup_dir,
# rather than start from 1 and increment because the starting
# increments may have already been removed due to num_backups.
-regexp = re.compile("^" + repo + "-" + youngest +
+regexp = re.compile("^" + re.escape(repo) + "-" + re.escape(youngest) +
"(-(?P<increment>[0-9]+))?" + ext_re + "$")
directory_list = os.listdir(backup_dir)
young_list = [x for x in directory_list if regexp.search(x)]
@@ -262,8 +267,8 @@ if young_list:
### copied last.
print("Backing up repository to '" + backup_subdir + "'...")
-err_code = subprocess.call([svnadmin, "hotcopy", repo_dir,
- backup_subdir, "--clean-logs"])
+err_code = subprocess.call([svnadmin, "hotcopy", "--clean-logs",
+ '--', repo_dir, backup_subdir])
if err_code != 0:
sys.stderr.write("Unable to backup the repository.\n")
sys.stderr.flush()
@@ -274,7 +279,7 @@ else:
### Step 4: Verify the hotcopy
if verify_copy:
print("Verifying backup...")
- err_code = subprocess.call([svnadmin, "verify", "--quiet", backup_subdir])
+ err_code = subprocess.call([svnadmin, "verify", "--quiet", '--', backup_subdir])
if err_code != 0:
sys.stderr.write("Backup verification failed.\n")
sys.stderr.flush()
@@ -294,10 +299,10 @@ if archive_type:
tar = tarfile.open(archive_path, 'w:' + archive_type)
tar.add(backup_subdir, os.path.basename(backup_subdir))
tar.close()
- except ImportError, e:
+ except ImportError as e:
err_msg = "Import failed: " + str(e)
err_code = -2
- except tarfile.TarError, e:
+ except tarfile.TarError as e:
err_msg = "Tar failed: " + str(e)
err_code = -3
@@ -320,10 +325,10 @@ if archive_type:
for dirpath, dirs, files in os.walk(backup_subdir):
add_to_zip(zp, backup_dir, dirpath, dirs + files)
zp.close()
- except ImportError, e:
+ except ImportError as e:
err_msg = "Import failed: " + str(e)
err_code = -4
- except zipfile.error, e:
+ except zipfile.error as e:
err_msg = "Zip failed: " + str(e)
err_code = -5
@@ -340,7 +345,7 @@ if archive_type:
### NUM_BACKUPS.
if num_backups > 0:
- regexp = re.compile("^" + repo + "-[0-9]+(-[0-9]+)?" + ext_re + "$")
+ regexp = re.compile("^" + re.escape(repo) + "-[0-9]+(-[0-9]+)?" + ext_re + "$")
directory_list = os.listdir(backup_dir)
old_list = [x for x in directory_list if regexp.search(x)]
old_list.sort(comparator)
Modified: subversion/branches/ra-git/tools/client-side/bash_completion
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/client-side/bash_completion?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/client-side/bash_completion (original)
+++ subversion/branches/ra-git/tools/client-side/bash_completion Tue Oct 11 09:11:50 2016
@@ -1136,7 +1136,7 @@ _svnadmin ()
;;
dump)
cmdOpts="-r --revision --incremental -q --quiet --deltas \
- -M --memory-cache-size"
+ -M --memory-cache-size -F --file"
;;
freeze)
cmdOpts="-F --file"
@@ -1150,7 +1150,8 @@ _svnadmin ()
load)
cmdOpts="--ignore-uuid --force-uuid --parent-dir -q --quiet \
--use-pre-commit-hook --use-post-commit-hook \
- --bypass-prop-validation -M --memory-cache-size"
+ --bypass-prop-validation -M --memory-cache-size \
+ --no-flush-to-disk -F --file"
;;
lstxns)
cmdOpts="-r --revision"
Modified: subversion/branches/ra-git/tools/client-side/change-svn-wc-format.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/client-side/change-svn-wc-format.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/client-side/change-svn-wc-format.py (original)
+++ subversion/branches/ra-git/tools/client-side/change-svn-wc-format.py Tue Oct 11 09:11:50 2016
@@ -24,6 +24,7 @@
import sys
import os
import getopt
+import stat
try:
my_getopt = getopt.gnu_getopt
except AttributeError:
@@ -96,7 +97,7 @@ class WCFormatConverter:
print("Parsing file '%s'" % entries.path)
try:
entries.parse(self.verbosity)
- except UnrecognizedWCFormatException, e:
+ except UnrecognizedWCFormatException as e:
if self.error_on_unrecognized:
raise
sys.stderr.write("%s, skipping\n" % e)
@@ -116,7 +117,7 @@ class WCFormatConverter:
print("Checking whether WC format can be converted")
try:
entries.assert_valid_format(format_nbr, self.verbosity)
- except LossyConversionException, e:
+ except LossyConversionException as e:
# In --force mode, ignore complaints about lossy conversion.
if self.force:
print("WARNING: WC format conversion will be lossy. Dropping "\
@@ -265,11 +266,11 @@ class Entries:
assert len(str(format_nbr)) <= self.format_nbr_bytes
format_string = '%0' + str(self.format_nbr_bytes) + 'd'
- os.chmod(self.path, 0600)
+ os.chmod(self.path, stat.S_IRUSR | stat.S_IWUSR)
output = open(self.path, "r+", 0)
output.write(format_string % format_nbr)
output.close()
- os.chmod(self.path, 0400)
+ os.chmod(self.path, stat.S_IRUSR)
class Entry:
"Describes an entry in a WC."
@@ -334,14 +335,14 @@ class Format:
if os.path.exists(self.path):
if verbosity >= 1:
print("%s will be updated." % self.path)
- os.chmod(self.path,0600)
+ os.chmod(self.path, stat.S_IRUSR | stat.S_IWUSR)
else:
if verbosity >= 1:
print("%s does not exist, creating it." % self.path)
format = open(self.path, "w")
format.write(format_string % format_nbr)
format.close()
- os.chmod(self.path, 0400)
+ os.chmod(self.path, stat.S_IRUSR)
class LocalException(Exception):
"""Root of local exception class hierarchy."""
@@ -405,7 +406,7 @@ def main():
try:
converter.change_wc_format(new_format_nbr)
- except LocalException, e:
+ except LocalException as e:
if debug:
raise
sys.stderr.write("%s\n" % e)
Modified: subversion/branches/ra-git/tools/client-side/mergeinfo-sanitizer.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/client-side/mergeinfo-sanitizer.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/client-side/mergeinfo-sanitizer.py (original)
+++ subversion/branches/ra-git/tools/client-side/mergeinfo-sanitizer.py Tue Oct 11 09:11:50 2016
@@ -106,14 +106,14 @@ def location_segment_callback(segment, p
# This function does the authentication in an interactive way
##
def prompt_func_ssl_unknown_cert(realm, failures, cert_info, may_save, pool):
- print "The certificate details are as follows:"
- print "--------------------------------------"
- print "Issuer : " + str(cert_info.issuer_dname)
- print "Hostname : " + str(cert_info.hostname)
- print "ValidFrom : " + str(cert_info.valid_from)
- print "ValidUpto : " + str(cert_info.valid_until)
- print "Fingerprint: " + str(cert_info.fingerprint)
- print ""
+ print("The certificate details are as follows:")
+ print("--------------------------------------")
+ print("Issuer : " + str(cert_info.issuer_dname))
+ print("Hostname : " + str(cert_info.hostname))
+ print("ValidFrom : " + str(cert_info.valid_from))
+ print("ValidUpto : " + str(cert_info.valid_until))
+ print("Fingerprint: " + str(cert_info.fingerprint))
+ print("")
ssl_trust = core.svn_auth_cred_ssl_server_trust_t()
if may_save:
choice = raw_input( "accept (t)temporarily (p)permanently: ")
@@ -166,7 +166,7 @@ def get_new_location_segments(parsed_ori
revision_range.end, revision_range.start + 1, location_segment_callback)
except svn.core.SubversionException:
sys.stderr.write(" Could not find location segments for %s \n" % path)
- except Exception, e:
+ except Exception as e:
sys.stderr.write("")
@@ -182,13 +182,13 @@ def sanitize_mergeinfo(parsed_original_m
mergeinfo, 1, temp_pool)
#There should be no mergeinfo added by our population. There should only
#be deletion of mergeinfo. so take it from diff_mergeinfo[0]
- print "The bogus mergeinfo summary:"
+ print("The bogus mergeinfo summary:")
bogus_mergeinfo_deleted = diff_mergeinfo[0]
for bogus_mergeinfo_path in bogus_mergeinfo_deleted:
sys.stdout.write(bogus_mergeinfo_path + ": ")
for revision_range in bogus_mergeinfo_deleted[bogus_mergeinfo_path]:
sys.stdout.write(str(revision_range.start + 1) + "-" + str(revision_range.end) + ",")
- print ""
+ print("")
##
# This function tries to 'propset the new mergeinfo into the working copy.
@@ -204,7 +204,7 @@ def fix_sanitized_mergeinfo(parsed_origi
with open(hash_file, "r") as f:
old_hash = pickle.load(f)
f.close
- except IOError, e:
+ except IOError as e:
get_new_location_segments(parsed_original_mergeinfo, repo_root, wcpath, ctx)
hasher(hash_file, newmergeinfo_file)
try:
@@ -217,7 +217,7 @@ def fix_sanitized_mergeinfo(parsed_origi
with open(newmergeinfo_file, "r") as f:
new_hash = md5_of_file(f)
f.close
- except IOError, e:
+ except IOError as e:
if not mergeinfo:
get_new_location_segments(parsed_original_mergeinfo, repo_root, wcpath, ctx)
hasher(hash_file, newmergeinfo_file)
@@ -233,7 +233,7 @@ def fix_sanitized_mergeinfo(parsed_origi
os.remove(newmergeinfo_file)
os.remove(hash_file)
else:
- print "The hashes are not matching. Probable chance of unwanted tweaking in the mergeinfo"
+ print("The hashes are not matching. Probable chance of unwanted tweaking in the mergeinfo")
##
@@ -242,8 +242,8 @@ def fix_sanitized_mergeinfo(parsed_origi
def check_local_modifications(wcpath, temp_pool):
has_local_mod = wc.svn_wc_revision_status(wcpath, None, 0, None, temp_pool)
if has_local_mod.modified:
- print """The working copy has local modifications. Please revert them or clean
-the working copy before running the script."""
+ print("""The working copy has local modifications. Please revert them or clean
+the working copy before running the script.""")
sys.exit(1)
def get_original_mergeinfo(wcpath, revision, depth, ctx, temp_pool):
@@ -263,7 +263,7 @@ def get_original_mergeinfo(wcpath, revis
def main():
try:
opts, args = my_getopt(sys.argv[1:], "h?f", ["help", "fix"])
- except Exception, e:
+ except Exception as e:
sys.stderr.write(""" Improperly used """)
sys.exit(1)
@@ -313,7 +313,7 @@ if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
- print ""
+ print("")
sys.stderr.write("The script is interrupted and stopped manually.")
- print ""
+ print("")
Modified: subversion/branches/ra-git/tools/client-side/svn-graph.pl
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/client-side/svn-graph.pl?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/client-side/svn-graph.pl (original)
+++ subversion/branches/ra-git/tools/client-side/svn-graph.pl Tue Oct 11 09:11:50 2016
@@ -43,7 +43,6 @@ use Getopt::Std;
$|=1;
require SVN::Core;
-require SVN::Ra;
require SVN::Client;
# The URL of the Subversion repository we wish to graph
@@ -60,17 +59,6 @@ my $startpath;
# Set the variables declared above.
parse_commandline();
-# Point at the root of a repository so we get can look at
-# every revision.
-my $auth = (new SVN::Client())->auth;
-my $ra = SVN::Ra->new(url => $repos_url, auth => $auth);
-
-# Handle identifier for the aboslutely youngest revision.
-if ($youngest eq 'HEAD')
-{
- $youngest = $ra->get_latest_revnum();
-}
-
# The "interesting" nodes are potential sources for copies. This list
# grows as we move through time.
# The "tracking" nodes are the most recent revisions of paths we're
@@ -110,7 +98,7 @@ usage: svn-graph.pl [-r START_REV:END_RE
getopts('r:p:h', \%cmd_opts) or die $usage;
die $usage if scalar(@ARGV) < 1;
- $repos_url = $ARGV[0];
+ $repos_url = SVN::Core::uri_canonicalize($ARGV[0]);
$cmd_opts{'r'} =~ m/(\d+)(:(.+))?/;
if ($3)
@@ -207,6 +195,7 @@ sub process_revision
# Write a descriptor for the graph in GraphViz .dot format to stdout.
sub write_graph_descriptor
{
+ my $client = SVN::Client->new;
# Begin writing the graph descriptor.
print "digraph tree {\n";
print "\tgraph [bgcolor=white];\n";
@@ -215,7 +204,7 @@ sub write_graph_descriptor
print "\n";
# Retrieve the requested history.
- $ra->get_log(['/'], $startrev, $youngest, 0, 1, 0, \&process_revision);
+ $client->log($repos_url, $startrev, $youngest, 1, 0, \&process_revision);
# Now ensure that everything is linked.
foreach my $codeline_change (keys %codeline_changes_forward)
Modified: subversion/branches/ra-git/tools/client-side/svn-mergeinfo-normalizer/logic.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/client-side/svn-mergeinfo-normalizer/logic.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/client-side/svn-mergeinfo-normalizer/logic.c (original)
+++ subversion/branches/ra-git/tools/client-side/svn-mergeinfo-normalizer/logic.c Tue Oct 11 09:11:50 2016
@@ -305,7 +305,7 @@ show_removing_obsoletes(svn_min__opt_sta
&& progress->needs_header)
{
SVN_ERR(svn_cmdline_printf(scratch_pool,
- _("\n Removing obsolete entries ...\n")));
+ _("\n Trying to remove obsolete entries ...\n")));
progress->needs_header = FALSE;
}
@@ -498,9 +498,11 @@ find_surviving_copies(apr_array_header_t
* enabled in it.
*
* If LOCAL_ONLY is set, only remove branches that are known to have been
- * deleted as per LOOKUP - this is for quick checks. Track progress in
- * PROGRESS and update MERGEINFO is we can remove the info for branch PATH
- * from it.
+ * deleted (as per LOOKUP) with no surviving copies etc. This is for quick
+ * checks.
+ *
+ * Track progress in PROGRESS and update MERGEINFO if we can remove the
+ * info for branch PATH from it.
*
* Use SCRATCH_POOL for temporaries.
*/
@@ -1339,10 +1341,10 @@ show_elision_result(svn_mergeinfo_t pare
if (parent_mergeinfo)
SVN_ERR(svn_cmdline_printf(scratch_pool,
_("\n Sub-tree merge info cannot be elided due to "
- "the following branches:\n")));
+ "the following branch(es):\n")));
else
SVN_ERR(svn_cmdline_printf(scratch_pool,
- _("\n Merge info kept for the following branches:\n")));
+ _("\n Merge info kept for the following branch(es):\n")));
sorted_mi = svn_sort__hash(subtree_mergeinfo,
svn_sort_compare_items_lexically,
@@ -1606,7 +1608,7 @@ show_obsoletes_summary(svn_min__branch_l
iterpool = svn_pool_create(scratch_pool);
SVN_ERR(svn_cmdline_printf(iterpool,
- _("\nEncountered %d missing branches:\n"),
+ _("\nEncountered %d missing branch(es):\n"),
paths->nelts));
for (i = 0; i < paths->nelts; ++i)
{
Modified: subversion/branches/ra-git/tools/client-side/svn-vendor.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/client-side/svn-vendor.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/client-side/svn-vendor.py (original)
+++ subversion/branches/ra-git/tools/client-side/svn-vendor.py Tue Oct 11 09:11:50 2016
@@ -200,7 +200,7 @@ class FSO(object):
'''
def __init__(self):
self.wc_path = None
- self.state = [ "-", "-" ] # '-': absent, 'F': file, 'D': dir
+ self.state = [ "-", "-" ] # '-': absent, 'F': file, 'D': dir, 'L': symlink
def status(self):
return "[%s%s]" % (self.state[S_WC], self.state[S_IM])
@@ -216,8 +216,8 @@ class FSOCollection(dict):
Collection of FSOs
'''
def print(self):
- print(" / Status in working copy (-:absent, F:file, D:dir)")
- print(" |/ Status in imported sources (-:absent, F:file, D:dir)")
+ print(" / Status in working copy (-:absent, F:file, D:dir, L:link)")
+ print(" |/ Status in imported sources (-:absent, F:file, D:dir, L:link)")
for k in sorted(self.keys(), key=filename_sort_key):
e = self[k]
print("%s %s%s" % (e.status(), shlex.quote(k),
@@ -310,9 +310,10 @@ class Config(dict):
def print(self):
for k in sorted(self):
o = self[k]
- print("# %s" % o.helpmsg)
+ for s in o.helpmsg.split('\n'):
+ print("# %s" % s)
print("%-20s: %s" % (k, str(o)))
- print()
+ print("")
class SvnVndImport(cmd.Cmd):
@@ -330,6 +331,18 @@ class SvnVndImport(cmd.Cmd):
self.importdir = importdir
self.svninfo = svninfo
self.config = Config()
+ self.config.add_option('symlink-handling',
+ ConfigOpt("as-is", "How symbolic links are handled;\n" +
+ " 'dereference' treats as normal files/dirs (and " +
+ "ignores dangling links);\n" +
+ " 'as-is' imports as symlinks"))
+ self.config.add_option('exec-permission',
+ ConfigOpt("preserve", "How 'executable' permission bits " +
+ "are handled;\n" +
+ " 'preserve' sets svn:executable property as in " +
+ "imported sources;\n" +
+ " 'clear' removes svn:executable on all new files " +
+ "(but keeps it intact on existing files)."))
self.config.add_option('save-diff-copied',
ConfigOpt(None, "Save 'svn diff' output on the " +
"moved/copied files and directories to this " +
@@ -359,12 +372,13 @@ class SvnVndImport(cmd.Cmd):
def scan(self):
self.items = FSOCollection()
self.info(1, "Scanning working copy directory...")
- self.get_lists(self.wcdir, S_WC)
+ self.get_lists(self.wcdir, S_WC, False)
self.info(1, "Scanning imported directory...")
- self.get_lists(self.importdir, S_IM)
+ self.get_lists(self.importdir, S_IM,
+ self.config.get('symlink-handling') == "dereference")
- def get_lists(self, top, where):
- for d, dn, fn in os.walk(top, followlinks=True):
+ def get_lists(self, top, where, deref):
+ for d, dn, fn in os.walk(top, followlinks=deref):
dr = os.path.relpath(d, top)
# If under .svn directory at the top (SVN 1.7+) or has .svn
# in the path (older SVN), ignore
@@ -374,9 +388,36 @@ class SvnVndImport(cmd.Cmd):
continue
if dr != '.':
self.items.add(dr, where, "D")
- for f in fn:
+ dnn = [] # List where we'll descend
+ for f in fn + dn:
fr = os.path.normpath(os.path.join(dr, f))
- self.items.add(fr, where, "F")
+ frp = os.path.join(d, f)
+ if os.path.islink(frp):
+ if deref:
+ # Dereferencing:
+ # - check for dangling/absolute/out-of-tree symlinks and abort
+ rl = os.readlink(frp)
+ if not os.path.exists(frp):
+ self.info(1, "WARN: Ignoring dangling symlink %s -> %s" % (fr, rl))
+ continue
+ if os.path.isabs(rl):
+ self.info(1, "WARN: Ignoring absolute symlink %s -> %s" % (fr, rl))
+ continue
+ tgt = os.path.normpath(os.path.join(dr, rl))
+ if tgt == ".." or tgt.startswith(".." + os.sep):
+ self.info(1, "WARN: Ignoring out-of-wc symlink %s -> %s" % (fr, rl))
+ continue
+ else:
+ # Importing symlinks as-is, no need to check.
+ self.items.add(fr, where, "L")
+ continue
+ # If we get here, treat symlinks to files as regular files, and add directories
+ # to the list of traversed subdirs
+ if os.path.isfile(frp):
+ self.items.add(fr, where, "F")
+ if os.path.isdir(frp):
+ dnn.append(f)
+ dn[:] = dnn
def onecmd(self, str):
'Override for checking number of arguments'
@@ -385,7 +426,7 @@ class SvnVndImport(cmd.Cmd):
except InvalidUsageException as e:
if e.cmd is not None:
print("!!! Invalid usage of `%s' command: %s" % (e.cmd, e))
- print()
+ print("")
self.onecmd("help " + e.cmd)
else:
print("!!! %s" % e)
@@ -403,6 +444,10 @@ class SvnVndImport(cmd.Cmd):
pos = 0
atatime = 100
output = ""
+ # svn treats '@' specially (peg revision); if there's such character in a
+ # file name - append an empty peg revision
+ args_fixed = list(map(lambda x: x + "@" if x.find("@") != -1 else x, args_fixed))
+ args_split = list(map(lambda x: x + "@" if x.find("@") != -1 else x, args_split))
while pos < len(args_split) or (pos == 0 and len(args_split) == 0):
svnargs = ['svn'] + args_fixed + args_split[pos : pos + atatime]
pos += atatime
@@ -558,6 +603,10 @@ class SvnVndImport(cmd.Cmd):
if xsrc.state[S_WC] != xdst.state[S_IM]:
# Different kinds - definitely not the same object
return 0
+ if xsrc.state[S_WC] == "L" or xdst.state[S_IM] == "L":
+ # Symlinks are not considered the same object (same target in
+ # different dirs refers to different objects).
+ return 0
if xsrc.state[S_WC] == "D":
return self.similarity_dir(src, dst, threshold, lst_removal)
else:
@@ -734,8 +783,10 @@ class SvnVndImport(cmd.Cmd):
edit and load.
'''
self.parse_args(arg, 0, "detect")
+ # Configurable for file/dirs; symlinks are never similar.
self.detect({ "D": self.config.get('dir-similarity'),
- "F": self.config.get('file-similarity')})
+ "F": self.config.get('file-similarity'),
+ "L": 1001 })
def do_apply(self, arg):
'''
@@ -763,7 +814,28 @@ class SvnVndImport(cmd.Cmd):
dirs_removed = []
files_added = []
files_removed = []
+ files_set_exec = []
+ files_clear_exec = []
+
self.info(2, " Creating dirs and copying files...")
+ def copyfile_helper(i, nk_wc):
+ '''Helper: copy a file and optionally, transfer permissions.'''
+ f = os.path.join(self.importdir, i)
+ t = os.path.join(self.wcdir, i)
+ shutil.copyfile(f, t)
+ # If exec-permission is 'clear', we don't need to do anything:
+ # shutil.copyfile will create the file as non-executable.
+ if self.config.get('exec-permission') == 'preserve':
+ # If the file is new, just copying the mode is enough:
+ # svn will set the svn:executable upon adding it.
+ if nk_wc == "F":
+ # Existing file, check what the setting shall be
+ if os.access(f, os.X_OK) and not os.access(t, os.X_OK):
+ files_set_exec.append(i)
+ elif not os.access(f, os.X_OK) and os.access(t, os.X_OK):
+ files_clear_exec.append(i)
+ shutil.copymode(f, t)
+
for i in sorted(self.items.keys()):
e = self.items[i]
nk_wc = e.state[S_WC]
@@ -778,14 +850,46 @@ class SvnVndImport(cmd.Cmd):
flg = "(added dir)"
elif nk_im == "F":
# New file added
- shutil.copyfile(os.path.join(self.importdir, i),
- os.path.join(self.wcdir, i))
+ copyfile_helper(i, nk_wc);
files_added.append(i)
flg = "(added file)"
+ elif nk_im == "L":
+ tim = os.readlink(os.path.join(self.importdir, i))
+ os.symlink(tim, os.path.join(self.wcdir, i))
+ files_added.append(i)
+ flg = "(added symlink)"
else:
# Not in imported sources, not in WC (moved
# away/removed) - nothing to do
pass
+ elif nk_wc == "L":
+ # Symbolic link in a working copy
+ if nk_im == "L":
+ # Symbolic link in both. If the same target, do nothing. Otherwise,
+ # replace.
+ twc = os.readlink(os.path.join(self.wcdir, i))
+ tim = os.readlink(os.path.join(self.importdir, i))
+ if tim != twc:
+ self.run_svn(["rm", "--force", i])
+ os.symlink(tim, os.path.join(self.wcdir, i))
+ files_added.append(i)
+ flg = "(replaced symlink)"
+ elif nk_im == "D":
+ # Was a symlink, now a directory. Replace.
+ self.run_svn(["rm", "--force", i])
+ os.mkdir(os.path.join(self.wcdir, i))
+ dirs_added.append(i)
+ flg = "(replaced symlink with dir)"
+ elif nk_im == "F":
+ # Symlink replaced with file.
+ self.run_svn(["rm", "--force", i])
+ copyfile_helper(i, nk_wc);
+ files_added.append(i)
+ flg = "(replaced symlink with file)"
+ else:
+ # Was a symlink, removed
+ files_removed.append(i)
+ flg = "(removed symlink)"
elif nk_wc == "F":
# File in a working copy
if nk_im == "D":
@@ -796,9 +900,15 @@ class SvnVndImport(cmd.Cmd):
flg = "(replaced file with dir)"
elif nk_im == "F":
# Was a file, is a file - just copy contents
- shutil.copyfile(os.path.join(self.importdir, i),
- os.path.join(self.wcdir, i))
+ copyfile_helper(i, nk_wc);
flg = "(copied)"
+ elif nk_im == "L":
+ # Was a file, now a symlink. Replace.
+ self.run_svn(["rm", "--force", i])
+ tim = os.readlink(os.path.join(self.importdir, i))
+ os.symlink(tim, os.path.join(self.wcdir, i))
+ files_added.append(i)
+ flg = "(replaced file with symlink)"
else:
# Was a file, removed
files_removed.append(i)
@@ -811,12 +921,21 @@ class SvnVndImport(cmd.Cmd):
elif nk_im == "F":
# Directory replaced with file. Need to remove dir
# immediately, as bulk removals/additions assume new files
- # and dirs already in place.
+ # and dirs already in place. Also, removing a directory
+ # removes all its descendants - mark them as removed.
self.run_svn(["rm", "--force", i])
- shutil.copyfile(os.path.join(self.importdir, i),
- os.path.join(self.wcdir, i))
+ self.items.wc_remove(i)
+ copyfile_helper(i, nk_wc);
files_added.append(i)
flg = "(replaced dir with file)"
+ elif nk_im == "L":
+ # Was a directory, now a symlink. Replace.
+ self.run_svn(["rm", "--force", i])
+ self.items.wc_remove(i)
+ tim = os.readlink(os.path.join(self.importdir, i))
+ os.symlink(tim, os.path.join(self.wcdir, i))
+ files_added.append(i)
+ flg = "(replaced dir with symlink)"
else:
# Directory removed
dirs_removed.append(i)
@@ -832,7 +951,7 @@ class SvnVndImport(cmd.Cmd):
dirs_added, files_added))
dirs_added = list(filter(lambda x: os.path.dirname(x) not in
dirs_added, dirs_added))
- self.info(2, " Running SVN add/rm commands");
+ self.info(2, " Running SVN add/rm/propset/propdel commands");
if len(dirs_added):
self.run_svn(["add"], dirs_added)
if len(files_added):
@@ -841,6 +960,10 @@ class SvnVndImport(cmd.Cmd):
self.run_svn(["rm"], dirs_removed)
if len(files_removed):
self.run_svn(["rm"], files_removed)
+ if len(files_set_exec):
+ self.run_svn(["propset", "svn:executable", "*"], files_set_exec)
+ if len(files_clear_exec):
+ self.run_svn(["propdel", "svn:executable"], files_clear_exec)
# Save the diff for the copied/moved items
diff_save = self.config.get('save-diff-copied')
if diff_save is not None:
@@ -918,7 +1041,7 @@ class SvnVndImport(cmd.Cmd):
colsz = int((self.termwidth - 14) / 2)
if len(self.prepare_ops):
print("Currently recorded preparatory operations:")
- print()
+ print("")
print("%5s %s %-*s %-*s" %
("#", "Op", colsz, "Source", colsz, "Destination"))
for id, o in enumerate(self.prepare_ops):
@@ -930,10 +1053,10 @@ class SvnVndImport(cmd.Cmd):
(id, o[0], colsz, o[1], colsz, o[2]))
else:
print("%5d %s %-*s" % (id, o[0], colsz, o[1]))
- print()
+ print("")
else:
print("No copies/moves/removals recorded")
- print()
+ print("")
def do_save(self, arg):
'''
@@ -1039,7 +1162,7 @@ if __name__ == '__main__':
if p.returncode != 0:
print("%s: does not appear to be SVN working copy." % args.wcdir)
print("`svn info' exited with status %d and returned:" % p.returncode)
- print()
+ print("")
print(se.decode())
sys.exit(1)
imp = SvnVndImport(args.wcdir, args.importdir, so.decode())
Modified: subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/copy_repo.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/copy_repo.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/copy_repo.py (original)
+++ subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/copy_repo.py Tue Oct 11 09:11:50 2016
@@ -296,15 +296,15 @@ def copy_repos(src, dst, count, separato
def show_usage():
""" Write a simple CL docstring """
- print "Copies and duplicates repositories in a way that mimics larger deployments."
- print
- print "Usage:"
- print "copy_repo.py SRC DST COUNT SEPARATOR_SIZE"
- print
- print "SRC Immediate parent folder of all the repositories to copy."
- print "DST Folder to copy into; current contents will be lost."
- print "COUNT Number of copies to create of each source repository."
- print "SEPARATOR_SIZE Additional spacing, in kBytes, between revisions."
+ print("Copies and duplicates repositories in a way that mimics larger deployments.")
+ print("")
+ print("Usage:")
+ print("copy_repo.py SRC DST COUNT SEPARATOR_SIZE")
+ print("")
+ print("SRC Immediate parent folder of all the repositories to copy.")
+ print("DST Folder to copy into; current contents will be lost.")
+ print("COUNT Number of copies to create of each source repository.")
+ print("SEPARATOR_SIZE Additional spacing, in kBytes, between revisions.")
#main function
if len(argv) == 5:
Modified: subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/win_repo_bench.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/win_repo_bench.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/win_repo_bench.py (original)
+++ subversion/branches/ra-git/tools/dev/benchmarks/RepoPerf/win_repo_bench.py Tue Oct 11 09:11:50 2016
@@ -115,7 +115,7 @@ def run_cs_command(state, config, reposi
# Display the operation
repo_title = repository.replace('nonpacked', 'nopack')
- print state, "\t", repo_title, "\t", prefix, "\t", config, "\t",
+ sys.stdout.write(state, "\t", repo_title, "\t", prefix, "\t", config, "\t ")
sys.stdout.flush()
# Execute the command and show the execution times
@@ -189,8 +189,8 @@ def run_test_cs_configurations(command,
repeatedly with all servers on all repositories. """
print
- print command
- print
+ print(command)
+ print("")
for config in configurations:
set_config(config)
@@ -215,7 +215,7 @@ def run_admin_command(state, config, rep
else:
extra = []
- print state, "\t", repository, "\t", config, "\t",
+ sys.stdout.write(state, "\t", repository, "\t", config, "\t ")
sys.stdout.flush()
subprocess.call(["TimeWin.exe", exe] + args + extra)
@@ -241,9 +241,9 @@ def run_test_admin_configurations(comman
""" Run svnadmin COMMAND with basic arguments ARGS in all configurations
repeatedly on all repositories. """
- print
- print command
- print
+ print("")
+ print(command)
+ print("")
for config in configurations:
# These two must be the innermost loops and must be in that order.
Modified: subversion/branches/ra-git/tools/dev/benchmarks/suite1/benchmark.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/benchmarks/suite1/benchmark.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/benchmarks/suite1/benchmark.py (original)
+++ subversion/branches/ra-git/tools/dev/benchmarks/suite1/benchmark.py Tue Oct 11 09:11:50 2016
@@ -164,7 +164,7 @@ j = os.path.join
def bail(msg=None):
if msg:
- print msg
+ print(msg)
exit(1)
def time_str():
@@ -181,7 +181,7 @@ def run_cmd(cmd, stdin=None, shell=False
printable_cmd = cmd
else:
printable_cmd = ' '.join(cmd)
- print 'CMD:', printable_cmd
+ print('CMD:', printable_cmd)
if stdin:
stdin_arg = subprocess.PIPE
@@ -197,9 +197,9 @@ def run_cmd(cmd, stdin=None, shell=False
if verbose:
if (stdout):
- print "STDOUT: [[[\n%s]]]" % ''.join(stdout)
+ print("STDOUT: [[[\n%s]]]" % ''.join(stdout))
if (stderr):
- print "STDERR: [[[\n%s]]]" % ''.join(stderr)
+ print("STDERR: [[[\n%s]]]" % ''.join(stderr))
return stdout, stderr
@@ -350,7 +350,7 @@ class TimingsDb:
# exists
return
- print 'Creating database tables.'
+ print('Creating database tables.')
c.executescript('''
CREATE TABLE batch (
batch_id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -468,7 +468,7 @@ class Run:
def submit_timings(self):
conn = self.batch.db.conn
c = conn.cursor()
- print 'submitting...'
+ print('submitting...')
c.executemany("""
INSERT INTO timings
@@ -629,7 +629,7 @@ def perform_run(batch, run_kind,
cmd = [ svn_bin ]
cmd.extend( list(args) )
if verbose:
- print 'svn cmd:', ' '.join(cmd)
+ print('svn cmd:', ' '.join(cmd))
stdin = None
if stdin:
@@ -652,9 +652,9 @@ def perform_run(batch, run_kind,
if verbose:
if (stdout):
- print "STDOUT: [[[\n%s]]]" % ''.join(stdout)
+ print("STDOUT: [[[\n%s]]]" % ''.join(stdout))
if (stderr):
- print "STDERR: [[[\n%s]]]" % ''.join(stderr)
+ print("STDERR: [[[\n%s]]]" % ''.join(stderr))
return stdout,stderr
@@ -792,9 +792,9 @@ def perform_run(batch, run_kind,
else:
file_url = 'file:///%s' % repos
- print '\nRunning svn benchmark in', base
- print 'dir levels: %s; new files and dirs per leaf: %s' %(
- run_kind.levels, run_kind.spread)
+ print('\nRunning svn benchmark in', base)
+ print('dir levels: %s; new files and dirs per leaf: %s' %(
+ run_kind.levels, run_kind.spread))
started = datetime.datetime.now()
@@ -876,7 +876,7 @@ def perform_run(batch, run_kind,
finally:
stopped = datetime.datetime.now()
- print '\nDone with svn benchmark in', (stopped - started)
+ print('\nDone with svn benchmark in', (stopped - started))
run.remember_timing(TOTAL_RUN,
timedelta_to_seconds(stopped - started))
@@ -896,8 +896,8 @@ def cmdline_run(db, options, run_kind_st
N = int(N)
- print 'Hi, going to run a Subversion benchmark series of %d runs...' % N
- print 'Label is %s' % run_kind.label()
+ print('Hi, going to run a Subversion benchmark series of %d runs...' % N)
+ print('Label is %s' % run_kind.label())
# can we run the svn binaries?
svn_bin = j(options.svn_bin_dir, 'svn')
@@ -908,12 +908,12 @@ def cmdline_run(db, options, run_kind_st
if not so:
bail("Can't run %s" % b)
- print ', '.join([s.strip() for s in so.split('\n')[:2]])
+ print(', '.join([s.strip() for s in so.split('\n')[:2]]))
batch = Batch(db)
for i in range(N):
- print 'Run %d of %d' % (i + 1, N)
+ print('Run %d of %d' % (i + 1, N))
perform_run(batch, run_kind,
svn_bin, svnadmin_bin, options.verbose)
@@ -934,31 +934,31 @@ def cmdline_list(db, options, *args):
add_if_not_none('levels', run_kind.levels)
add_if_not_none('spread', run_kind.spread)
if constraints:
- print 'For\n', '\n'.join(constraints)
- print 'I found:'
+ print('For\n', '\n'.join(constraints))
+ print('I found:')
d = TimingQuery(db, run_kind)
cmd_names = d.get_sorted_command_names()
if cmd_names:
- print '\n%d command names:\n ' % len(cmd_names), '\n '.join(cmd_names)
+ print('\n%d command names:\n ' % len(cmd_names), '\n '.join(cmd_names))
branches = d.get_sorted_branches()
if branches and (len(branches) > 1 or branches[0] != run_kind.branch):
- print '\n%d branches:\n ' % len(branches), '\n '.join(branches)
+ print('\n%d branches:\n ' % len(branches), '\n '.join(branches))
revisions = d.get_sorted_revisions()
if revisions and (len(revisions) > 1 or revisions[0] != run_kind.revision):
- print '\n%d revisions:\n ' % len(revisions), '\n '.join(revisions)
+ print('\n%d revisions:\n ' % len(revisions), '\n '.join(revisions))
levels_spread = d.get_sorted_levels_spread()
if levels_spread and (
len(levels_spread) > 1
or levels_spread[0] != (run_kind.levels, run_kind.spread)):
- print '\n%d kinds of levels x spread:\n ' % len(levels_spread), '\n '.join(
- [ ('%dx%d' % (l, s)) for l,s in levels_spread ])
+ print('\n%d kinds of levels x spread:\n ' % len(levels_spread), '\n '.join(
+ [ ('%dx%d' % (l, s)) for l,s in levels_spread ]))
- print "\n%d runs in %d batches.\n" % (d.count_runs_batches())
+ print("\n%d runs in %d batches.\n" % (d.count_runs_batches()))
def cmdline_show(db, options, *run_kind_strings):
@@ -983,7 +983,7 @@ def cmdline_show(db, options, *run_kind_
tavg,
command_name))
- print '\n'.join(s)
+ print('\n'.join(s))
def cmdline_compare(db, options, *args):
@@ -1004,7 +1004,7 @@ def cmdline_compare(db, options, *args):
rightq = TimingQuery(db, right_kind)
right = rightq.get_timings()
if not right:
- print "No timings for %s" % right_kind.label()
+ print("No timings for %s" % right_kind.label())
continue
label = 'Compare %s to %s' % (right_kind.label(), left_kind.label())
@@ -1051,7 +1051,7 @@ def cmdline_compare(db, options, *args):
])
- print '\n'.join(s)
+ print('\n'.join(s))
# ------------------------------------------------------- charts
@@ -1073,7 +1073,7 @@ def cmdline_chart_compare(db, options, *
query = TimingQuery(db, run_kind)
timings = query.get_timings()
if not timings:
- print "No timings for %s" % run_kind.label()
+ print("No timings for %s" % run_kind.label())
continue
labels.append(run_kind.label())
timing_sets.append(timings)
@@ -1215,7 +1215,7 @@ def cmdline_chart_compare(db, options, *
va='center', weight='bold')
plt.savefig(chart_path)
- print 'wrote chart file:', chart_path
+ print('wrote chart file:', chart_path)
# ------------------------------------------------------------ main
@@ -1270,8 +1270,8 @@ if __name__ == '__main__':
def usage(msg=None):
parser.print_help()
if msg:
- print
- print msg
+ print("")
+ print(msg)
bail()
# there should be at least one arg left: the sub-command
Modified: subversion/branches/ra-git/tools/dev/build-svn-deps-win.pl
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/build-svn-deps-win.pl?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/build-svn-deps-win.pl (original)
+++ subversion/branches/ra-git/tools/dev/build-svn-deps-win.pl Tue Oct 11 09:11:50 2016
@@ -177,7 +177,7 @@ sub set_defaults {
set_default(\$PCRE_URL, "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$PCRE_VER.zip");
set_default(\$BDB_URL, "http://download.oracle.com/berkeley-db/db-5.3.21.zip");
set_default(\$SQLITE_URL, "http://www.sqlite.org/2013/sqlite-amalgamation-$SQLITE_VER.zip");
- set_default(\$SERF_URL, "http://serf.googlecode.com/svn/src_releases/serf-$SERF_VER.zip");
+ set_default(\$SERF_URL, "https://archive.apache.org/dist/serf/serf-$SERF_VER.zip");
set_default(\$NEON_URL, "http://www.webdav.org/neon/neon-$NEON_VER.tar.gz");
set_default(\$INSTDIR, $TOPDIR);
set_default(\$BLDDIR, "$TOPDIR\\build");
Modified: subversion/branches/ra-git/tools/dev/contribulyze.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/contribulyze.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/contribulyze.py (original)
+++ subversion/branches/ra-git/tools/dev/contribulyze.py Tue Oct 11 09:11:50 2016
@@ -741,7 +741,7 @@ def usage():
def main():
try:
opts, args = my_getopt(sys.argv[1:], 'C:U:hH?', [ 'help' ])
- except getopt.GetoptError, e:
+ except getopt.GetoptError as e:
complain(str(e) + '\n\n')
usage()
sys.exit(1)
Modified: subversion/branches/ra-git/tools/dev/gen-javahl-errors.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/gen-javahl-errors.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/gen-javahl-errors.py (original)
+++ subversion/branches/ra-git/tools/dev/gen-javahl-errors.py Tue Oct 11 09:11:50 2016
@@ -27,7 +27,7 @@ import sys, os
try:
from svn import core
-except ImportError, e:
+except ImportError as e:
sys.stderr.write("ERROR: Unable to import Subversion's Python bindings: '%s'\n" \
"Hint: Set your PYTHONPATH environment variable, or adjust your " \
"PYTHONSTARTUP\nfile to point to your Subversion install " \
Modified: subversion/branches/ra-git/tools/dev/gen-py-errors.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/gen-py-errors.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/gen-py-errors.py (original)
+++ subversion/branches/ra-git/tools/dev/gen-py-errors.py Tue Oct 11 09:11:50 2016
@@ -52,11 +52,11 @@ RE_DEF_VALUE = re.compile(r'SVN_ERR_([A-
def write_output(codes):
- print HEADER
+ print(HEADER)
for name, value in codes:
# skip SVN_ERR_ on the name
- print '%s = %d' % (name[8:], value)
+ print('%s = %d' % (name[8:], value))
def main(codes_fname):
Modified: subversion/branches/ra-git/tools/dev/gen_junit_report.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/gen_junit_report.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/gen_junit_report.py (original)
+++ subversion/branches/ra-git/tools/dev/gen_junit_report.py Tue Oct 11 09:11:50 2016
@@ -178,7 +178,7 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:], 'l:d:h',
['log-file=', 'output-dir=', 'help'])
- except getopt.GetoptError, err:
+ except getopt.GetoptError as err:
usage(err)
log_file = None
@@ -201,7 +201,7 @@ def main():
print("Directory '%s' not exists, creating ..." % output_dir)
try:
os.makedirs(output_dir)
- except OSError, err:
+ except OSError as err:
sys.stderr.write("ERROR: %s\n" % err)
sys.exit(1)
patterns = {
@@ -221,7 +221,7 @@ def main():
fp = None
try:
fp = open(log_file, 'r')
- except IOError, err:
+ except IOError as err:
sys.stderr.write("ERROR: %s\n" % err)
sys.exit(1)
Modified: subversion/branches/ra-git/tools/dev/graph-dav-servers.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/graph-dav-servers.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/graph-dav-servers.py (original)
+++ subversion/branches/ra-git/tools/dev/graph-dav-servers.py Tue Oct 11 09:11:50 2016
@@ -181,7 +181,7 @@ def draw_graph(dates, counts):
im = im.resize((width, height), Image.ANTIALIAS)
im.save(OUTPUT_FILE, im.format)
os.unlink(OUTPUT_FILE + ".tmp.png")
- except Exception, e:
+ except Exception as e:
sys.stderr.write("Error attempting to resize the graphic: %s\n" % (str(e)))
os.rename(OUTPUT_FILE + ".tmp.png", OUTPUT_FILE)
raise
Modified: subversion/branches/ra-git/tools/dev/histogram.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/histogram.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/histogram.py (original)
+++ subversion/branches/ra-git/tools/dev/histogram.py Tue Oct 11 09:11:50 2016
@@ -42,7 +42,7 @@ def histogram(counts, width):
for author, count in sorted(counts.items(),
key=operator.itemgetter(1), # sort on count
reverse=True):
- print "%-*s | %s" % (max_len, author, "X"*int(count/adjustor))
+ print("%-*s | %s" % (max_len, author, "X"*int(count/adjustor)))
if __name__ == '__main__':
Modified: subversion/branches/ra-git/tools/dev/iz/ff2csv.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/iz/ff2csv.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/iz/ff2csv.py (original)
+++ subversion/branches/ra-git/tools/dev/iz/ff2csv.py Tue Oct 11 09:11:50 2016
@@ -66,7 +66,7 @@ manager-speak pictures."""
try:
opts, args = my_getopt(sys.argv[1:], "", [x[0] for x in long_opts])
- except getopt.GetoptError, e:
+ except getopt.GetoptError as e:
print("Error: %s" % e.msg)
shortusage()
print(me + " --help for options.")
Modified: subversion/branches/ra-git/tools/dev/iz/find-fix.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/iz/find-fix.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/iz/find-fix.py (original)
+++ subversion/branches/ra-git/tools/dev/iz/find-fix.py Tue Oct 11 09:11:50 2016
@@ -127,7 +127,7 @@ def main():
try:
opts, args = my_getopt(sys.argv[1:], "", [x[0] for x in long_opts])
- except getopt.GetoptError, e:
+ except getopt.GetoptError as e:
sys.stderr.write("Error: %s\n" % e.msg)
shortusage()
sys.stderr.write("%s --help for options.\n" % me)
Modified: subversion/branches/ra-git/tools/dev/merge-graph.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/merge-graph.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/merge-graph.py (original)
+++ subversion/branches/ra-git/tools/dev/merge-graph.py Tue Oct 11 09:11:50 2016
@@ -35,8 +35,8 @@ if __name__ == '__main__':
prog_name = sys.argv[0]
if not args:
- usage = '%s: usage: "%s %s"' % (prog_name, prog_name, args_message)
- print >> sys.stderr, usage
+ usage = '%s: usage: "%s %s"\n' % (prog_name, prog_name, args_message)
+ sys.stderr.write(usage)
sys.exit(1)
formats = []
@@ -49,10 +49,10 @@ if __name__ == '__main__':
formats.append('png')
for config_filename in args:
- print "%s: reading '%s'," % (prog_name, config_filename),
+ sys.stdout.write("%s: reading '%s', " % (prog_name, config_filename))
graph = MergeDot(config_filename, rankdir='LR', dpi='72')
for format in formats:
filename = '%s.%s' % (graph.basename, format)
- print "writing '%s'" % filename,
+ sys.stdout.write("writing '%s' " % filename)
graph.save(format=format, filename=filename)
print
Modified: subversion/branches/ra-git/tools/dev/mergegraph/mergegraph.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/mergegraph/mergegraph.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/mergegraph/mergegraph.py (original)
+++ subversion/branches/ra-git/tools/dev/mergegraph/mergegraph.py Tue Oct 11 09:11:50 2016
@@ -242,7 +242,7 @@ class MergeDot(MergeGraph, pydot.Dot):
'annotations': '[]' })
files_read = config.read(config_filename)
if len(files_read) == 0:
- print >> sys.stderr, 'graph: unable to read graph config from "' + config_filename + '"'
+ sys.stderr.write('graph: unable to read graph config from "' + config_filename + '"\n')
sys.exit(1)
graph.basename = config.get('graph', 'basename')
graph.title = config.get('graph', 'title')
Modified: subversion/branches/ra-git/tools/dev/mergegraph/save_as_sh.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/mergegraph/save_as_sh.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/mergegraph/save_as_sh.py (original)
+++ subversion/branches/ra-git/tools/dev/mergegraph/save_as_sh.py Tue Oct 11 09:11:50 2016
@@ -26,13 +26,13 @@
def shebang_line(out):
- print >> out, '#!/bin/sh'
+ out.write('#!/bin/sh\n')
def command(out, cmd, *args):
"""Write the shell command CMD with the arguments ARGS to the file-like
object OUT.
"""
- print >> out, ' '.join((cmd,) + args)
+ out.write(' '.join((cmd,) + args) + "\n")
def svn(out, subcmd, *args):
"""Write an svn command with the given subcommand and arguments. Write
@@ -43,7 +43,7 @@ def svn(out, subcmd, *args):
def comment(out, text):
"""Write the comment TEXT to the file-like object OUT.
"""
- print >> out, '#', text
+ out.write('# %s\n' % text)
def node_branch(node_name):
"""Extract branch name from a node name.
Modified: subversion/branches/ra-git/tools/dev/sbox-ospath.py
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/sbox-ospath.py?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/sbox-ospath.py (original)
+++ subversion/branches/ra-git/tools/dev/sbox-ospath.py Tue Oct 11 09:11:50 2016
@@ -54,10 +54,10 @@ def rewrite_file(fname):
lines[i] = line[:start] + 'sbox.ospath(' + parts + ')' + line[end:]
count += 1
if count == 0:
- print 'No changes.'
+ print('No changes.')
else:
open(fname, 'w').writelines(lines)
- print '%s rewrites performed.' % (count,)
+ print('%s rewrites performed.' % (count,))
if __name__ == '__main__':
Propchange: subversion/branches/ra-git/tools/dev/svnmover/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 11 09:11:50 2016
@@ -0,0 +1 @@
+svnmover
Modified: subversion/branches/ra-git/tools/dev/svnmover/linenoise/linenoise.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/svnmover/linenoise/linenoise.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/svnmover/linenoise/linenoise.c (original)
+++ subversion/branches/ra-git/tools/dev/svnmover/linenoise/linenoise.c Tue Oct 11 09:11:50 2016
@@ -103,6 +103,14 @@
*
*/
+/* Tell the compiler to be quiet about implicit conversions from
+ [s]size_t to int. */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# if defined(__APPLE_CC__) || defined(__clang__)
+# pragma GCC diagnostic ignored "-Wshorten-64-to-32"
+# endif
+#endif
+
#include <termios.h>
#include <unistd.h>
#include <stdlib.h>
Modified: subversion/branches/ra-git/tools/dev/svnmover/merge3.c
URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/tools/dev/svnmover/merge3.c?rev=1764214&r1=1764213&r2=1764214&view=diff
==============================================================================
--- subversion/branches/ra-git/tools/dev/svnmover/merge3.c (original)
+++ subversion/branches/ra-git/tools/dev/svnmover/merge3.c Tue Oct 11 09:11:50 2016
@@ -899,8 +899,9 @@ merge_subbranch(svn_branch__txn_t *edit_
scratch_pool);
svn_branch__state_t *edit_subbranch;
- SVN_ERR(svn_branch__txn_branch(edit_txn, &edit_subbranch, from,
- new_branch_id, scratch_pool, scratch_pool));
+ SVN_ERR(svn_branch__txn_open_branch(edit_txn, &edit_subbranch,
+ new_branch_id, from->eid, from,
+ scratch_pool, scratch_pool));
/* subbranch possibly changed in source => merge */
SVN_ERR(branch_merge_subtree_r(edit_txn, edit_subbranch,
@@ -933,8 +934,9 @@ merge_subbranch(svn_branch__txn_t *edit_
svn_branch__root_eid(src_subbranch),
scratch_pool);
- SVN_ERR(svn_branch__txn_branch(edit_txn, NULL /*new_branch_p*/, from,
- new_branch_id, scratch_pool, scratch_pool));
+ SVN_ERR(svn_branch__txn_open_branch(edit_txn, NULL /*new_branch_p*/,
+ new_branch_id, from->eid, from,
+ scratch_pool, scratch_pool));
}
else if (subbr_tgt) /* added on target branch */
{
@@ -948,8 +950,9 @@ merge_subbranch(svn_branch__txn_t *edit_
svn_branch__root_eid(tgt_subbranch),
scratch_pool);
- SVN_ERR(svn_branch__txn_branch(edit_txn, NULL /*new_branch_p*/, from,
- new_branch_id, scratch_pool, scratch_pool));
+ SVN_ERR(svn_branch__txn_open_branch(edit_txn, NULL /*new_branch_p*/,
+ new_branch_id, from->eid, from,
+ scratch_pool, scratch_pool));
}
else if (subbr_yca) /* double delete */
{