Debian Codegraph @

tests/test-amend-subrepo.t

raw
1 #testcases obsstore-off obsstore-on
2
3 $ cat << EOF >> $HGRCPATH
4 > [extensions]
5 > amend =
6 > EOF
7
8 #if obsstore-on
9 $ cat << EOF >> $HGRCPATH
10 > [experimental]
11 > evolution.createmarkers = True
12 > EOF
13 #endif
14
15 Prepare parent repo
16 -------------------
17
18 $ hg init r
19 $ cd r
20
21 $ echo a > a
22 $ hg ci -Am0
23 adding a
24
25 Link first subrepo
26 ------------------
27
28 $ echo 's = s' >> .hgsub
29 $ hg add .hgsub
30 $ hg init s
31
32 amend without .hgsub
33
34 $ hg amend s
35 abort: can't commit subrepos without .hgsub
36 [255]
37
38 amend with subrepo
39
40 $ hg amend
41 saved backup bundle to * (glob) (obsstore-off !)
42 $ hg status --change .
43 A .hgsub
44 A .hgsubstate
45 A a
46 $ cat .hgsubstate
47 0000000000000000000000000000000000000000 s
48
49 Update subrepo
50 --------------
51
52 add new commit to be amended
53
54 $ echo a >> a
55 $ hg ci -m1
56
57 amend with dirty subrepo
58
59 $ echo a >> s/a
60 $ hg add -R s
61 adding s/a
62 $ hg amend
63 abort: uncommitted changes in subrepository "s"
64 (use --subrepos for recursive commit)
65 [255]
66
67 amend with modified subrepo
68
69 $ hg ci -R s -m0
70 $ hg amend
71 saved backup bundle to * (glob) (obsstore-off !)
72 $ hg status --change .
73 M .hgsubstate
74 M a
75 $ cat .hgsubstate
76 f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s
77
78 revert subrepo change
79
80 $ hg up -R s -q null
81 $ hg amend
82 saved backup bundle to * (glob) (obsstore-off !)
83 $ hg status --change .
84 M a
85
86 Link another subrepo
87 --------------------
88
89 add new commit to be amended
90
91 $ echo b >> b
92 $ hg ci -qAm2
93
94 also checks if non-subrepo change is included
95
96 $ echo a >> a
97
98 amend with another subrepo
99
100 $ hg init t
101 $ echo b >> t/b
102 $ hg ci -R t -Am0
103 adding b
104 $ echo 't = t' >> .hgsub
105 $ hg amend
106 saved backup bundle to * (glob) (obsstore-off !)
107 $ hg status --change .
108 M .hgsub
109 M .hgsubstate
110 M a
111 A b
112 $ cat .hgsubstate
113 0000000000000000000000000000000000000000 s
114 bfb1a4fb358498a9533dabf4f2043d94162f1fcd t
115
116 Unlink one subrepo
117 ------------------
118
119 add new commit to be amended
120
121 $ echo a >> a
122 $ hg ci -m3
123
124 $ echo 't = t' > .hgsub
125
126 --interactive won't silently ignore dirty subrepos
127
128 $ echo modified > t/b
129 $ hg amend --interactive --config ui.interactive=True
130 abort: uncommitted changes in subrepository "t"
131 [255]
132 $ hg amend --interactive --config ui.interactive=True --config ui.commitsubrepos=True
133 abort: uncommitted changes in subrepository "t"
134 [255]
135
136 $ hg -R t revert -q --all --no-backup
137
138 amend with one subrepo dropped
139
140 $ hg amend
141 saved backup bundle to * (glob) (obsstore-off !)
142 $ hg status --change .
143 M .hgsub
144 M .hgsubstate
145 M a
146 $ cat .hgsubstate
147 bfb1a4fb358498a9533dabf4f2043d94162f1fcd t
148
149 Unlink subrepos completely
150 --------------------------
151
152 add new commit to be amended
153
154 $ echo a >> a
155 $ hg ci -m3
156
157 amend with .hgsub removed
158
159 $ hg rm .hgsub
160 $ hg amend
161 saved backup bundle to * (glob) (obsstore-off !)
162 $ hg status --change .
163 M a
164 R .hgsub
165 R .hgsubstate
166
167 broken repositories will refuse to push
168
169 #if obsstore-off
170 $ hg up -q -C 2
171 #else
172 $ hg up -q -C 6
173 #endif
174 $ echo c >> t/b
175 $ hg amend -q -R t
176
177 $ hg init ../dest
178 $ hg init ../dest/t
179 $ hg init ../dest/s
180 $ hg push -q ../dest
181 abort: subrepo 't' is hidden in revision 04aa62396ec6 (obsstore-on !)
182 abort: subrepo 't' not found in revision 04aa62396ec6 (obsstore-off !)
183 [255]
184
185 ... unless forced
186
187 $ hg push --force -q ../dest
188 $ hg verify -R ../dest
189 checking changesets
190 checking manifests
191 crosschecking files in changesets and manifests
192 checking files
193 checking dirstate
194 checked 5 changesets with 12 changes to 4 files
195 checking subrepo links
196 subrepo 't' not found in revision 04aa62396ec6
197 subrepo 't' not found in revision 6bce99600681
198
199 $ cd ..