diff --git a/infinitepush/__init__.py b/infinitepush/__init__.py --- a/infinitepush/__init__.py +++ b/infinitepush/__init__.py @@ -267,6 +267,12 @@ newpushkeyhandler.params = origpushkeyhandler.params bundle2.parthandlermapping['pushkey'] = newpushkeyhandler + orighandlephasehandler = bundle2.parthandlermapping['phase-heads'] + newphaseheadshandler = lambda *args, **kwargs: \ + bundle2handlephases(orighandlephasehandler, *args, **kwargs) + newphaseheadshandler.params = orighandlephasehandler.params + bundle2.parthandlermapping['phase-heads'] = newphaseheadshandler + wrapfunction(localrepo.localrepository, 'listkeys', localrepolistkeys) wireproto.commands['lookup'] = ( _lookupwrap(wireproto.commands['lookup'][0]), 'key') @@ -1006,9 +1012,11 @@ cgparams = part.params # If we're not dumping all parts into the new bundle, we need to - # alert the future pushkey handler to skip the part. + # alert the future pushkey and phase-heads handler to skip + # the part. if not handleallparts: op.records.add(scratchbranchparttype + '_skippushkey', True) + op.records.add(scratchbranchparttype + '_skipphaseheads', True) elif part.type == scratchbookmarksparttype: # Save this for later processing. Details below. scratchbookpart = part @@ -1221,6 +1229,11 @@ op.reply.newpart('pushkey', mandatoryparams=params.iteritems()) def bundle2pushkey(orig, op, part): + '''Wrapper of bundle2.handlepushkey() + + The only goal is to skip calling the original function if flag is set. + It's set if infinitepush push is happening. + ''' if op.records[scratchbranchparttype + '_skippushkey']: if op.reply is not None: rpart = op.reply.newpart('reply:pushkey') @@ -1230,6 +1243,18 @@ return orig(op, part) +def bundle2handlephases(orig, op, part): + '''Wrapper of bundle2.handlephases() + + The only goal is to skip calling the original function if flag is set. + It's set if infinitepush push is happening. + ''' + + if op.records[scratchbranchparttype + '_skipphaseheads']: + return + + return orig(op, part) + def _asyncsavemetadata(root, nodes): '''starts a separate process that fills metadata for the nodes