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