##// END OF EJS Templates
tests: add test showing that paths outside narrowspec are not added...
Martin von Zweigbergk -
r39972:277a6fb4 default
parent child Browse files
Show More
@@ -1,107 +1,108 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 $ hg add .
56 57 $ hg add outside/f1
57 58 abort: cannot track 'outside/f1' - it is outside the narrow clone
58 59 [255]
59 60 $ touch outside/f3
60 61 $ hg add outside/f3
61 62 abort: cannot track 'outside/f3' - it is outside the narrow clone
62 63 [255]
63 64
64 65 But adding a truly excluded file shouldn't count
65 66
66 67 $ hg add outside/f3 -X outside/f3
67 68
68 69 $ rm -r outside
69 70
70 71 Can modify dirstate inside
71 72
72 73 $ echo modified > inside/f1
73 74 $ touch inside/f3
74 75 $ hg add inside/f3
75 76 $ hg status
76 77 M inside/f1
77 78 A inside/f3
78 79 $ hg revert -qC .
79 80 $ rm inside/f3
80 81
81 82 Can commit changes inside. Leaves outside unchanged.
82 83
83 84 $ hg update -q 'desc("initial")'
84 85 $ echo modified2 > inside/f1
85 86 $ hg manifest --debug
86 87 4d6a634d5ba06331a60c29ee0db8412490a54fcd 644 inside/f1
87 88 7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !)
88 89 d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !)
89 90 $ hg commit -m 'modify inside/f1'
90 91 created new head
91 92 $ hg files -r .
92 93 inside/f1
93 94 outside/f1 (flat !)
94 95 outside/ (tree !)
95 96 $ hg manifest --debug
96 97 3f4197b4a11b9016e77ebc47fe566944885fd11b 644 inside/f1
97 98 7fb3bb6356d28d4dc352c5ba52d7350a81b6bd46 644 outside/f1 (flat !)
98 99 d0f2f706468ab0e8bec7af87446835fb1b13511b 755 d outside/ (tree !)
99 100 Some filesystems (notably FAT/exFAT only store timestamps with 2
100 101 seconds of precision, so by sleeping for 3 seconds, we can ensure that
101 102 the timestamps of files stored by dirstate will appear older than the
102 103 dirstate file, and therefore we'll be able to get stable output from
103 104 debugdirstate. If we don't do this, the test can be slightly flaky.
104 105 $ sleep 3
105 106 $ hg status
106 107 $ hg debugdirstate --no-dates
107 108 n 644 10 set inside/f1
General Comments 0
You need to be logged in to leave comments. Login now