Preserve timestamps of files that have not changed.
authorBruno Haible <bruno@clisp.org>
Fri, 4 Mar 2005 19:36:42 +0000 (19:36 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 4 Mar 2005 19:36:42 +0000 (19:36 +0000)
ChangeLog
gnulib-tool

index 51283b5001bbd599838cf799494e2403d4a73797..4a576c58be54790771852ac4d3e322435376a66e 100644 (file)
--- 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>
index aa2f4795d3ab0ee3261a85d3345306f81fb8bc48..44fd4a1a04f8d2199007193f9307df1926c6afe4 100755 (executable)
@@ -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_fatal_error ()
 }
 
 # 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