YOU knew it was coming, but it was still painful to watch. To be ritually humiliated by the big boys from London is part of a Scottish Labour leader’s burden.

But seeing John McDonnell give Richard Leonard a metaphorical wedgie, not once but twice, was eye-popping stuff even for the Edinburgh Fringe.

In March, Mr Leonard had been steadfast on independence. “We will not agree to a second independence referendum,” he told the BBC. “A Labour government... would not agree to a second independence referendum emerging from either the Scottish Parliament or from any other quarters.”

The shadow chancellor had other ideas. “It will be for the Scottish Parliament and the Scottish people to decide that. We would not block something like that,” he declared.

READ MORE: Scottish Labour in meltdown over stance on second independence referendum

His bulldozing of Scottish party policy came out of the blue for Mr Leonard and his MSPs, but did not appear to be a casual remark. As one unhappy Labour MSP puts it: “John McDonnell doesn’t make mistakes.”

Mr McDonnell had doubtless been reading Monday’s poll from Lord Ashcroft which showed a lead for Yes.

It also found that, despite leading Scottish Labour for more 600 days, around a third of voters have no opinion on Mr Leonard. They don’t know who he is. Just 11 per cent felt positively about the colourless crusader, less than Nigel Farage managed.

With an election nigh, Mr McDonnell thought it best to show Nicola Sturgeon some love in case her MPs are needed to help a minority Labour government.

In contrast, Mr Leonard, who has only ornamental value, and who in May helped Scottish Labour descend to 9% of the vote, was an afterthought.

The backlash to Mr McDonnell’s intervention from some Scottish Labour MPs and MSPs has been spectacular.

Some are truly angry at the party dropping its do-or-die Unionism, some are using the issue in a proxy war against Jeremy Corbyn, and many are furious at being the ‘branch office’ again.

It has been an ungodly mess. The impression given to voters is that Scottish Labour can’t tie its own shoelaces.

Mr Leonard, an authority-free zone, is confirmed as a washout of a leader.

READ MORE: John McDonnell ignores Richard Leonard and keeps independence referendum on the table

A poor, pale, watery creature, he gets sloshed around by forces he can’t control, like a jellyfish in a bucket.

Most of his MSPs have tried to dig in, refusing to accept the policy change, but they’re on a hiding to nothing.

For despite all the mess, the needless aggro, the terrible PR, Mr McDonnell’s position is the realistic one. You can’t say Naw forever. At some point, Labour and the other Unionist parties will have to square up to a second referendum.

I believe Mr McDonnell when he says he doesn’t want a referendum, and would oppose independence if another vote took place. As Brexit has shown, losing a referendum not only costs the UK leader of the day their job, it also wrecks the government’s agenda.

Mr McDonnell and Mr Corbyn haven’t come this close to power only to watch their plans being shoved aside by years of negotiations over independence.

They could, like Theresa May and the Scottish Labour ultras, simply refuse to engage, and risk watching support for Yes climb ever higher. Or they could grasp the thistle and start thinking about what to do while the odds are still 50-50.

True, this is all far sooner than Labour would want. But the five years since 2014 have been extraordinarily turbulent. To paraphrase Facebook’s staff motto, politics now moves fast and breaks things. If the public mood is moving towards Yes, it cannot be ignored.

There were also clues to how Labour - or the Tories - might respond this week.

Mr McDonnell gave one. “Let us demonstrate as a Labour government what we can do to transform people’s lives. And if, after a few years, people want to come back and say they want to test the water on an independence referendum, well fair enough.”

In other words, a Labour government would play for time. It wouldn’t block Indyref2, but nor would it hurry it along. It would hope the public mood shifted after the Tories were ousted and Labour had a chance to promote federalism.

That “after a few years” is their version of Mrs May’s “now is not the time”.

Of course, Nicola Sturgeon would not wait a few years. The First Minister would ask for a vote in 2020, citing her “cast-iron” mandate and brandishing a vote by SNP and Green MSPs. Here too, Labour has a get-out. Shadow Scottish minister Paul Sweeney says there is no mandate as those MSPs were elected on different manifestos. He has a point.

READ MORE: Labour 'would not block a second Scottish independence referendum'

The SNP position was conditional on “a significant and material change in circumstances... such as Scotland being taken out of the EU against our will.”

But the Greens suggested a 1m-signature petition as the trigger.

Their manifesto said: “If a new referendum is to happen, it should come about by the will of the people, and not be driven by calculations of party political advantage.” It’s a muddled, mongrel mandate that would let a UK government parry the FM until 2021.

Which brings us to the next line of Unionist defence. Mr McDonnell, Mr Sweeney, the Labour MSP Neil Findlay and former Scottish Secretary David Mundell all identified the Holyrood election as pivotal this week. Mr Mundell described it as a referendum on whether to have a second referendum.

Hinting at tactical alliances, he said: “All Unionist forces have to think about how best to organise themselves for that election.” He and the Labour politicians also said that if the SNP and Greens wanted to claim a clear and decisive mandate for Indyref2, they should fight the election on an explicit commitment to holding it. That would focus Unionist opposition.

If the SNP and Greens won a majority there would then be haggling over the form of the referendum. There would be no rerun of 2014, when Alex Salmond was given a relatively free hand. Mr Sweeney said Labour would block a Yes/No question and include a federal UK in a multiple-choice ballot. A Tory government might offer more devolution as a third way. David Cameron only insisted on a binary question in 2014 because he thought the Unionists would romp it. The calculation is very different now. The UK government would be looking for ways to split the Yes vote.

If, after all that, voters did back independence, there’s another catch. Mr Findlay, who was Mr Corbyn’s point man in Scotland for a while, said that whatever deal emerged from the negotiations between Edinburgh and London should go to “a confirmatory vote of the Scottish people”. As some SNP MPs have warned, Ms Sturgeon would struggle to object as she supports a confirmatory vote on Brexit.

So while Mr McDonnell’s comments are significant, they are not the whole story. Obstacles are being piled up in Ms Sturgeon’s path - the 2021 election, a novel form of referendum, a confirmatory vote. While Unionists would only have to prevail in one of the three to scupper her plans, the First Minister would have to win the treble.