--- a/hgext/obsolete.py Tue Apr 24 15:56:31 2012 +0200
+++ b/hgext/obsolete.py Wed Apr 25 18:15:56 2012 +0200
@@ -280,6 +280,30 @@
pushkey.register('obsolete', pushobsolete, listobsolete)
+### Discovery wrapping
+#############################
+
+class blist(list, object):
+ """silly class to have non False but empty list"""
+
+ def __nonzero__(self):
+ return bool(len(self.orig))
+
+def wrapfindcommonoutgoing(orig, repo, *args, **kwargs):
+ """wrap mercurial.discovery.findcommonoutgoing to remove extinct changeset
+
+ Such excluded changeset are removed from excluded and will *not* appear
+ are excluded secret changeset.
+ """
+ outgoing = orig(repo, *args, **kwargs)
+ orig = outgoing.excluded
+ outgoing.excluded = blist(n for n in orig if not repo[n].extinct())
+ # when no revision is specified (push everything) a shortcut is taken when
+ # nothign was exclude. taking this code path when extinct changeset have
+ # been excluded leads to repository corruption.
+ outgoing.excluded.orig = orig
+ return outgoing
+
### New commands
#############################
@@ -307,6 +331,7 @@
def uisetup(ui):
extensions.wrapcommand(commands.table, "update", wrapmayobsoletewc)
extensions.wrapcommand(commands.table, "pull", wrapmayobsoletewc)
+ extensions.wrapfunction(discovery, 'findcommonoutgoing', wrapfindcommonoutgoing)
### serialisation
#############################