[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: saving time stamps of files

From: <kfogel_at_collab.net>
Date: 2003-05-16 20:20:00 CEST

"P.Marek" <pmarek@cpan.org> writes:
> default behaviour for mtime restoring should be on for binary and off for
> text files, with the command line switches able to override that, and
> possibly (but as mentioned not in the first patch) to still have a
> per-file-property as last resort.

I think this behavior should treat all files the same. That's easiest
to explain and remember.

Regarding the patch:

Can you write a log message (see HACKING, and run 'svn log' on the
Subversion repository to see examples)? Also, it's easier for us to
apply patches when they are relative to the top of the source tree.

Comments follow:

> diff -urN subversion-0.22.0_origin/subversion/include/svn_props.h subversion-0.22.0/subversion/include/svn_props.h
> --- subversion-0.22.0_origin/subversion/include/svn_props.h Fri May 16 10:43:09 2003
> +++ subversion-0.22.0/subversion/include/svn_props.h Fri May 16 11:00:44 2003
> @@ -145,6 +145,14 @@
> /** The mime-type of a given file. */
> #define SVN_PROP_MIME_TYPE SVN_PROP_PREFIX "mime-type"
>
> +/** The (m)time of a given file. */
> +#define SVN_PROP_TEXT_TIME SVN_PROP_PREFIX "text-time"
> +
> +/** The (m)time-handling of a given file. currently allowed:
> + none to use current behaviour
> + "text-time" to use that. */
> +#define SVN_PROP_TEXT_TIME_HANDLING SVN_PROP_PREFIX "text-time-handling"
> +
> /** The ignore patterns for a given directory. */
> #define SVN_PROP_IGNORE SVN_PROP_PREFIX "ignore"
>
> diff -urN subversion-0.22.0_origin/subversion/libsvn_wc/adm_ops.c subversion-0.22.0/subversion/libsvn_wc/adm_ops.c
> --- subversion-0.22.0_origin/subversion/libsvn_wc/adm_ops.c Thu May 8 05:03:37 2003
> +++ subversion-0.22.0/subversion/libsvn_wc/adm_ops.c Fri May 16 12:41:36 2003
> @@ -41,6 +41,7 @@
> #include "svn_io.h"
> #include "svn_md5.h"
> #include "svn_xml.h"
> +#include "svn_time.h"
>
> #include "wc.h"
> #include "log.h"
> @@ -965,8 +966,9 @@
> if (kind == svn_node_file)
> {
> /* If this is a new file being added instead of a file copy,
> - then try to detect the mime-type of this file and set
> - svn:executable if the file is executable. Otherwise, use the
> + then try to detect the mime-type of this file, set
> + svn:executable if the file is executable, and
> + save the mtime. Otherwise, use the
> values in the original file. */
> if (! copyfrom_url)
> {
> @@ -990,6 +992,20 @@
> SVN_ERR (svn_wc_prop_set (SVN_PROP_EXECUTABLE, &emptystr, path,
> parent_access, pool));
> }
> +
> + /* set svn:text-time from the current mtime */
> + {
> + svn_string_t time_str;
> + apr_time_t tstamp;
> +
> + SVN_ERR (svn_io_file_affected_time (&tstamp, path, pool));
> + time_str.data = svn_time_to_cstring (tstamp, pool);
> +
> + time_str.len = strlen(time_str.data);
> + SVN_ERR (svn_wc_prop_set (SVN_PROP_TEXT_TIME, &time_str, path,
> + parent_access, pool));
> + }
> +
> }
> }

Looks basically good, though please clean up the alignment so it's
easy to read! :-) (For example, "apr_time_t tstamp" above.)

Is there any way to write a regression test for this? That would be
very helpful.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 16 21:00:53 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.