[PATCH STABLE] test-fix: fix use of 'f --newer' to check that foo.whole is not updated
Yuya Nishihara
yuya at tcha.org
Thu Apr 19 13:54:02 UTC 2018
# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1524143530 -32400
# Thu Apr 19 22:12:10 2018 +0900
# Branch stable
# Node ID 769bd30988035d0c802cd5c8acaece16ebb3d024
# Parent 3866a9af240cc01e5eab12ffeac668f61cfa2a13
test-fix: fix use of 'f --newer' to check that foo.whole is not updated
Here we want to assert not 'mtime(foo.whole.orig) < mtime(foo.whole)'.
The condition has to be inverted since 'f --newer' says "newer" if the
mtimes match.
Alternatively, we could insert 'sleep 2' before 'cp' to ensure that
foo.whole.orig is newer than foo.whole, but a fewer sleeps should be
better.
diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -493,11 +493,11 @@ write back to the file, so for example t
$ printf "NO FIX NEEDED\n" > foo.whole
$ hg add
adding foo.whole
- $ cp foo.whole foo.whole.orig
+ $ cp -p foo.whole foo.whole.orig
$ sleep 2 # mtime has a resolution of one or two seconds.
$ hg fix --working-dir
- $ f foo.whole --newer foo.whole.orig
- foo.whole: older than foo.whole.orig
+ $ f foo.whole.orig --newer foo.whole
+ foo.whole.orig: newer than foo.whole
$ cd ..
More information about the Mercurial-devel
mailing list