##// END OF EJS Templates
dirstate: add test for exceptions during updates...
Durham Goode -
r22406:2e47e461 default
parent child Browse files
Show More
@@ -1,63 +1,88 b''
1 1 ------ Test dirstate._dirs refcounting
2 2
3 3 $ hg init t
4 4 $ cd t
5 5 $ mkdir -p a/b/c/d
6 6 $ touch a/b/c/d/x
7 7 $ touch a/b/c/d/y
8 8 $ touch a/b/c/d/z
9 9 $ hg ci -Am m
10 10 adding a/b/c/d/x
11 11 adding a/b/c/d/y
12 12 adding a/b/c/d/z
13 13 $ hg mv a z
14 14 moving a/b/c/d/x to z/b/c/d/x (glob)
15 15 moving a/b/c/d/y to z/b/c/d/y (glob)
16 16 moving a/b/c/d/z to z/b/c/d/z (glob)
17 17
18 18 Test name collisions
19 19
20 20 $ rm z/b/c/d/x
21 21 $ mkdir z/b/c/d/x
22 22 $ touch z/b/c/d/x/y
23 23 $ hg add z/b/c/d/x/y
24 24 abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y'
25 25 [255]
26 26 $ rm -rf z/b/c/d
27 27 $ touch z/b/c/d
28 28 $ hg add z/b/c/d
29 29 abort: directory 'z/b/c/d' already in dirstate
30 30 [255]
31 31
32 32 $ cd ..
33 33
34 34 Issue1790: dirstate entry locked into unset if file mtime is set into
35 35 the future
36 36
37 37 Prepare test repo:
38 38
39 39 $ hg init u
40 40 $ cd u
41 41 $ echo a > a
42 42 $ hg add
43 43 adding a
44 44 $ hg ci -m1
45 45
46 46 Set mtime of a into the future:
47 47
48 48 $ touch -t 202101011200 a
49 49
50 50 Status must not set a's entry to unset (issue1790):
51 51
52 52 $ hg status
53 53 $ hg debugstate
54 54 n 644 2 2021-01-01 12:00:00 a
55 55
56 56 Test modulo storage/comparison of absurd dates:
57 57
58 58 #if no-aix
59 59 $ touch -t 195001011200 a
60 60 $ hg st
61 61 $ hg debugstate
62 62 n 644 2 2018-01-19 15:14:08 a
63 63 #endif
64
65 Verify that exceptions during a dirstate change leave the dirstate
66 coherent (issue4353)
67
68 $ cat > ../dirstateexception.py <<EOF
69 > from mercurial import merge, extensions, util
70 >
71 > def wraprecordupdates(orig, repo, actions, branchmerge):
72 > raise util.Abort("simulated error while recording dirstateupdates")
73 >
74 > def reposetup(ui, repo):
75 > extensions.wrapfunction(merge, 'recordupdates', wraprecordupdates)
76 > EOF
77
78 $ hg rm a
79 $ hg commit -m 'rm a'
80 $ echo "[extensions]" >> .hg/hgrc
81 $ echo "dirstateex=../dirstateexception.py" >> .hg/hgrc
82 $ hg up 0
83 abort: simulated error while recording dirstateupdates
84 [255]
85 $ hg log -r . -T '{rev}\n'
86 1
87 $ hg status
88 ? a
General Comments 0
You need to be logged in to leave comments. Login now