##// END OF EJS Templates
checkheads: check successors for new heads in both missing and common...
Pierre-Yves David -
r17548:eaa5fcc5 default
parent child Browse files
Show More
@@ -264,6 +264,8 b' def checkheads(repo, remote, outgoing, r'
264 error = None
264 error = None
265 unsynced = False
265 unsynced = False
266 allmissing = set(outgoing.missing)
266 allmissing = set(outgoing.missing)
267 allfuturecommon = set(c.node() for c in repo.set('%ld', outgoing.common))
268 allfuturecommon.update(allmissing)
267 for branch, heads in headssum.iteritems():
269 for branch, heads in headssum.iteritems():
268 if heads[0] is None:
270 if heads[0] is None:
269 # Maybe we should abort if we push more that one head
271 # Maybe we should abort if we push more that one head
@@ -293,11 +295,11 b' def checkheads(repo, remote, outgoing, r'
293 # more tricky for unsynced changes.
295 # more tricky for unsynced changes.
294 newhs = set()
296 newhs = set()
295 for nh in candidate_newhs:
297 for nh in candidate_newhs:
296 if repo[nh].phase() <= phases.public:
298 if nh in repo and repo[nh].phase() <= phases.public:
297 newhs.add(nh)
299 newhs.add(nh)
298 else:
300 else:
299 for suc in obsolete.anysuccessors(repo.obsstore, nh):
301 for suc in obsolete.anysuccessors(repo.obsstore, nh):
300 if suc != nh and suc in allmissing:
302 if suc != nh and suc in allfuturecommon:
301 break
303 break
302 else:
304 else:
303 newhs.add(nh)
305 newhs.add(nh)
@@ -286,7 +286,7 b' bookmark, not all outgoing changes:'
286 $ hg book -r tip add-bar
286 $ hg book -r tip add-bar
287 Note: this push *must* push only a single changeset, as that's the point
287 Note: this push *must* push only a single changeset, as that's the point
288 of this test.
288 of this test.
289 $ hg push -B add-foo
289 $ hg push -B add-foo --traceback
290 pushing to http://localhost:$HGPORT/
290 pushing to http://localhost:$HGPORT/
291 searching for changes
291 searching for changes
292 remote: adding changesets
292 remote: adding changesets
@@ -159,3 +159,115 b' Push should abort on new head'
159 abort: push creates new remote head d7d41ccbd4de!
159 abort: push creates new remote head d7d41ccbd4de!
160 (did you forget to merge? use push -f to force)
160 (did you forget to merge? use push -f to force)
161 [255]
161 [255]
162
163
164
165 Both precursors and successors are already know remotely. Descendant adds heads
166 ===============================================================================
167
168 setup. (The obsolete marker is known locally only
169
170 $ cd ..
171 $ rm -rf local
172 $ hg clone remote local
173 updating to branch default
174 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
175 $ cd local
176 $ mkcommit old
177 old already tracked!
178 nothing changed
179 [1]
180 $ hg up -q '.^'
181 $ mkcommit new
182 created new head
183 $ hg push -f
184 pushing to $TESTTMP/remote
185 searching for changes
186 adding changesets
187 adding manifests
188 adding file changes
189 added 1 changesets with 1 changes to 1 files (+1 heads)
190 $ mkcommit desc1
191 $ hg up -q '.^'
192 $ mkcommit desc2
193 created new head
194 $ hg debugobsolete `getid old` `getid new`
195 $ hg glog --hidden
196 @ 5fe37041cc2b (draft) add desc2
197 |
198 | o a3ef1d111c5f (draft) add desc1
199 |/
200 o 71e3228bffe1 (draft) add new
201 |
202 | x c70b08862e08 (draft) add old
203 |/
204 o b4952fcf48cf (public) add base
205
206 $ hg glog --hidden -R ../remote
207 o 71e3228bffe1 (draft) add new
208 |
209 | o c70b08862e08 (draft) add old
210 |/
211 @ b4952fcf48cf (public) add base
212
213 $ cp -r ../remote ../backup2
214
215 Push should not warn about adding new heads. We create one, but we'll delete
216 one anyway.
217
218 $ hg push
219 pushing to $TESTTMP/remote
220 searching for changes
221 adding changesets
222 adding manifests
223 adding file changes
224 added 2 changesets with 2 changes to 2 files (+1 heads)
225
226
227 Remote head is unknown but obsoleted by a local changeset
228 =========================================================
229
230 setup
231
232 $ rm -fr ../remote
233 $ cp -r ../backup1 ../remote
234 $ cd ..
235 $ rm -rf local
236 $ hg clone remote local -r 0
237 adding changesets
238 adding manifests
239 adding file changes
240 added 1 changesets with 1 changes to 1 files
241 updating to branch default
242 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
243 $ cd local
244 $ mkcommit new
245 $ hg -R ../remote id --debug -r tip
246 c70b08862e0838ea6d7c59c85da2f1ed6c8d67da tip
247 $ hg id --debug -r tip
248 71e3228bffe1886550777233d6c97bb5a6b2a650 tip
249 $ hg debugobsolete c70b08862e0838ea6d7c59c85da2f1ed6c8d67da 71e3228bffe1886550777233d6c97bb5a6b2a650
250 $ hg glog --hidden
251 @ 71e3228bffe1 (draft) add new
252 |
253 o b4952fcf48cf (public) add base
254
255 $ hg glog --hidden -R ../remote
256 o c70b08862e08 (draft) add old
257 |
258 @ b4952fcf48cf (public) add base
259
260
261 Push should not complain about new heads.
262
263 It should not complain about "unsynced remote changes!" either but that's not
264 handled yet.
265
266 $ hg push --traceback
267 pushing to $TESTTMP/remote
268 searching for changes
269 note: unsynced remote changes!
270 adding changesets
271 adding manifests
272 adding file changes
273 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