Skip to content

Commit

Permalink
Don't trample on timestamps on update
Browse files Browse the repository at this point in the history
  • Loading branch information
kilobyte committed Jul 21, 2006
1 parent c340513 commit ed529a7
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tsvn
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# 2006-06-15 Adam Borowski:
# storing permissions and/or timestamps can be crudely controlled
# by editing this file and changing STORE_{PERMS,TIMES}
# 2006-07-21 Adam Borowski:
# bugfix: running 'update' or friends would overwrite the timestamps of
# locally modified files, losing them and also triggering a grave data
# loss bug in svn
#-------------------------------------------------------------------------
#
# Description:
Expand Down Expand Up @@ -365,7 +369,7 @@ function recordpermissions()
# same for the timestamp
if $STORE_TIMES
then
secs="`$SVN propget $TIME_PROP $dir/$file`"
secs="`$SVN propget $TIME_PROP $dir/$file 2>/dev/null`" || continue
secs=`expr "$secs" : "\([0-9]\+\)"` #forward compat: 1234.000000 is ok
if [ "$secs" != "$timestamp" ]
then
Expand All @@ -377,7 +381,15 @@ function recordpermissions()
then
echo "property $TIME_PROP not set for $dir/$file"
else
touch -d "1970-01-01 UTC $secs seconds" "$dir/$file"
#bug: dirs get always restored even if they got local mods
if [ -d "$dir/$file" ] || cmp -s "$dir/$file" "$dir/.svn/text-base/$file.svn-base"
then
echo -n "Updating date for $dir/$file to "
date -d "1970-01-01 UTC $secs seconds"
touch -d "1970-01-01 UTC $secs seconds" "$dir/$file"
else
echo "File $dir/$file has local mods, not updating the timestamp"
fi
fi
fi
fi
Expand Down

0 comments on commit ed529a7

Please sign in to comment.