##// 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 ------ Test dirstate._dirs refcounting
1 ------ Test dirstate._dirs refcounting
2
2
3 $ hg init t
3 $ hg init t
4 $ cd t
4 $ cd t
5 $ mkdir -p a/b/c/d
5 $ mkdir -p a/b/c/d
6 $ touch a/b/c/d/x
6 $ touch a/b/c/d/x
7 $ touch a/b/c/d/y
7 $ touch a/b/c/d/y
8 $ touch a/b/c/d/z
8 $ touch a/b/c/d/z
9 $ hg ci -Am m
9 $ hg ci -Am m
10 adding a/b/c/d/x
10 adding a/b/c/d/x
11 adding a/b/c/d/y
11 adding a/b/c/d/y
12 adding a/b/c/d/z
12 adding a/b/c/d/z
13 $ hg mv a z
13 $ hg mv a z
14 moving a/b/c/d/x to z/b/c/d/x (glob)
14 moving a/b/c/d/x to z/b/c/d/x (glob)
15 moving a/b/c/d/y to z/b/c/d/y (glob)
15 moving a/b/c/d/y to z/b/c/d/y (glob)
16 moving a/b/c/d/z to z/b/c/d/z (glob)
16 moving a/b/c/d/z to z/b/c/d/z (glob)
17
17
18 Test name collisions
18 Test name collisions
19
19
20 $ rm z/b/c/d/x
20 $ rm z/b/c/d/x
21 $ mkdir z/b/c/d/x
21 $ mkdir z/b/c/d/x
22 $ touch z/b/c/d/x/y
22 $ touch z/b/c/d/x/y
23 $ hg add z/b/c/d/x/y
23 $ hg add z/b/c/d/x/y
24 abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y'
24 abort: file 'z/b/c/d/x' in dirstate clashes with 'z/b/c/d/x/y'
25 [255]
25 [255]
26 $ rm -rf z/b/c/d
26 $ rm -rf z/b/c/d
27 $ touch z/b/c/d
27 $ touch z/b/c/d
28 $ hg add z/b/c/d
28 $ hg add z/b/c/d
29 abort: directory 'z/b/c/d' already in dirstate
29 abort: directory 'z/b/c/d' already in dirstate
30 [255]
30 [255]
31
31
32 $ cd ..
32 $ cd ..
33
33
34 Issue1790: dirstate entry locked into unset if file mtime is set into
34 Issue1790: dirstate entry locked into unset if file mtime is set into
35 the future
35 the future
36
36
37 Prepare test repo:
37 Prepare test repo:
38
38
39 $ hg init u
39 $ hg init u
40 $ cd u
40 $ cd u
41 $ echo a > a
41 $ echo a > a
42 $ hg add
42 $ hg add
43 adding a
43 adding a
44 $ hg ci -m1
44 $ hg ci -m1
45
45
46 Set mtime of a into the future:
46 Set mtime of a into the future:
47
47
48 $ touch -t 202101011200 a
48 $ touch -t 202101011200 a
49
49
50 Status must not set a's entry to unset (issue1790):
50 Status must not set a's entry to unset (issue1790):
51
51
52 $ hg status
52 $ hg status
53 $ hg debugstate
53 $ hg debugstate
54 n 644 2 2021-01-01 12:00:00 a
54 n 644 2 2021-01-01 12:00:00 a
55
55
56 Test modulo storage/comparison of absurd dates:
56 Test modulo storage/comparison of absurd dates:
57
57
58 #if no-aix
58 #if no-aix
59 $ touch -t 195001011200 a
59 $ touch -t 195001011200 a
60 $ hg st
60 $ hg st
61 $ hg debugstate
61 $ hg debugstate
62 n 644 2 2018-01-19 15:14:08 a
62 n 644 2 2018-01-19 15:14:08 a
63 #endif
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