278 _obsserialise(repo._obssubrels, tmp) |
278 _obsserialise(repo._obssubrels, tmp) |
279 return {'relations': base64.b64encode(tmp.getvalue())} |
279 return {'relations': base64.b64encode(tmp.getvalue())} |
280 |
280 |
281 pushkey.register('obsolete', pushobsolete, listobsolete) |
281 pushkey.register('obsolete', pushobsolete, listobsolete) |
282 |
282 |
|
283 ### Discovery wrapping |
|
284 ############################# |
|
285 |
|
286 class blist(list, object): |
|
287 """silly class to have non False but empty list""" |
|
288 |
|
289 def __nonzero__(self): |
|
290 return bool(len(self.orig)) |
|
291 |
|
292 def wrapfindcommonoutgoing(orig, repo, *args, **kwargs): |
|
293 """wrap mercurial.discovery.findcommonoutgoing to remove extinct changeset |
|
294 |
|
295 Such excluded changeset are removed from excluded and will *not* appear |
|
296 are excluded secret changeset. |
|
297 """ |
|
298 outgoing = orig(repo, *args, **kwargs) |
|
299 orig = outgoing.excluded |
|
300 outgoing.excluded = blist(n for n in orig if not repo[n].extinct()) |
|
301 # when no revision is specified (push everything) a shortcut is taken when |
|
302 # nothign was exclude. taking this code path when extinct changeset have |
|
303 # been excluded leads to repository corruption. |
|
304 outgoing.excluded.orig = orig |
|
305 return outgoing |
|
306 |
283 ### New commands |
307 ### New commands |
284 ############################# |
308 ############################# |
285 |
309 |
286 |
310 |
287 def cmddebugobsolete(ui, repo, subject, object): |
311 def cmddebugobsolete(ui, repo, subject, object): |
305 return res |
329 return res |
306 |
330 |
307 def uisetup(ui): |
331 def uisetup(ui): |
308 extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc) |
332 extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc) |
309 extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc) |
333 extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc) |
|
334 extensions.wrapfunction(discovery, 'findcommonoutgoing', wrapfindcommonoutgoing) |
310 |
335 |
311 ### serialisation |
336 ### serialisation |
312 ############################# |
337 ############################# |
313 |
338 |
314 def _obsserialise(obssubrels, flike): |
339 def _obsserialise(obssubrels, flike): |