Mercurial > hg > octave-lyh > gnulib-hg
changeset 5685:18b4bb3dea47
Preserve timestamps of files that have not changed.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 04 Mar 2005 19:36:42 +0000 |
parents | 0aebab2c04d4 |
children | 8df3fb71fbbc |
files | ChangeLog gnulib-tool |
diffstat | 2 files changed, 16 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,8 @@ 2005-03-04 Derek R. Price <derek@ximbiot.com> - * gnulib-tool: Only replace files via --import when they have - actually changed. + * gnulib-tool (func_cp_if_changed, func_mv_if_changed): New functions. + (func_import): Only replace files via --import when they have actually + changed. 2005-03-03 Derek R. Price <derek@ximbiot.com> Bruno Haible <bruno@clisp.org>
--- a/gnulib-tool +++ b/gnulib-tool @@ -22,7 +22,7 @@ progname=$0 package=gnulib -cvsdatestamp='$Date: 2005-03-04 19:28:13 $' +cvsdatestamp='$Date: 2005-03-04 19:36:42 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` @@ -118,27 +118,31 @@ } # func_cp_if_changed SRC DEST -# -# cp, but avoid munging timestamps if the file hasn't changed. +# Like cp, but avoids munging timestamps if the file hasn't changed. +# Uses also the variables +# - dry_run true if actions shall only be printed, blank otherwise func_cp_if_changed () { if test $# -ne 2; then - echo "usage: cp_if_changed SRC DEST" >&2 + echo "usage: func_cp_if_changed SRC DEST" >&2 fi test -n "$dry_run" && dry=echo - if cmp "$1" "$2" >/dev/null 2>&1; then :; else + if cmp "$1" "$2" >/dev/null 2>&1; then + : + else $dry cp -p "$1" "$2" fi } # func_mv_if_changed SRC DEST -# -# mv, but avoid munging timestamps if the file hasn't changed. -# Remove the source file if it is not renamed. +# Like mv, but avoids munging timestamps if the file hasn't changed. +# Removes SRC if it is not renamed. +# Uses also the variables +# - dry_run true if actions shall only be printed, blank otherwise func_mv_if_changed () { if test $# -ne 2; then - echo "usage: mv_if_changed SRC DEST" >&2 + echo "usage: func_mv_if_changed SRC DEST" >&2 fi test -n "$dry_run" && dry=echo if cmp "$1" "$2" >/dev/null 2>&1; then