##// END OF EJS Templates
narrow: show repo corruption when commiting empty files...
Valentin Gatien-Baron -
r48769:cc33deae stable
parent child Browse files
Show More
@@ -1,106 +1,118 b''
1 1 #testcases flat tree
2 2
3 3 $ . "$TESTDIR/narrow-library.sh"
4 4
5 5 #if tree
6 6 $ cat << EOF >> $HGRCPATH
7 7 > [experimental]
8 8 > treemanifest = 1
9 9 > EOF
10 10 #endif
11 11
12 12 create full repo
13 13
14 14 $ hg init master
15 15 $ cd master
16 16
17 17 $ mkdir inside
18 18 $ echo inside > inside/f1
19 19 $ mkdir outside
20 20 $ echo outside > outside/f1
21 21 $ hg ci -Aqm 'initial'
22 22
23 23 $ echo modified > inside/f1
24 24 $ hg ci -qm 'modify inside'
25 25
26 26 $ echo modified > outside/f1
27 27 $ hg ci -qm 'modify outside'
28 28
29 29 $ cd ..
30 30
31 31 (The lfs extension does nothing here, but this test ensures that its hook that
32 32 determines whether to add the lfs requirement, respects the narrow boundaries.)
33 33
34 34 $ hg --config extensions.lfs= clone --narrow ssh://user@dummy/master narrow \
35 35 > --include inside
36 36 requesting all changes
37 37 adding changesets
38 38 adding manifests
39 39 adding file changes
40 40 added 3 changesets with 2 changes to 1 files
41 41 new changesets *:* (glob)
42 42 updating to branch default
43 43 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
44 44 $ cd narrow
45 45
46 46 $ hg update -q 0
47 47
48 48 Can not modify dirstate outside
49 49
50 50 $ mkdir outside
51 51 $ touch outside/f1
52 52 $ hg debugwalk -v -I 'relglob:f1'
53 53 * matcher:
54 54 <includematcher includes='(?:|.*/)f1(?:/|$)'>
55 55 f inside/f1 inside/f1
56 56 $ hg add .
57 57 $ hg add outside/f1
58 58 abort: cannot track 'outside/f1' - it is outside the narrow clone
59 59 [255]
60 60 $ touch outside/f3
61 61 $ hg add outside/f3
62 62 abort: cannot track 'outside/f3' - it is outside the narrow clone
63 63 [255]
64 64
65 65 But adding a truly excluded file shouldn't count
66 66
67 67 $ hg add outside/f3 -X outside/f3
68 68
69 69 $ rm -r outside
70 70
71 71 Can modify dirstate inside
72 72
73 73 $ echo modified > inside/f1
74 74 $ touch inside/f3
75 75 $ hg add inside/f3
76 76 $ hg status
77 77 M inside/f1
78 78 A inside/f3
79 79 $ hg revert -qC .
80 80 $ rm inside/f3
81 81
82 82 Can commit changes inside. Leaves outside unchanged.
83 83
84 84 $ hg update -q 'desc("initial")'
85 85 $ echo modified2 > inside/f1
86 86 $ hg manifest --debug
87 87 4d6a634d5ba06331a60c29ee0db8412490a54fcd 644 inside/f1
88 88 7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !)
89 89 d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !)
90 90 $ hg commit -m 'modify inside/f1'
91 91 created new head
92 92 $ hg files -r .
93 93 inside/f1
94 94 $ hg manifest --debug
95 95 3f4197b4a11b9016e77ebc47fe566944885fd11b 644 inside/f1
96 96 7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !)
97 97 d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !)
98 98 Some filesystems (notably FAT/exFAT only store timestamps with 2
99 99 seconds of precision, so by sleeping for 3 seconds, we can ensure that
100 100 the timestamps of files stored by dirstate will appear older than the
101 101 dirstate file, and therefore we'll be able to get stable output from
102 102 debugdirstate. If we don't do this, the test can be slightly flaky.
103 103 $ sleep 3
104 104 $ hg status
105 105 $ hg debugdirstate --no-dates
106 106 n 644 10 set inside/f1
107
108 Can't commit empty files
109
110 $ touch inside/c; hg add inside/c; hg commit -qm _; hg verify -q
111 warning: revlog 'data/inside/c.i' not in fncache!
112 4: empty or missing inside/c
113 inside/c@4: manifest refers to unknown revision 000000000000
114 1 warnings encountered!
115 hint: run "hg debugrebuildfncache" to recover from corrupt fncache
116 2 integrity errors encountered!
117 (first damaged changeset appears to be 4)
118 [1]
General Comments 0
You need to be logged in to leave comments. Login now