##// END OF EJS Templates
tests: fold narrow treemanifest tests into main test file using testcases...
Augie Fackler -
r36101:dc014846 default
parent child Browse files
Show More
@@ -1,79 +1,89
1 #testcases flat tree
2
1 3 $ . "$TESTDIR/narrow-library.sh"
2 4
5 #if tree
6 $ cat << EOF >> $HGRCPATH
7 > [experimental]
8 > treemanifest = 1
9 > EOF
10 #endif
11
3 12 create full repo
4 13
5 14 $ hg init master
6 15 $ cd master
7 16
8 17 $ mkdir inside
9 18 $ echo inside > inside/f1
10 19 $ mkdir outside
11 20 $ echo outside > outside/f1
12 21 $ hg ci -Aqm 'initial'
13 22
14 23 $ echo modified > inside/f1
15 24 $ hg ci -qm 'modify inside'
16 25
17 26 $ echo modified > outside/f1
18 27 $ hg ci -qm 'modify outside'
19 28
20 29 $ cd ..
21 30
22 31 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
23 32 requesting all changes
24 33 adding changesets
25 34 adding manifests
26 35 adding file changes
27 36 added 3 changesets with 2 changes to 1 files
28 37 new changesets *:* (glob)
29 38 updating to branch default
30 39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
31 40 $ cd narrow
32 41
33 42 $ hg update -q 0
34 43
35 44 Can not modify dirstate outside
36 45
37 46 $ mkdir outside
38 47 $ touch outside/f1
39 48 $ hg debugwalk -I 'relglob:f1'
40 49 matcher: <includematcher includes='(?:(?:|.*/)f1(?:/|$))'>
41 50 f inside/f1 inside/f1
42 51 $ hg add outside/f1
43 52 abort: cannot track 'outside/f1' - it is outside the narrow clone
44 53 [255]
45 54 $ touch outside/f3
46 55 $ hg add outside/f3
47 56 abort: cannot track 'outside/f3' - it is outside the narrow clone
48 57 [255]
49 58 $ rm -r outside
50 59
51 60 Can modify dirstate inside
52 61
53 62 $ echo modified > inside/f1
54 63 $ touch inside/f3
55 64 $ hg add inside/f3
56 65 $ hg status
57 66 M inside/f1
58 67 A inside/f3
59 68 $ hg revert -qC .
60 69 $ rm inside/f3
61 70
62 71 Can commit changes inside. Leaves outside unchanged.
63 72
64 73 $ hg update -q 'desc("initial")'
65 74 $ echo modified2 > inside/f1
66 75 $ hg commit -m 'modify inside/f1'
67 76 created new head
68 77 $ hg files -r .
69 78 inside/f1
70 outside/f1
79 outside/f1 (flat !)
80 outside/ (tree !)
71 81 Some filesystems (notably FAT/exFAT only store timestamps with 2
72 82 seconds of precision, so by sleeping for 3 seconds, we can ensure that
73 83 the timestamps of files stored by dirstate will appear older than the
74 84 dirstate file, and therefore we'll be able to get stable output from
75 85 debugdirstate. If we don't do this, the test can be slightly flaky.
76 86 $ sleep 3
77 87 $ hg status
78 88 $ hg debugdirstate --nodates
79 89 n 644 10 set inside/f1
@@ -1,94 +1,104
1 #testcases flat tree
1 2
2 3 $ . "$TESTDIR/narrow-library.sh"
3 4
5 #if tree
6 $ cat << EOF >> $HGRCPATH
7 > [experimental]
8 > treemanifest = 1
9 > EOF
10 #endif
11
4 12 create full repo
5 13
6 14 $ hg init master
7 15 $ cd master
8 16 $ cat >> .hg/hgrc <<EOF
9 17 > [narrow]
10 18 > serveellipses=True
11 19 > EOF
12 20
13 21 $ mkdir inside
14 22 $ echo inside1 > inside/f1
15 23 $ echo inside2 > inside/f2
16 24 $ mkdir outside
17 25 $ echo outside1 > outside/f1
18 26 $ echo outside2 > outside/f2
19 27 $ hg ci -Aqm 'initial'
20 28
21 29 $ echo modified > inside/f1
22 30 $ hg ci -qm 'modify inside/f1'
23 31
24 32 $ hg update -q 0
25 33 $ echo modified > inside/f2
26 34 $ hg ci -qm 'modify inside/f2'
27 35
28 36 $ hg update -q 0
29 37 $ echo modified2 > inside/f1
30 38 $ hg ci -qm 'conflicting inside/f1'
31 39
32 40 $ hg update -q 0
33 41 $ echo modified > outside/f1
34 42 $ hg ci -qm 'modify outside/f1'
35 43
36 44 $ hg update -q 0
37 45 $ echo modified2 > outside/f1
38 46 $ hg ci -qm 'conflicting outside/f1'
39 47
40 48 $ cd ..
41 49
42 50 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
43 51 requesting all changes
44 52 adding changesets
45 53 adding manifests
46 54 adding file changes
47 55 added 6 changesets with 5 changes to 2 files (+4 heads)
48 56 new changesets *:* (glob)
49 57 updating to branch default
50 58 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 59 $ cd narrow
52 60
53 61 $ hg update -q 0
54 62
55 63 Can merge in when no files outside narrow spec are involved
56 64
57 65 $ hg update -q 'desc("modify inside/f1")'
58 66 $ hg merge 'desc("modify inside/f2")'
59 67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 68 (branch merge, don't forget to commit)
61 69 $ hg commit -m 'merge inside changes'
62 70
63 71 Can merge conflicting changes inside narrow spec
64 72
65 73 $ hg update -q 'desc("modify inside/f1")'
66 74 $ hg merge 'desc("conflicting inside/f1")' 2>&1 | egrep -v '(warning:|incomplete!)'
67 75 merging inside/f1
68 76 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
69 77 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
70 78 $ echo modified3 > inside/f1
71 79 $ hg resolve -m
72 80 (no more unresolved files)
73 81 $ hg commit -m 'merge inside/f1'
74 82
75 83 TODO: Can merge non-conflicting changes outside narrow spec
76 84
77 85 $ hg update -q 'desc("modify inside/f1")'
78 86 $ hg merge 'desc("modify outside/f1")'
79 abort: merge affects file 'outside/f1' outside narrow, which is not yet supported
87 abort: merge affects file 'outside/f1' outside narrow, which is not yet supported (flat !)
88 abort: merge affects file 'outside/' outside narrow, which is not yet supported (tree !)
80 89 (merging in the other direction may work)
81 90 [255]
82 91
83 92 $ hg update -q 'desc("modify outside/f1")'
84 93 $ hg merge 'desc("modify inside/f1")'
85 94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
86 95 (branch merge, don't forget to commit)
87 96 $ hg ci -m 'merge from inside to outside'
88 97
89 98 Refuses merge of conflicting outside changes
90 99
91 100 $ hg update -q 'desc("modify outside/f1")'
92 101 $ hg merge 'desc("conflicting outside/f1")'
93 abort: conflict in file 'outside/f1' is outside narrow clone
102 abort: conflict in file 'outside/f1' is outside narrow clone (flat !)
103 abort: conflict in file 'outside/' is outside narrow clone (tree !)
94 104 [255]
@@ -1,76 +1,84
1 #testcases flat tree
1 2
2 3 $ . "$TESTDIR/narrow-library.sh"
3 4
5 #if tree
6 $ cat << EOF >> $HGRCPATH
7 > [experimental]
8 > treemanifest = 1
9 > EOF
10 #endif
11
4 12 create full repo
5 13
6 14 $ hg init master
7 15 $ cd master
8 16
9 17 $ mkdir inside
10 18 $ echo inside > inside/f1
11 19 $ mkdir outside
12 20 $ echo outside > outside/f1
13 21 $ hg ci -Aqm 'initial'
14 22
15 23 $ echo modified > inside/f1
16 24 $ hg ci -qm 'modify inside'
17 25
18 26 $ echo modified > outside/f1
19 27 $ hg ci -qm 'modify outside'
20 28
21 29 $ cd ..
22 30
23 31 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
24 32 requesting all changes
25 33 adding changesets
26 34 adding manifests
27 35 adding file changes
28 36 added 3 changesets with 2 changes to 1 files
29 37 new changesets *:* (glob)
30 38 updating to branch default
31 39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 40 $ cd narrow
33 41
34 42 Can show patch touching paths outside
35 43
36 44 $ hg log -p
37 45 changeset: 2:* (glob)
38 46 tag: tip
39 47 user: test
40 48 date: Thu Jan 01 00:00:00 1970 +0000
41 49 summary: modify outside
42 50
43 51
44 52 changeset: 1:* (glob)
45 53 user: test
46 54 date: Thu Jan 01 00:00:00 1970 +0000
47 55 summary: modify inside
48 56
49 57 diff -r * -r * inside/f1 (glob)
50 58 --- a/inside/f1 Thu Jan 01 00:00:00 1970 +0000
51 59 +++ b/inside/f1 Thu Jan 01 00:00:00 1970 +0000
52 60 @@ -1,1 +1,1 @@
53 61 -inside
54 62 +modified
55 63
56 64 changeset: 0:* (glob)
57 65 user: test
58 66 date: Thu Jan 01 00:00:00 1970 +0000
59 67 summary: initial
60 68
61 69 diff -r 000000000000 -r * inside/f1 (glob)
62 70 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
63 71 +++ b/inside/f1 Thu Jan 01 00:00:00 1970 +0000
64 72 @@ -0,0 +1,1 @@
65 73 +inside
66 74
67 75
68 76 $ hg status --rev 1 --rev 2
69 77
70 78 Can show copies inside the narrow clone
71 79
72 80 $ hg cp inside/f1 inside/f2
73 81 $ hg diff --git
74 82 diff --git a/inside/f1 b/inside/f2
75 83 copy from inside/f1
76 84 copy to inside/f2
@@ -1,148 +1,163
1 #testcases flat tree
1 2
2 3 $ . "$TESTDIR/narrow-library.sh"
3 4
5 #if tree
6 $ cat << EOF >> $HGRCPATH
7 > [experimental]
8 > treemanifest = 1
9 > EOF
10 #endif
11
4 12 create full repo
5 13
6 14 $ hg init master
7 15 $ cd master
8 16 $ cat >> .hg/hgrc <<EOF
9 17 > [narrow]
10 18 > serveellipses=True
11 19 > EOF
12 20
13 21 $ mkdir inside
14 22 $ echo inside > inside/f1
15 23 $ mkdir outside
16 24 $ echo outside > outside/f1
17 25 $ hg ci -Aqm 'initial'
18 26
19 27 $ echo modified > inside/f1
20 28 $ hg ci -qm 'modify inside'
21 29
22 30 $ hg co -q 0
23 31 $ echo modified > outside/f1
24 32 $ hg ci -qm 'modify outside'
25 33
26 34 $ echo modified again >> outside/f1
27 35 $ hg ci -qm 'modify outside again'
28 36
29 37 $ cd ..
30 38
31 39 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
32 40 requesting all changes
33 41 adding changesets
34 42 adding manifests
35 43 adding file changes
36 44 added 3 changesets with 2 changes to 1 files (+1 heads)
37 45 new changesets *:* (glob)
38 46 updating to branch default
39 47 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 48 $ cd narrow
41 49 $ cat >> $HGRCPATH <<EOF
42 50 > [extensions]
43 51 > strip=
44 52 > EOF
45 53
46 54 Can strip and recover changesets affecting only files within narrow spec
47 55
48 56 $ hg co -r 'desc("modify inside")'
49 57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 58 $ rm -f $TESTTMP/narrow/.hg/strip-backup/*-backup.hg
51 59 $ hg strip .
52 60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
53 61 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
54 62 $ hg unbundle .hg/strip-backup/*-backup.hg
55 63 adding changesets
56 64 adding manifests
57 65 adding file changes
58 66 added 1 changesets with 1 changes to 1 files (+1 heads)
59 67 new changesets * (glob)
60 68 (run 'hg heads' to see heads, 'hg merge' to merge)
61 69
62 70 Can strip and recover changesets affecting files outside of narrow spec
63 71
64 72 $ hg co -r 'desc("modify outside")'
65 73 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 74 $ hg log -G -T '{rev} {desc}\n'
67 75 o 2 modify inside
68 76 |
69 77 | @ 1 modify outside again
70 78 |/
71 79 o 0 initial
72 80
73 81 $ hg debugdata -m 1
74 inside/f1\x004d6a634d5ba06331a60c29ee0db8412490a54fcd (esc)
75 outside/f1\x0084ba604d54dee1f13310ce3d4ac2e8a36636691a (esc)
82 inside/f1\x004d6a634d5ba06331a60c29ee0db8412490a54fcd (esc) (flat !)
83 outside/f1\x0084ba604d54dee1f13310ce3d4ac2e8a36636691a (esc) (flat !)
84 inside\x006a8bc41df94075d501f9740587a0c0e13c170dc5t (esc) (tree !)
85 outside\x00255c2627ebdd3c7dcaa6945246f9b9f02bd45a09t (esc) (tree !)
76 86
77 87 $ rm -f $TESTTMP/narrow/.hg/strip-backup/*-backup.hg
78 88 $ hg strip .
79 89 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
80 90 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
81 91 $ hg unbundle .hg/strip-backup/*-backup.hg
82 92 adding changesets
83 93 adding manifests
84 94 adding file changes
85 95 added 1 changesets with 0 changes to 0 files (+1 heads)
86 96 new changesets * (glob)
87 97 (run 'hg heads' to see heads, 'hg merge' to merge)
88 98 $ hg log -G -T '{rev} {desc}\n'
89 99 o 2 modify outside again
90 100 |
91 101 | o 1 modify inside
92 102 |/
93 103 @ 0 initial
94 104
95 105 Check that hash of file outside narrow spec got restored
96 106 $ hg debugdata -m 2
97 inside/f1\x004d6a634d5ba06331a60c29ee0db8412490a54fcd (esc)
98 outside/f1\x0084ba604d54dee1f13310ce3d4ac2e8a36636691a (esc)
107 inside/f1\x004d6a634d5ba06331a60c29ee0db8412490a54fcd (esc) (flat !)
108 outside/f1\x0084ba604d54dee1f13310ce3d4ac2e8a36636691a (esc) (flat !)
109 inside\x006a8bc41df94075d501f9740587a0c0e13c170dc5t (esc) (tree !)
110 outside\x00255c2627ebdd3c7dcaa6945246f9b9f02bd45a09t (esc) (tree !)
99 111
100 112 Also verify we can apply the bundle with 'hg pull':
101 113 $ hg co -r 'desc("modify inside")'
102 114 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 115 $ rm .hg/strip-backup/*-backup.hg
104 116 $ hg strip .
105 117 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 118 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
107 119 $ hg pull .hg/strip-backup/*-backup.hg
108 120 pulling from .hg/strip-backup/*-backup.hg (glob)
109 121 searching for changes
110 122 adding changesets
111 123 adding manifests
112 124 adding file changes
113 125 added 1 changesets with 1 changes to 1 files (+1 heads)
114 126 new changesets * (glob)
115 127 (run 'hg heads' to see heads, 'hg merge' to merge)
116 128
117 129 $ rm .hg/strip-backup/*-backup.hg
118 130 $ hg strip 0
119 131 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
120 132 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
121 133 $ hg incoming .hg/strip-backup/*-backup.hg
122 134 comparing with .hg/strip-backup/*-backup.hg (glob)
123 135 changeset: 0:* (glob)
124 136 user: test
125 137 date: Thu Jan 01 00:00:00 1970 +0000
126 138 summary: initial
127 139
128 changeset: 1:9e48d953700d
140 changeset: 1:9e48d953700d (flat !)
141 changeset: 1:3888164bccf0 (tree !)
129 142 user: test
130 143 date: Thu Jan 01 00:00:00 1970 +0000
131 144 summary: modify outside again
132 145
133 changeset: 2:f505d5e96aa8
146 changeset: 2:f505d5e96aa8 (flat !)
147 changeset: 2:40b66f95a209 (tree !)
134 148 tag: tip
135 parent: 0:a99f4d53924d
149 parent: 0:a99f4d53924d (flat !)
150 parent: 0:c2a5fabcca3c (tree !)
136 151 user: test
137 152 date: Thu Jan 01 00:00:00 1970 +0000
138 153 summary: modify inside
139 154
140 155 $ hg pull .hg/strip-backup/*-backup.hg
141 156 pulling from .hg/strip-backup/*-backup.hg (glob)
142 157 requesting all changes
143 158 adding changesets
144 159 adding manifests
145 160 adding file changes
146 161 added 3 changesets with 2 changes to 1 files (+1 heads)
147 162 new changesets *:* (glob)
148 163 (run 'hg heads' to see heads, 'hg merge' to merge)
@@ -1,355 +1,365
1 #testcases flat tree
1 2 $ . "$TESTDIR/narrow-library.sh"
2 3
4 #if tree
5 $ cat << EOF >> $HGRCPATH
6 > [experimental]
7 > treemanifest = 1
8 > EOF
9 #endif
10
3 11 $ hg init master
4 12 $ cd master
5 13 $ cat >> .hg/hgrc <<EOF
6 14 > [narrow]
7 15 > serveellipses=True
8 16 > EOF
9 17
10 18 $ mkdir inside
11 19 $ echo 'inside' > inside/f
12 20 $ hg add inside/f
13 21 $ hg commit -m 'add inside'
14 22
15 23 $ mkdir widest
16 24 $ echo 'widest' > widest/f
17 25 $ hg add widest/f
18 26 $ hg commit -m 'add widest'
19 27
20 28 $ mkdir outside
21 29 $ echo 'outside' > outside/f
22 30 $ hg add outside/f
23 31 $ hg commit -m 'add outside'
24 32
25 33 $ cd ..
26 34
27 35 narrow clone the inside file
28 36
29 37 $ hg clone --narrow ssh://user@dummy/master narrow --include inside
30 38 requesting all changes
31 39 adding changesets
32 40 adding manifests
33 41 adding file changes
34 42 added 2 changesets with 1 changes to 1 files
35 43 new changesets *:* (glob)
36 44 updating to branch default
37 45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 46 $ cd narrow
39 47 $ hg tracked
40 48 I path:inside
41 49 $ ls
42 50 inside
43 51 $ cat inside/f
44 52 inside
45 53 $ cd ..
46 54
47 55 add more upstream files which we will include in a wider narrow spec
48 56
49 57 $ cd master
50 58
51 59 $ mkdir wider
52 60 $ echo 'wider' > wider/f
53 61 $ hg add wider/f
54 62 $ echo 'widest v2' > widest/f
55 63 $ hg commit -m 'add wider, update widest'
56 64
57 65 $ echo 'widest v3' > widest/f
58 66 $ hg commit -m 'update widest v3'
59 67
60 68 $ echo 'inside v2' > inside/f
61 69 $ hg commit -m 'update inside'
62 70
63 71 $ mkdir outside2
64 72 $ echo 'outside2' > outside2/f
65 73 $ hg add outside2/f
66 74 $ hg commit -m 'add outside2'
67 75
68 76 $ echo 'widest v4' > widest/f
69 77 $ hg commit -m 'update widest v4'
70 78
71 79 $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
72 80 *: update widest v4 (glob)
73 81 *: add outside2 (glob)
74 82 *: update inside (glob)
75 83 *: update widest v3 (glob)
76 84 *: add wider, update widest (glob)
77 85 *: add outside (glob)
78 86 *: add widest (glob)
79 87 *: add inside (glob)
80 88
81 89 $ cd ..
82 90
83 91 Widen the narrow spec to see the wider file. This should not get the newly
84 92 added upstream revisions.
85 93
86 94 $ cd narrow
87 95 $ hg tracked --addinclude wider/f
88 96 comparing with ssh://user@dummy/master
89 97 searching for changes
90 98 no changes found
91 99 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
92 100 adding changesets
93 101 adding manifests
94 102 adding file changes
95 103 added 2 changesets with 1 changes to 1 files
96 104 new changesets *:* (glob)
97 105 $ hg tracked
98 106 I path:inside
99 107 I path:wider/f
100 108
101 109 Pull down the newly added upstream revision.
102 110
103 111 $ hg pull
104 112 pulling from ssh://user@dummy/master
105 113 searching for changes
106 114 adding changesets
107 115 adding manifests
108 116 adding file changes
109 117 added 4 changesets with 2 changes to 2 files
110 118 new changesets *:* (glob)
111 119 (run 'hg update' to get a working copy)
112 120 $ hg update -r 'desc("add wider")'
113 121 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
114 122 $ cat wider/f
115 123 wider
116 124
117 125 $ hg update -r 'desc("update inside")'
118 126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
119 127 $ cat wider/f
120 128 wider
121 129 $ cat inside/f
122 130 inside v2
123 131
124 132 $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
125 133 ...*: update widest v4 (glob)
126 134 *: update inside (glob)
127 135 ...*: update widest v3 (glob)
128 136 *: add wider, update widest (glob)
129 137 ...*: add outside (glob)
130 138 *: add inside (glob)
131 139
132 140 Check that widening with a newline fails
133 141
134 142 $ hg tracked --addinclude 'widest
135 143 > '
136 144 abort: newlines are not allowed in narrowspec paths
137 145 [255]
138 146
139 147 widen the narrow spec to include the widest file
140 148
141 149 $ hg tracked --addinclude widest
142 150 comparing with ssh://user@dummy/master
143 151 searching for changes
144 152 no changes found
145 153 saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-widen.hg (glob)
146 154 adding changesets
147 155 adding manifests
148 156 adding file changes
149 157 added 8 changesets with 7 changes to 3 files
150 158 new changesets *:* (glob)
151 159 $ hg tracked
152 160 I path:inside
153 161 I path:wider/f
154 162 I path:widest
155 163 $ hg update 'desc("add widest")'
156 164 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
157 165 $ cat widest/f
158 166 widest
159 167 $ hg update 'desc("add wider, update widest")'
160 168 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
161 169 $ cat wider/f
162 170 wider
163 171 $ cat widest/f
164 172 widest v2
165 173 $ hg update 'desc("update widest v3")'
166 174 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
167 175 $ cat widest/f
168 176 widest v3
169 177 $ hg update 'desc("update widest v4")'
170 178 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 179 $ cat widest/f
172 180 widest v4
173 181
174 182 $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
175 183 *: update widest v4 (glob)
176 184 ...*: add outside2 (glob)
177 185 *: update inside (glob)
178 186 *: update widest v3 (glob)
179 187 *: add wider, update widest (glob)
180 188 ...*: add outside (glob)
181 189 *: add widest (glob)
182 190 *: add inside (glob)
183 191
184 192 separate suite of tests: files from 0-10 modified in changes 0-10. This allows
185 193 more obvious precise tests tickling particular corner cases.
186 194
187 195 $ cd ..
188 196 $ hg init upstream
189 197 $ cd upstream
190 198 $ cat >> .hg/hgrc <<EOF
191 199 > [narrow]
192 200 > serveellipses=True
193 201 > EOF
194 202 $ for x in `$TESTDIR/seq.py 0 10`
195 203 > do
196 204 > mkdir d$x
197 205 > echo $x > d$x/f
198 206 > hg add d$x/f
199 207 > hg commit -m "add d$x/f"
200 208 > done
201 209 $ hg log -T "{node|short}: {desc}\n"
202 210 *: add d10/f (glob)
203 211 *: add d9/f (glob)
204 212 *: add d8/f (glob)
205 213 *: add d7/f (glob)
206 214 *: add d6/f (glob)
207 215 *: add d5/f (glob)
208 216 *: add d4/f (glob)
209 217 *: add d3/f (glob)
210 218 *: add d2/f (glob)
211 219 *: add d1/f (glob)
212 220 *: add d0/f (glob)
213 221
214 222 make narrow clone with every third node.
215 223
216 224 $ cd ..
217 225 $ hg clone --narrow ssh://user@dummy/upstream narrow2 --include d0 --include d3 --include d6 --include d9
218 226 requesting all changes
219 227 adding changesets
220 228 adding manifests
221 229 adding file changes
222 230 added 8 changesets with 4 changes to 4 files
223 231 new changesets *:* (glob)
224 232 updating to branch default
225 233 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 234 $ cd narrow2
227 235 $ hg tracked
228 236 I path:d0
229 237 I path:d3
230 238 I path:d6
231 239 I path:d9
232 240 $ hg verify
233 241 checking changesets
234 242 checking manifests
243 checking directory manifests (tree !)
235 244 crosschecking files in changesets and manifests
236 245 checking files
237 246 4 files, 8 changesets, 4 total revisions
238 247 $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
239 248 ...*: add d10/f (glob)
240 249 *: add d9/f (glob)
241 250 ...*: add d8/f (glob)
242 251 *: add d6/f (glob)
243 252 ...*: add d5/f (glob)
244 253 *: add d3/f (glob)
245 254 ...*: add d2/f (glob)
246 255 *: add d0/f (glob)
247 256 $ hg tracked --addinclude d1
248 257 comparing with ssh://user@dummy/upstream
249 258 searching for changes
250 259 no changes found
251 260 saved backup bundle to $TESTTMP/narrow2/.hg/strip-backup/*-widen.hg (glob)
252 261 adding changesets
253 262 adding manifests
254 263 adding file changes
255 264 added 9 changesets with 5 changes to 5 files
256 265 new changesets *:* (glob)
257 266 $ hg tracked
258 267 I path:d0
259 268 I path:d1
260 269 I path:d3
261 270 I path:d6
262 271 I path:d9
263 272 $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
264 273 ...*: add d10/f (glob)
265 274 *: add d9/f (glob)
266 275 ...*: add d8/f (glob)
267 276 *: add d6/f (glob)
268 277 ...*: add d5/f (glob)
269 278 *: add d3/f (glob)
270 279 ...*: add d2/f (glob)
271 280 *: add d1/f (glob)
272 281 *: add d0/f (glob)
273 282
274 283 Verify shouldn't claim the repo is corrupt after a widen.
275 284
276 285 $ hg verify
277 286 checking changesets
278 287 checking manifests
288 checking directory manifests (tree !)
279 289 crosschecking files in changesets and manifests
280 290 checking files
281 291 5 files, 9 changesets, 5 total revisions
282 292
283 293 Widening preserves parent of local commit
284 294
285 295 $ cd ..
286 296 $ hg clone -q --narrow ssh://user@dummy/upstream narrow3 --include d2 -r 2
287 297 $ cd narrow3
288 298 $ hg log -T "{if(ellipsis, '...')}{node|short}: {desc}\n"
289 299 *: add d2/f (glob)
290 300 ...*: add d1/f (glob)
291 301 $ hg pull -q -r 3
292 302 $ hg co -q tip
293 303 $ hg pull -q -r 4
294 304 $ echo local > d2/f
295 305 $ hg ci -m local
296 306 created new head
297 307 $ hg tracked -q --addinclude d0 --addinclude d9
298 308
299 309 Widening preserves bookmarks
300 310
301 311 $ cd ..
302 312 $ hg clone -q --narrow ssh://user@dummy/upstream narrow-bookmarks --include d4
303 313 $ cd narrow-bookmarks
304 314 $ echo local > d4/f
305 315 $ hg ci -m local
306 316 $ hg bookmarks bookmark
307 317 $ hg bookmarks
308 318 * bookmark 3:* (glob)
309 319 $ hg -q tracked --addinclude d2
310 320 $ hg bookmarks
311 321 * bookmark 5:* (glob)
312 322 $ hg log -r bookmark -T '{desc}\n'
313 323 local
314 324
315 325 Widening that fails can be recovered from
316 326
317 327 $ cd ..
318 328 $ hg clone -q --narrow ssh://user@dummy/upstream interrupted --include d0
319 329 $ cd interrupted
320 330 $ echo local > d0/f
321 331 $ hg ci -m local
322 332 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
323 333 2: local
324 334 ...1: add d10/f
325 335 0: add d0/f
326 336 $ hg bookmarks bookmark
327 337 $ hg --config hooks.pretxnchangegroup.bad=false tracked --addinclude d1
328 338 comparing with ssh://user@dummy/upstream
329 339 searching for changes
330 340 no changes found
331 341 saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/*-widen.hg (glob)
332 342 adding changesets
333 343 adding manifests
334 344 adding file changes
335 345 added 3 changesets with 2 changes to 2 files
336 346 transaction abort!
337 347 rollback completed
338 348 abort: pretxnchangegroup.bad hook exited with status 1
339 349 [255]
340 350 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
341 351 $ hg bookmarks
342 352 no bookmarks set
343 353 $ hg unbundle .hg/strip-backup/*-widen.hg
344 354 adding changesets
345 355 adding manifests
346 356 adding file changes
347 357 added 3 changesets with 2 changes to 1 files
348 358 new changesets *:* (glob)
349 359 (run 'hg update' to get a working copy)
350 360 $ hg log -T "{if(ellipsis, '...')}{rev}: {desc}\n"
351 361 2: local
352 362 ...1: add d10/f
353 363 0: add d0/f
354 364 $ hg bookmarks
355 365 * bookmark 2:* (glob)
@@ -1,358 +1,374
1 #testcases flat tree
2
1 3 $ . "$TESTDIR/narrow-library.sh"
2 4
5 #if tree
6 $ cat << EOF >> $HGRCPATH
7 > [experimental]
8 > treemanifest = 1
9 > EOF
10 #endif
11
3 12 $ hg init master
4 13 $ cd master
5 14 $ cat >> .hg/hgrc <<EOF
6 15 > [narrow]
7 16 > serveellipses=True
8 17 > EOF
9 18 $ for x in `$TESTDIR/seq.py 0 10`
10 19 > do
11 20 > mkdir d$x
12 21 > echo $x > d$x/f
13 22 > hg add d$x/f
14 23 > hg commit -m "add d$x/f"
15 24 > done
16 25 $ hg log -T "{node|short}: {desc}\n"
17 26 *: add d10/f (glob)
18 27 *: add d9/f (glob)
19 28 *: add d8/f (glob)
20 29 *: add d7/f (glob)
21 30 *: add d6/f (glob)
22 31 *: add d5/f (glob)
23 32 *: add d4/f (glob)
24 33 *: add d3/f (glob)
25 34 *: add d2/f (glob)
26 35 *: add d1/f (glob)
27 36 *: add d0/f (glob)
28 37 $ cd ..
29 38
30 39 Error if '.' or '..' are in the directory to track.
31 40 $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf
32 41 requesting all changes
33 42 abort: "." and ".." are not allowed in narrowspec paths
34 43 [255]
35 44 $ hg clone --narrow ssh://user@dummy/master foo --include asdf/..
36 45 requesting all changes
37 46 abort: "." and ".." are not allowed in narrowspec paths
38 47 [255]
39 48 $ hg clone --narrow ssh://user@dummy/master foo --include a/./c
40 49 requesting all changes
41 50 abort: "." and ".." are not allowed in narrowspec paths
42 51 [255]
43 52
44 53 Names with '.' in them are OK.
45 54 $ hg clone --narrow ssh://user@dummy/master $RANDOM --include a/.b/c
46 55 requesting all changes
47 56 adding changesets
48 57 adding manifests
49 58 adding file changes
50 59 added 1 changesets with 0 changes to 0 files
51 60 new changesets * (glob)
52 61 updating to branch default
53 62 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 63
55 64 Test repo with local changes
56 65 $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6
57 66 requesting all changes
58 67 adding changesets
59 68 adding manifests
60 69 adding file changes
61 70 added 6 changesets with 3 changes to 3 files
62 71 new changesets *:* (glob)
63 72 updating to branch default
64 73 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 74 $ cd narrow-local-changes
66 75 $ cat >> $HGRCPATH << EOF
67 76 > [experimental]
68 77 > evolution=createmarkers
69 78 > EOF
70 79 $ echo local change >> d0/f
71 80 $ hg ci -m 'local change to d0'
72 81 $ hg co '.^'
73 82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 83 $ echo local change >> d3/f
75 84 $ hg ci -m 'local hidden change to d3'
76 85 created new head
77 86 $ hg ci --amend -m 'local change to d3'
78 87 $ hg tracked --removeinclude d0
79 88 comparing with ssh://user@dummy/master
80 89 searching for changes
81 90 looking for local changes to affected paths
82 91 The following changeset(s) or their ancestors have local changes not on the remote:
83 92 * (glob)
84 93 abort: local changes found
85 94 (use --force-delete-local-changes to ignore)
86 95 [255]
87 96 Check that nothing was removed by the failed attempts
88 97 $ hg tracked
89 98 I path:d0
90 99 I path:d3
91 100 I path:d6
92 101 $ hg files
93 102 d0/f
94 103 d3/f
95 104 d6/f
96 105 $ find *
97 106 d0
98 107 d0/f
99 108 d3
100 109 d3/f
101 110 d6
102 111 d6/f
103 112 $ hg verify -q
104 113 Force deletion of local changes
105 114 $ hg log -T "{node|short}: {desc} {outsidenarrow}\n"
106 115 *: local change to d3 (glob)
107 116 *: local change to d0 (glob)
108 117 *: add d10/f outsidenarrow (glob)
109 118 *: add d6/f (glob)
110 119 *: add d5/f outsidenarrow (glob)
111 120 *: add d3/f (glob)
112 121 *: add d2/f outsidenarrow (glob)
113 122 *: add d0/f (glob)
114 123 $ hg tracked --removeinclude d0 --force-delete-local-changes
115 124 comparing with ssh://user@dummy/master
116 125 searching for changes
117 126 looking for local changes to affected paths
118 127 The following changeset(s) or their ancestors have local changes not on the remote:
119 128 * (glob)
120 129 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
121 130 deleting data/d0/f.i
131 deleting meta/d0/00manifest.i (tree !)
122 132 $ hg log -T "{node|short}: {desc} {outsidenarrow}\n"
123 133 *: local change to d3 (glob)
124 134 *: add d10/f outsidenarrow (glob)
125 135 *: add d6/f (glob)
126 136 *: add d5/f outsidenarrow (glob)
127 137 *: add d3/f (glob)
128 138 *: add d2/f outsidenarrow (glob)
129 139 *: add d0/f outsidenarrow (glob)
130 140 Can restore stripped local changes after widening
131 141 $ hg tracked --addinclude d0 -q
132 142 $ hg unbundle .hg/strip-backup/*-narrow.hg -q
133 143 $ hg --hidden co -r 'desc("local change to d0")' -q
134 144 $ cat d0/f
135 145 0
136 146 local change
137 147 Pruned commits affecting removed paths should not prevent narrowing
138 148 $ hg co '.^'
139 149 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 150 $ hg debugobsolete `hg log -T '{node}' -r 'desc("local change to d0")'`
141 151 obsoleted 1 changesets
142 152 $ hg tracked --removeinclude d0
143 153 comparing with ssh://user@dummy/master
144 154 searching for changes
145 155 looking for local changes to affected paths
146 156 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
147 157 deleting data/d0/f.i
158 deleting meta/d0/00manifest.i (tree !)
148 159 Updates off of stripped commit if necessary
149 160 $ hg co -r 'desc("local change to d3")' -q
150 161 $ echo local change >> d6/f
151 162 $ hg ci -m 'local change to d6'
152 163 $ hg tracked --removeinclude d3 --force-delete-local-changes
153 164 comparing with ssh://user@dummy/master
154 165 searching for changes
155 166 looking for local changes to affected paths
156 167 The following changeset(s) or their ancestors have local changes not on the remote:
157 168 * (glob)
158 169 * (glob)
159 170 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
160 171 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
161 172 deleting data/d3/f.i
173 deleting meta/d3/00manifest.i (tree !)
162 174 $ hg log -T '{desc}\n' -r .
163 175 add d10/f
164 176 Updates to nullid if necessary
165 177 $ hg tracked --addinclude d3 -q
166 178 $ hg co null -q
167 179 $ mkdir d3
168 180 $ echo local change > d3/f
169 181 $ hg add d3/f
170 182 $ hg ci -m 'local change to d3'
171 183 created new head
172 184 $ hg tracked --removeinclude d3 --force-delete-local-changes
173 185 comparing with ssh://user@dummy/master
174 186 searching for changes
175 187 looking for local changes to affected paths
176 188 The following changeset(s) or their ancestors have local changes not on the remote:
177 189 * (glob)
178 190 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
179 191 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
180 192 deleting data/d3/f.i
193 deleting meta/d3/00manifest.i (tree !)
181 194 $ hg id
182 195 000000000000
183 196 $ cd ..
184 197
185 198 Can remove last include, making repo empty
186 199 $ hg clone --narrow ssh://user@dummy/master narrow-empty --include d0 -r 5
187 200 adding changesets
188 201 adding manifests
189 202 adding file changes
190 203 added 2 changesets with 1 changes to 1 files
191 204 new changesets *:* (glob)
192 205 updating to branch default
193 206 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
194 207 $ cd narrow-empty
195 208 $ hg tracked --removeinclude d0
196 209 comparing with ssh://user@dummy/master
197 210 searching for changes
198 211 looking for local changes to affected paths
199 212 deleting data/d0/f.i
213 deleting meta/d0/00manifest.i (tree !)
200 214 $ hg tracked
201 215 $ hg files
202 216 [1]
203 217 $ test -d d0
204 218 [1]
205 219 Do some work in the empty clone
206 220 $ hg diff --change .
207 221 $ hg branch foo
208 222 marked working directory as branch foo
209 223 (branches are permanent and global, did you want a bookmark?)
210 224 $ hg ci -m empty
211 225 $ hg pull -q
212 226 Can widen the empty clone
213 227 $ hg tracked --addinclude d0
214 228 comparing with ssh://user@dummy/master
215 229 searching for changes
216 230 no changes found
217 231 saved backup bundle to $TESTTMP/narrow-empty/.hg/strip-backup/*-widen.hg (glob)
218 232 adding changesets
219 233 adding manifests
220 234 adding file changes
221 235 added 3 changesets with 1 changes to 1 files
222 236 new changesets *:* (glob)
223 237 $ hg tracked
224 238 I path:d0
225 239 $ hg files
226 240 d0/f
227 241 $ find *
228 242 d0
229 243 d0/f
230 244 $ cd ..
231 245
232 246 TODO(martinvonz): test including e.g. d3/g and then removing it once
233 247 https://bitbucket.org/Google/narrowhg/issues/6 is fixed
234 248
235 249 $ hg clone --narrow ssh://user@dummy/master narrow --include d0 --include d3 --include d6 --include d9
236 250 requesting all changes
237 251 adding changesets
238 252 adding manifests
239 253 adding file changes
240 254 added 8 changesets with 4 changes to 4 files
241 255 new changesets *:* (glob)
242 256 updating to branch default
243 257 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
244 258 $ cd narrow
245 259 $ hg tracked
246 260 I path:d0
247 261 I path:d3
248 262 I path:d6
249 263 I path:d9
250 264 $ hg tracked --removeinclude d6
251 265 comparing with ssh://user@dummy/master
252 266 searching for changes
253 267 looking for local changes to affected paths
254 268 deleting data/d6/f.i
269 deleting meta/d6/00manifest.i (tree !)
255 270 $ hg tracked
256 271 I path:d0
257 272 I path:d3
258 273 I path:d9
259 274 $ hg debugrebuildfncache
260 275 fncache already up to date
261 276 $ find *
262 277 d0
263 278 d0/f
264 279 d3
265 280 d3/f
266 281 d9
267 282 d9/f
268 283 $ hg verify -q
269 284 $ hg tracked --addexclude d3/f
270 285 comparing with ssh://user@dummy/master
271 286 searching for changes
272 287 looking for local changes to affected paths
273 288 deleting data/d3/f.i
274 289 $ hg tracked
275 290 I path:d0
276 291 I path:d3
277 292 I path:d9
278 293 X path:d3/f
279 294 $ hg debugrebuildfncache
280 295 fncache already up to date
281 296 $ find *
282 297 d0
283 298 d0/f
284 299 d9
285 300 d9/f
286 301 $ hg verify -q
287 302 $ hg tracked --addexclude d0
288 303 comparing with ssh://user@dummy/master
289 304 searching for changes
290 305 looking for local changes to affected paths
291 306 deleting data/d0/f.i
307 deleting meta/d0/00manifest.i (tree !)
292 308 $ hg tracked
293 309 I path:d3
294 310 I path:d9
295 311 X path:d0
296 312 X path:d3/f
297 313 $ hg debugrebuildfncache
298 314 fncache already up to date
299 315 $ find *
300 316 d9
301 317 d9/f
302 318
303 319 Make a 15 of changes to d9 to test the path without --verbose
304 320 (Note: using regexes instead of "* (glob)" because if the test fails, it
305 321 produces more sensible diffs)
306 322 $ hg tracked
307 323 I path:d3
308 324 I path:d9
309 325 X path:d0
310 326 X path:d3/f
311 327 $ for x in `$TESTDIR/seq.py 1 15`
312 328 > do
313 329 > echo local change >> d9/f
314 330 > hg commit -m "change $x to d9/f"
315 331 > done
316 332 $ hg tracked --removeinclude d9
317 333 comparing with ssh://user@dummy/master
318 334 searching for changes
319 335 looking for local changes to affected paths
320 336 The following changeset(s) or their ancestors have local changes not on the remote:
321 337 ^[0-9a-f]{12}$ (re)
322 338 ^[0-9a-f]{12}$ (re)
323 339 ^[0-9a-f]{12}$ (re)
324 340 ^[0-9a-f]{12}$ (re)
325 341 ^[0-9a-f]{12}$ (re)
326 342 ^[0-9a-f]{12}$ (re)
327 343 ^[0-9a-f]{12}$ (re)
328 344 ^[0-9a-f]{12}$ (re)
329 345 ^[0-9a-f]{12}$ (re)
330 346 ^[0-9a-f]{12}$ (re)
331 347 ...and 5 more, use --verbose to list all
332 348 abort: local changes found
333 349 (use --force-delete-local-changes to ignore)
334 350 [255]
335 351 Now test it *with* verbose.
336 352 $ hg tracked --removeinclude d9 --verbose
337 353 comparing with ssh://user@dummy/master
338 354 searching for changes
339 355 looking for local changes to affected paths
340 356 The following changeset(s) or their ancestors have local changes not on the remote:
341 357 ^[0-9a-f]{12}$ (re)
342 358 ^[0-9a-f]{12}$ (re)
343 359 ^[0-9a-f]{12}$ (re)
344 360 ^[0-9a-f]{12}$ (re)
345 361 ^[0-9a-f]{12}$ (re)
346 362 ^[0-9a-f]{12}$ (re)
347 363 ^[0-9a-f]{12}$ (re)
348 364 ^[0-9a-f]{12}$ (re)
349 365 ^[0-9a-f]{12}$ (re)
350 366 ^[0-9a-f]{12}$ (re)
351 367 ^[0-9a-f]{12}$ (re)
352 368 ^[0-9a-f]{12}$ (re)
353 369 ^[0-9a-f]{12}$ (re)
354 370 ^[0-9a-f]{12}$ (re)
355 371 ^[0-9a-f]{12}$ (re)
356 372 abort: local changes found
357 373 (use --force-delete-local-changes to ignore)
358 374 [255]
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now