def bundle2pushkey(orig, op, part): replacements = dict(sum([record.items() for record in op.records[rebaseparttype]], [])) namespace = pushkey.decode(part.params['namespace']) if namespace == 'phases': key = pushkey.decode(part.params['key']) part.params['key'] = pushkey.encode(replacements.get(key, key)) if namespace == 'bookmarks': new = pushkey.decode(part.params['new']) part.params['new'] = pushkey.encode(replacements.get(new, new)) serverbin = op.repo._bookmarks.get(part.params['key']) clienthex = pushkey.decode(part.params['old']) if serverbin and clienthex: cl = op.repo.changelog revserver = cl.rev(serverbin) revclient = cl.rev(bin(clienthex)) if revclient in cl.ancestors([revserver]): # if the client's bookmark origin is an lagging behind the # server's location for that bookmark (usual for pushrebase) # then update the old location to match the real location # # TODO: We would prefer to only do this for pushrebase pushes # but that isn't straightforward so we just do it always here. # This forbids moving bookmarks backwards from clients. part.params['old'] = pushkey.encode(hex(serverbin)) return orig(op, part)
def bundle2pushkey(orig, op, part): replacements = dict(sum([record.items() for record in op.records[rebaseparttype]], [])) namespace = pushkey.decode(part.params['namespace']) if namespace == 'phases': key = pushkey.decode(part.params['key']) part.params['key'] = pushkey.encode(replacements.get(key, key)) if namespace == 'bookmarks': new = pushkey.decode(part.params['new']) part.params['new'] = pushkey.encode(replacements.get(new, new)) return orig(op, part)