##// END OF EJS Templates
test-obsolete-checkheads: fix on windows
Patrick Mezard -
r17564:6d0efc80 default
parent child Browse files
Show More
@@ -1,272 +1,272 b''
1 1 Check that obsolete properly strip heads
2 2 $ cat > obs.py << EOF
3 3 > import mercurial.obsolete
4 4 > mercurial.obsolete._enabled = True
5 5 > EOF
6 6 $ cat >> $HGRCPATH << EOF
7 7 > [phases]
8 8 > # public changeset are not obsolete
9 9 > publish=false
10 10 > [ui]
11 11 > logtemplate='{node|short} ({phase}) {desc|firstline}\n'
12 12 > [extensions]
13 13 > graphlog=
14 14 > EOF
15 15 $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH
16 16 $ mkcommit() {
17 17 > echo "$1" > "$1"
18 18 > hg add "$1"
19 19 > hg ci -m "add $1"
20 20 > }
21 21 $ getid() {
22 22 > hg id --debug -ir "desc('$1')"
23 23 > }
24 24
25 25
26 26 $ hg init remote
27 27 $ cd remote
28 28 $ mkcommit base
29 29 $ hg phase --public .
30 30 $ cd ..
31 31 $ cp -r remote base
32 32 $ hg clone remote local
33 33 updating to branch default
34 34 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
35 35 $ cd local
36 36
37 37 New head replaces old head
38 38 ==========================
39 39
40 40 setup
41 41
42 42 $ mkcommit old
43 43 $ hg push
44 pushing to $TESTTMP/remote
44 pushing to $TESTTMP/remote (glob)
45 45 searching for changes
46 46 adding changesets
47 47 adding manifests
48 48 adding file changes
49 49 added 1 changesets with 1 changes to 1 files
50 50 $ hg up -q '.^'
51 51 $ mkcommit new
52 52 created new head
53 53 $ hg debugobsolete `getid old` `getid new`
54 54 $ hg glog --hidden
55 55 @ 71e3228bffe1 (draft) add new
56 56 |
57 57 | x c70b08862e08 (draft) add old
58 58 |/
59 59 o b4952fcf48cf (public) add base
60 60
61 61 $ cp -r ../remote ../backup1
62 62
63 63 old exists remotely as draft. It is obsoleted by new that we now push.
64 64 Push should not warn about creating new head
65 65
66 66 $ hg push
67 pushing to $TESTTMP/remote
67 pushing to $TESTTMP/remote (glob)
68 68 searching for changes
69 69 adding changesets
70 70 adding manifests
71 71 adding file changes
72 72 added 1 changesets with 1 changes to 1 files (+1 heads)
73 73
74 74 old head is now public (public local version)
75 75 =============================================
76 76
77 77 setup
78 78
79 79 $ rm -fr ../remote
80 80 $ cp -r ../backup1 ../remote
81 81 $ hg -R ../remote phase --public c70b08862e08
82 82 $ hg pull -v
83 pulling from $TESTTMP/remote
83 pulling from $TESTTMP/remote (glob)
84 84 searching for changes
85 85 no changes found
86 86 $ hg glog --hidden
87 87 @ 71e3228bffe1 (draft) add new
88 88 |
89 89 | o c70b08862e08 (public) add old
90 90 |/
91 91 o b4952fcf48cf (public) add base
92 92
93 93
94 94 Abort: old will still be an head because it's public.
95 95
96 96 $ hg push
97 pushing to $TESTTMP/remote
97 pushing to $TESTTMP/remote (glob)
98 98 searching for changes
99 99 abort: push creates new remote head 71e3228bffe1!
100 100 (did you forget to merge? use push -f to force)
101 101 [255]
102 102
103 103 old head is now public (public remote version)
104 104 ==============================================
105 105
106 106 TODO: Not implemented yet.
107 107
108 108 # setup
109 109 #
110 110 # $ rm -fr ../remote
111 111 # $ cp -r ../backup1 ../remote
112 112 # $ hg -R ../remote phase --public c70b08862e08
113 113 # $ hg phase --draft --force c70b08862e08
114 114 # $ hg glog --hidden
115 115 # @ 71e3228bffe1 (draft) add new
116 116 # |
117 117 # | x c70b08862e08 (draft) add old
118 118 # |/
119 119 # o b4952fcf48cf (public) add base
120 120 #
121 121 #
122 122 #
123 123 # Abort: old will still be an head because it's public.
124 124 #
125 125 # $ hg push
126 126 # pushing to $TESTTMP/remote
127 127 # searching for changes
128 128 # abort: push creates new remote head 71e3228bffe1!
129 129 # (did you forget to merge? use push -f to force)
130 130 # [255]
131 131
132 132 old head is obsolete but replacement is not pushed
133 133 ==================================================
134 134
135 135 setup
136 136
137 137 $ rm -fr ../remote
138 138 $ cp -r ../backup1 ../remote
139 139 $ hg phase --draft --force '(0::) - 0'
140 140 $ hg up -q '.^'
141 141 $ mkcommit other
142 142 created new head
143 143 $ hg glog --hidden
144 144 @ d7d41ccbd4de (draft) add other
145 145 |
146 146 | o 71e3228bffe1 (draft) add new
147 147 |/
148 148 | x c70b08862e08 (draft) add old
149 149 |/
150 150 o b4952fcf48cf (public) add base
151 151
152 152
153 153 old exists remotely as draft. It is obsoleted by new but we don't push new.
154 154 Push should abort on new head
155 155
156 156 $ hg push -r 'desc("other")'
157 pushing to $TESTTMP/remote
157 pushing to $TESTTMP/remote (glob)
158 158 searching for changes
159 159 abort: push creates new remote head d7d41ccbd4de!
160 160 (did you forget to merge? use push -f to force)
161 161 [255]
162 162
163 163
164 164
165 165 Both precursors and successors are already know remotely. Descendant adds heads
166 166 ===============================================================================
167 167
168 168 setup. (The obsolete marker is known locally only
169 169
170 170 $ cd ..
171 171 $ rm -rf local
172 172 $ hg clone remote local
173 173 updating to branch default
174 174 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 175 $ cd local
176 176 $ mkcommit old
177 177 old already tracked!
178 178 nothing changed
179 179 [1]
180 180 $ hg up -q '.^'
181 181 $ mkcommit new
182 182 created new head
183 183 $ hg push -f
184 pushing to $TESTTMP/remote
184 pushing to $TESTTMP/remote (glob)
185 185 searching for changes
186 186 adding changesets
187 187 adding manifests
188 188 adding file changes
189 189 added 1 changesets with 1 changes to 1 files (+1 heads)
190 190 $ mkcommit desc1
191 191 $ hg up -q '.^'
192 192 $ mkcommit desc2
193 193 created new head
194 194 $ hg debugobsolete `getid old` `getid new`
195 195 $ hg glog --hidden
196 196 @ 5fe37041cc2b (draft) add desc2
197 197 |
198 198 | o a3ef1d111c5f (draft) add desc1
199 199 |/
200 200 o 71e3228bffe1 (draft) add new
201 201 |
202 202 | x c70b08862e08 (draft) add old
203 203 |/
204 204 o b4952fcf48cf (public) add base
205 205
206 206 $ hg glog --hidden -R ../remote
207 207 o 71e3228bffe1 (draft) add new
208 208 |
209 209 | o c70b08862e08 (draft) add old
210 210 |/
211 211 @ b4952fcf48cf (public) add base
212 212
213 213 $ cp -r ../remote ../backup2
214 214
215 215 Push should not warn about adding new heads. We create one, but we'll delete
216 216 one anyway.
217 217
218 218 $ hg push
219 pushing to $TESTTMP/remote
219 pushing to $TESTTMP/remote (glob)
220 220 searching for changes
221 221 adding changesets
222 222 adding manifests
223 223 adding file changes
224 224 added 2 changesets with 2 changes to 2 files (+1 heads)
225 225
226 226
227 227 Remote head is unknown but obsoleted by a local changeset
228 228 =========================================================
229 229
230 230 setup
231 231
232 232 $ rm -fr ../remote
233 233 $ cp -r ../backup1 ../remote
234 234 $ cd ..
235 235 $ rm -rf local
236 236 $ hg clone remote local -r 0
237 237 adding changesets
238 238 adding manifests
239 239 adding file changes
240 240 added 1 changesets with 1 changes to 1 files
241 241 updating to branch default
242 242 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 243 $ cd local
244 244 $ mkcommit new
245 245 $ hg -R ../remote id --debug -r tip
246 246 c70b08862e0838ea6d7c59c85da2f1ed6c8d67da tip
247 247 $ hg id --debug -r tip
248 248 71e3228bffe1886550777233d6c97bb5a6b2a650 tip
249 249 $ hg debugobsolete c70b08862e0838ea6d7c59c85da2f1ed6c8d67da 71e3228bffe1886550777233d6c97bb5a6b2a650
250 250 $ hg glog --hidden
251 251 @ 71e3228bffe1 (draft) add new
252 252 |
253 253 o b4952fcf48cf (public) add base
254 254
255 255 $ hg glog --hidden -R ../remote
256 256 o c70b08862e08 (draft) add old
257 257 |
258 258 @ b4952fcf48cf (public) add base
259 259
260 260
261 261 Push should not complain about new heads.
262 262
263 263 It should not complain about "unsynced remote changes!" either but that's not
264 264 handled yet.
265 265
266 266 $ hg push --traceback
267 pushing to $TESTTMP/remote
267 pushing to $TESTTMP/remote (glob)
268 268 searching for changes
269 269 adding changesets
270 270 adding manifests
271 271 adding file changes
272 272 added 1 changesets with 1 changes to 1 files (+1 heads)
General Comments 0
You need to be logged in to leave comments. Login now