> You still have several places where your code exceeds 80 characters.
Fixed at attached patch.
>> Encoding problem? I see a Yen symbol where a backslash should be.
What do you see in the attached file? I use Google web mailer.
2013/8/8 Daniel Shahaf <[email protected]>
> Masaru Tsuchiyama wrote on Thu, Aug 08, 2013 at 23:13:54 +0900:
> >>> " before it is modified. Makes the working copy file
> read-only¥n"
> >>> " when it is not locked. Use 'svn propdel svn:needs-lock
> PATH...'¥n"
> >>> " to clear.¥n"
> >>> + " svn:use-commit-times - If present, make the timestamp of
> the file¥n"
> >>> + " to commit time. Use 'svn propdel svn:use-commit-times
> PATH...' to clear.¥n"
> >>> "¥n"
> >>> " Subversion recognizes the following special versioned
> properties on a¥n"
> >>> " directory:¥n"
> >>
> >> Encoding problem? I see a Yen symbol where a backslash should be.
> >
> > On Japanse version of Windows (SJIS), Yen and backslash are same symbol.
> > What do you see in the attached file, not inline text?
>
> I tried two versions of mutt and each of them showed something gelse.
>
> I tried to decode the attachment manually, with:
>
> openssl base64 -d | iconv -f shift_jis -t utf-8 | fgrep 'n"'
>
> and that gives me a Yen symbol.
>
> > Fixed.
>
> Thanks. You still have several places where your code exceeds 80
> characters. Otherwise it looks good as far as form is concerned.
>
> I prefer that someone else review the semantics, i.e., the actual
> feature being added.
>
> Cheers,
>
> Daniel
>
Index: subversion/include/svn_props.h
===================================================================
--- subversion/include/svn_props.h (revision 1513726)
+++ subversion/include/svn_props.h (working copy)
@@ -449,6 +449,13 @@ svn_prop_name_is_valid(const char *prop_name);
/** Property used to record inheritable configuration ignores. */
#define SVN_PROP_INHERITABLE_IGNORES SVN_PROP_PREFIX "global-ignores"
+/**
+ * Property used to control whether timestamp of a file is modified
+ * to the commit time
+ * @since New in 1.9.
+ */
+#define SVN_PROP_USE_COMMIT_TIMES SVN_PROP_PREFIX "use-commit-times"
+
/** Meta-data properties.
*
* The following properties are used for storing meta-data about
@@ -509,7 +516,8 @@ svn_prop_name_is_valid(const char *prop_name);
SVN_PROP_TEXT_TIME, \
SVN_PROP_OWNER, \
SVN_PROP_GROUP, \
- SVN_PROP_UNIX_MODE,
+ SVN_PROP_UNIX_MODE, \
+ SVN_PROP_USE_COMMIT_TIMES,
/** @} */
Index: subversion/libsvn_subr/properties.c
===================================================================
--- subversion/libsvn_subr/properties.c (revision 1513726)
+++ subversion/libsvn_subr/properties.c (working copy)
@@ -446,7 +446,8 @@ svn_prop_is_boolean(const char *prop_name)
make any speed difference. */
if (strcmp(prop_name, SVN_PROP_EXECUTABLE) == 0
|| strcmp(prop_name, SVN_PROP_NEEDS_LOCK) == 0
- || strcmp(prop_name, SVN_PROP_SPECIAL) == 0)
+ || strcmp(prop_name, SVN_PROP_SPECIAL) == 0
+ || strcmp(prop_name, SVN_PROP_USE_COMMIT_TIMES) == 0)
return TRUE;
return FALSE;
}
Index: subversion/libsvn_wc/props.c
===================================================================
--- subversion/libsvn_wc/props.c (revision 1513726)
+++ subversion/libsvn_wc/props.c (working copy)
@@ -2152,7 +2152,8 @@ svn_wc_canonicalize_svn_prop(const svn_string_t **
}
else if (svn_prop_is_boolean(propname))
{
- /* SVN_PROP_EXECUTABLE, SVN_PROP_NEEDS_LOCK, SVN_PROP_SPECIAL */
+ /* SVN_PROP_EXECUTABLE, SVN_PROP_NEEDS_LOCK, SVN_PROP_SPECIAL,
+ SVN_PROP_USE_COMMIT_TIMES */
propval = &boolean_value;
}
else if (strcmp(propname, SVN_PROP_MERGEINFO) == 0)
Index: subversion/libsvn_wc/update_editor.c
===================================================================
--- subversion/libsvn_wc/update_editor.c (revision 1513726)
+++ subversion/libsvn_wc/update_editor.c (working copy)
@@ -751,6 +751,12 @@ struct file_baton
/* The tree conflict to install once the node is really edited */
svn_skel_t *edit_conflict;
+
+ /* A boolean indicating whether svn:use-commit-times is set */
+ svn_boolean_t use_commit_times;
+
+ /* A boolean indicating whether svn:use-commit-times is removing */
+ svn_boolean_t remove_use_commit_times;
};
@@ -3834,6 +3840,17 @@ change_file_prop(void *file_baton,
fb->already_notified = TRUE;
}
}
+ if (strcmp(name, SVN_PROP_USE_COMMIT_TIMES) == 0)
+ {
+ if (propchange->value)
+ {
+ fb->use_commit_times = TRUE;
+ }
+ else
+ {
+ fb->remove_use_commit_times = TRUE;
+ }
+ }
return SVN_NO_ERROR;
}
@@ -4640,6 +4657,25 @@ close_file(void *file_baton,
eb->notify_func(eb->notify_baton, notify, scratch_pool);
}
+ /* use_commit_times and remove_use_commit_times are mutually exclusive */
+ SVN_ERR_ASSERT(
+ (fb->use_commit_times != FALSE) != (fb->remove_use_commit_times !=
FALSE) );
+ if (!fb->adding_file)
+ {
+ if (fb->use_commit_times && fb->changed_date)
+ {
+ SVN_ERR(svn_io_set_file_affected_time(fb->changed_date,
+ fb->local_abspath,
+ scratch_pool));
+ }
+ else if (fb->remove_use_commit_times)
+ {
+ SVN_ERR(svn_io_set_file_affected_time(apr_time_now(),
+ fb->local_abspath,
+ scratch_pool));
+ }
+ }
+
svn_pool_destroy(fb->pool); /* Destroy scratch_pool */
/* We have one less referrer to the directory */
Index: subversion/libsvn_wc/workqueue.c
===================================================================
--- subversion/libsvn_wc/workqueue.c (revision 1513726)
+++ subversion/libsvn_wc/workqueue.c (working copy)
@@ -638,6 +638,9 @@ run_file_install(work_item_baton_t *wqb,
SVN_ERR(svn_io_set_file_read_only(local_abspath, FALSE, scratch_pool));
}
+ if (props && svn_hash_gets(props, SVN_PROP_USE_COMMIT_TIMES))
+ use_commit_times = TRUE;
+
if (use_commit_times)
{
if (changed_date)
Index: subversion/svn/svn.c
===================================================================
--- subversion/svn/svn.c (revision 1513726)
+++ subversion/svn/svn.c (working copy)
@@ -1340,6 +1340,9 @@ const svn_opt_subcommand_desc2_t svn_cl__cmd_table
" before it is modified. Makes the working copy file read-only\n"
" when it is not locked. Use 'svn propdel svn:needs-lock PATH...'\n"
" to clear.\n"
+ " svn:use-commit-times - If present, make the timestamp of the file\n"
+ " to commit time. Use 'svn propdel svn:use-commit-times PATH...'\n"
+ " to clear.\n"
"\n"
" Subversion recognizes the following special versioned properties on
a\n"
" directory:\n"
Index: subversion/tests/cmdline/checkout_tests.py
===================================================================
--- subversion/tests/cmdline/checkout_tests.py (revision 1513726)
+++ subversion/tests/cmdline/checkout_tests.py (working copy)
@@ -1102,7 +1102,61 @@ def checkout_wc_from_drive(sbox):
subprocess.call(['subst', '/D', drive +':'])
#----------------------------------------------------------------------
+# Test checking out with svn:use-commit-times
+def checkout_with_use_commit_times(sbox):
+ "checkout with svn:use-commit-times"
+ sbox.build()
+
+ # Create the revprop-change hook for this test
+ svntest.actions.enable_revprop_changes(sbox.repo_dir)
+
+ wc_dir = sbox.wc_dir
+ iota_path = sbox.ospath('iota')
+
+ svntest.actions.set_prop('svn:use-commit-times', '*', iota_path)
+
+ # Create expected output tree.
+ expected_output = svntest.wc.State(wc_dir, {
+ 'iota' : Item(verb='Sending'),
+ })
+
+ # Commit the one file.
+ svntest.actions.run_and_verify_commit(wc_dir,
+ expected_output,
+ None,
+ None,
+ iota_path)
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'propset', '--revprop', '-r2',
+ 'svn:date', '2001-02-03T12:45:56.000000Z',
+ sbox.wc_dir)
+
+ # now checkout the repo in another folder
+ checkout_target = sbox.add_wc_path('checkout')
+ os.mkdir(checkout_target)
+
+ expected_output = svntest.main.greek_state.copy()
+ expected_output.wc_dir = checkout_target
+ expected_output.tweak(status='A ', contents=None)
+ expected_wc = svntest.main.greek_state.copy()
+
+ svntest.actions.run_and_verify_checkout(sbox.repo_url,
+ checkout_target,
+ expected_output,
+ expected_wc)
+ secs_svn_date = time.mktime( (2001, 2, 3, 12, 45, 56, 0, 0, 0) )
+ secs_svn_date -= time.timezone
+ new_iota = os.path.join(checkout_target, 'iota')
+ mtime = os.path.getmtime(new_iota)
+
+ # check whether the timestamp of the file is expected value
+ if secs_svn_date != mtime:
+ raise svntest.Failure
+
+#----------------------------------------------------------------------
+
# list all tests here, starting with None:
test_list = [ None,
checkout_with_obstructions,
@@ -1118,7 +1172,8 @@ test_list = [ None,
checkout_peg_rev,
checkout_peg_rev_date,
co_with_obstructing_local_adds,
- checkout_wc_from_drive
+ checkout_wc_from_drive,
+ checkout_with_use_commit_times,
]
if __name__ == "__main__":
Index: subversion/tests/cmdline/export_tests.py
===================================================================
--- subversion/tests/cmdline/export_tests.py (revision 1513726)
+++ subversion/tests/cmdline/export_tests.py (working copy)
@@ -27,6 +27,7 @@
# General modules
import os
import tempfile
+import time
# Our testing module
import svntest
@@ -964,6 +965,63 @@ def export_custom_keywords(sbox):
if open(export_file).read() != ''.join(alpha_content):
raise svntest.Failure("wrong keyword expansion")
+
+#----------------------------------------------------------------------
+# Test exporting out with svn:use-commit-times
+def export_with_use_commit_times(sbox):
+ "export with svn:use-commit-times"
+
+ sbox.build()
+
+ # Create the revprop-change hook for this test
+ svntest.actions.enable_revprop_changes(sbox.repo_dir)
+
+ wc_dir = sbox.wc_dir
+ iota_path = sbox.ospath('iota')
+
+ svntest.actions.set_prop('svn:use-commit-times', '*', iota_path)
+
+ # Create expected output tree.
+ expected_output = svntest.wc.State(wc_dir, {
+ 'iota' : Item(verb='Sending'),
+ })
+
+ # Commit the one file.
+ svntest.actions.run_and_verify_commit(wc_dir,
+ expected_output,
+ None,
+ None,
+ iota_path)
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'propset', '--revprop', '-r2',
+ 'svn:date', '2001-02-03T12:45:56.000000Z',
+ sbox.wc_dir)
+
+ # now export the repo in another folder
+ export_target = sbox.add_wc_path('export')
+ expected_disk = svntest.main.greek_state.copy()
+ export_target = sbox.add_wc_path('export')
+
+ expected_output = svntest.main.greek_state.copy()
+ expected_output.wc_dir = export_target
+ expected_output.desc[''] = Item()
+ expected_output.tweak(contents=None, status='A ')
+
+ svntest.actions.run_and_verify_export(sbox.repo_url,
+ export_target,
+ expected_output,
+ expected_disk)
+
+ secs_svn_date = time.mktime( (2001, 2, 3, 12, 45, 56, 0, 0, 0) )
+ secs_svn_date -= time.timezone
+ new_iota = os.path.join(export_target, 'iota')
+ mtime = os.path.getmtime(new_iota)
+
+ # check whether the timestamp of the file is expected value
+ if secs_svn_date != mtime:
+ raise svntest.Failure
+
########################################################################
# Run the tests
@@ -998,6 +1056,7 @@ test_list = [ None,
export_to_current_dir,
export_file_overwrite_with_force,
export_custom_keywords,
+ export_with_use_commit_times,
]
if __name__ == '__main__':
Index: subversion/tests/cmdline/prop_tests.py
===================================================================
--- subversion/tests/cmdline/prop_tests.py (revision 1513726)
+++ subversion/tests/cmdline/prop_tests.py (working copy)
@@ -901,6 +901,13 @@ def prop_value_conversions(sbox):
svntest.actions.set_prop('svn:executable', pval, mu_path,
"svn: warning: W125005.*use 'svn propdel'")
+ # svn:use-commit-times value should be forced to a '*'
+ svntest.actions.set_prop('svn:use-commit-times', 'foo', iota_path)
+ svntest.actions.set_prop('svn:use-commit-times', '*', lambda_path)
+ for pval in (' ', '', 'no', 'off', 'false'):
+ svntest.actions.set_prop('svn:use-commit-times', pval, mu_path,
+ "svn: warning: W125005.*use 'svn propdel'")
+
# Anything else should be untouched
svntest.actions.set_prop('svn:some-prop', 'bar', lambda_path, force=True)
svntest.actions.set_prop('svn:some-prop', ' bar baz', mu_path, force=True)
@@ -945,6 +952,11 @@ def prop_value_conversions(sbox):
svntest.actions.check_prop('svn:executable', lambda_path, ['*'])
svntest.actions.check_prop('svn:executable', mu_path, ['*'])
+ # Check svn:use-commit-times
+ svntest.actions.check_prop('svn:use-commit-times', iota_path, ['*'])
+ svntest.actions.check_prop('svn:use-commit-times', lambda_path, ['*'])
+ svntest.actions.check_prop('svn:use-commit-times', mu_path, ['*'])
+
# Check other props
svntest.actions.check_prop('svn:some-prop', lambda_path, ['bar'])
svntest.actions.check_prop('svn:some-prop', mu_path, [' bar baz'])
Index: subversion/tests/cmdline/update_tests.py
===================================================================
--- subversion/tests/cmdline/update_tests.py (revision 1513726)
+++ subversion/tests/cmdline/update_tests.py (working copy)
@@ -6779,6 +6779,111 @@ def update_child_below_add(sbox):
sbox.ospath('A/B/E'))
+#----------------------------------------------------------------------
+# Test updating out with svn:use-commit-times
+def update_with_use_commit_times(sbox):
+ "update with svn:use-commit-times"
+
+ sbox.build()
+
+ # Create the revprop-change hook for this test
+ svntest.actions.enable_revprop_changes(sbox.repo_dir)
+
+ wc_dir = sbox.wc_dir
+ iota_path = sbox.ospath('iota')
+
+ # checkout the repo before setting 'svn:use-commit-times'
+ checkout_target = sbox.add_wc_path('checkout')
+ os.mkdir(checkout_target)
+
+ expected_output = svntest.main.greek_state.copy()
+ expected_output.wc_dir = checkout_target
+ expected_output.tweak(status='A ', contents=None)
+ expected_wc = svntest.main.greek_state.copy()
+
+ # checkout for updating before setting 'svn:use-commit-times'
+ svntest.actions.run_and_verify_checkout(sbox.repo_url,
+ checkout_target,
+ expected_output,
+ expected_wc)
+
+ # set 'svn:use-commit-times' to wc
+ svntest.actions.set_prop('svn:use-commit-times', '*', iota_path)
+
+ # Create expected output tree.
+ expected_output = svntest.wc.State(wc_dir, {
+ 'iota' : Item(verb='Sending'),
+ })
+
+ # Commit the one file.
+ svntest.actions.run_and_verify_commit(wc_dir,
+ expected_output,
+ None,
+ None,
+ iota_path)
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'propset', '--revprop', '-r1',
+ 'svn:date', '2001-02-03T12:45:56.000000Z',
+ sbox.wc_dir)
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'propset', '--revprop', '-r2',
+ 'svn:date', '2001-02-03T12:45:56.000000Z',
+ sbox.wc_dir)
+
+ # Update
+ expected_output = svntest.wc.State(checkout_target, {
+ 'iota' : Item(status=' U'),
+ })
+ expected_output.wc_dir = checkout_target
+
+ expected_disk = svntest.main.greek_state.copy()
+ expected_disk.wc_dir = checkout_target
+
+ expected_status = svntest.actions.get_virginal_state(checkout_target, 1)
+ expected_status.tweak('iota', wc_rev=2)
+
+ svntest.actions.run_and_verify_update(checkout_target,
+ None,
+ None,
+ None,
+ None, None, None, None, None, 0 )
+
+ secs_svn_date = time.mktime( (2001, 2, 3, 12, 45, 56, 0, 0, 0) )
+ secs_svn_date -= time.timezone
+ new_iota = os.path.join(checkout_target, 'iota')
+ mtime = os.path.getmtime(new_iota)
+
+ # check whether the timestamp of the file is expected value
+ if secs_svn_date != mtime:
+ raise svntest.Failure
+
+ # remove 'svn:use-commit-times' property test
+ svntest.main.run_svn(None, 'propdel', 'svn:use-commit-times', iota_path)
+ svntest.actions.run_and_verify_commit(wc_dir,
+ None,
+ None,
+ None,
+ iota_path)
+ # get current time before update
+ time_before_update = time.time()
+
+ # update
+ svntest.actions.run_and_verify_update(checkout_target,
+ None,
+ None,
+ None,
+ None, None, None, None, None, 0 )
+ # get current time after update
+ time_before_after = time.time()
+
+ mtime = os.path.getmtime(new_iota)
+
+ # check whether the timestamp of the file is between 'before update' and
'after update'
+ if time_before_update > mtime or mtime > time_before_after:
+ raise svntest.Failure
+
#######################################################################
# Run the tests
@@ -6865,6 +6970,7 @@ test_list = [ None,
update_moved_away,
bump_below_tree_conflict,
update_child_below_add,
+ update_with_use_commit_times,
]
if __name__ == '__main__':