[PATCH 1 of 2 stable] largefiles: test coverage of fatal interruption of update
Mads Kiilerich
mads at kiilerich.com
Sun Oct 16 00:30:00 UTC 2016
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1476577598 -7200
# Sun Oct 16 02:26:38 2016 +0200
# Node ID 2105975810c843d016ba930c44e63699af2703a6
# Parent 5cb830801855dbb63e98b948e355bc995d295bf3
largefiles: test coverage of fatal interruption of update
Test using existing changesets in a clean working directory, revealing problems
with files that don't show up as modified or do show up as removed when they
just not have been written yet.
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -144,6 +144,7 @@ Test that "hg merge" updates largefiles
large1 in #1
$ cat .hglf/large1
58e24f733a964da346e2407a2bee99d9001184f5
+ $ rm normal1.orig
(merge non-existing largefiles from "other" via conflict prompt -
make sure the following commit doesn't abort in a confusing way when trying to
@@ -243,6 +244,7 @@ Test that "hg rollback" restores status
? largeY
$ test -f .hglf/largeY
[1]
+ $ rm largeY
Test that "hg rollback" restores standins correctly
@@ -285,6 +287,7 @@ is not branch-tip)
58e24f733a964da346e2407a2bee99d9001184f5
$ cat .hglf/large2
1deebade43c8c498a3c8daddac0244dc55d1331d
+ $ rm normalX
Test that "hg status" shows status of largefiles correctly just after
automated commit like rebase/transplant
@@ -598,6 +601,7 @@ it is aborted by conflict.
58e24f733a964da346e2407a2bee99d9001184f5
$ cat large1
large1 in #1
+ $ rm normal1.orig
Test that rebase updates standins for manually modified largefiles at
the 1st commit of resuming.
@@ -728,6 +732,48 @@ bit correctly on the platform being unaw
#endif
+Test a fatal error interrupting an update. lfdirstate doesn't realize that
+.hglf has been updated while the largefile hasn't. Status thus shows a clean
+state ... but rebuilding lfdirstate and checking all hashes reveals it isn't
+clean.
+
+Start with clean dirstates:
+ $ hg up -qcr "8^"
+ $ sleep 1
+ $ hg st
+Update standins without updating largefiles:
+ $ cat << EOF > ../crashupdatelfiles.py
+ > import hgext.largefiles.lfutil
+ > def getlfilestoupdate(oldstandins, newstandins):
+ > raise SystemExit(7)
+ > hgext.largefiles.lfutil.getlfilestoupdate = getlfilestoupdate
+ > EOF
+ $ hg up -Cr "8" --config extensions.crashupdatelfiles=../crashupdatelfiles.py
+ [7]
+Check large1 content and status:
+BUG: largeX is R and large1 is not M and update does nothing
+ $ cat large1
+ large1 in #3
+ $ hg st
+ R largeX
+ $ hg up -Cr .
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg st
+ R largeX
+Force largefiles rehashing and check again - revealing modifications that
+update now can remove:
+ $ rm .hg/largefiles/dirstate
+ $ hg st
+ M large1
+ ! largeX
+ $ hg up -Cr .
+ getting changed largefiles
+ 2 largefiles updated, 0 removed
+ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg st
+ $ cat large1
+ manually modified before 'hg transplant --continue'
+
$ cd ..
Test that "hg convert" avoids copying largefiles from the working
More information about the Mercurial-devel
mailing list