Last active
December 31, 2015 20:29
-
-
Save deanmalmgren/8040209 to your computer and use it in GitHub Desktop.
Change the timestamps of all files managed in a mercurial repository to the last modified time recorded in the repository. This is useful, for example, when multiple people are using the same Makefile to run a data workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd $(hg root) | |
for f in $(hg st -A | awk '{if($1!="I") print $2}'); do | |
# http://stackoverflow.com/a/4039466/564709 | |
t=$(hg log -l1 --template '{date|isodate}' $f | awk '{d=$1; gsub(/-/,"",d); t=$2; sub(/:/,"",t); printf("%s%s", d, t)}') | |
# http://stackoverflow.com/a/6839855/564709 | |
touch -t $t $f | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment