His party is divided and traumatised by Brexit, his leadership has been written off by most of the press, his attempts to reshape the Labour Party have ended in failure and he faces a prime minister that he trails by 20 points when voters are asked to pick who they want to see in 10 Downing Street. Poor Jeremy Corbyn – spring 2017 was no time for him to fight a general election.

In parliament’s bars, Labour MPs compared majorities in the manner of Monty Python’s Yorkshiremen: “5,000? I’d love 5,000! I’ve got 3,000! I’m doomed!” The only Labour MPs with anything resembling optimism about the contest were those planning to run for the party leadership afterwards. The front-runner – at least as far as the Parliamentary Labour Party was concerned – was Yvette Cooper, and her main opposition was thought likely to come from Chuka Umunna. Both candidates had campaign teams and were canvassing the opinion of MPs they thought might survive Labour’s reckoning. Corbyn’s close allies, themselves fearing the worst, planned to support Emily Thornberry, the shadow foreign secretary, as they thought she was the most Corbyn-friendly candidate with a hope of securing enough support to stand.

We all know what happened next. Cooper did not become Labour leader. Umunna isn’t even a Labour MP any more. While Thornberry remains a formidable contender in a future leadership election, she may well now be the most Corbynsceptic candidate with a hope of securing enough support to make the ballot – and not because her politics have noticeably shifted. Corbyn’s unexpected advance in the 2017 election reshaped the party.

It is that election – and Corbyn’s success in turning what looked like an inevitable Tory landslide to a near draw in the popular vote and the destruction of Theresa May’s domestic agenda – that has been a source of continuous comfort to the leader’s inner circle. As Diane Abbott told the shadow cabinet this week, “In the run-up to the 2017 election, some Labour MPs were crying in my office as if it were a f***ing funeral, saying Jeremy should stand down, then they all got re-elected with increased majorities.” Now, facing what the polls suggest will be a similarly formidable challenge, Corbynite true believers once again hope that they can emerge from their second encounter with the electorate as they did the first – strengthened. Are they right?

While the parallels between Labour in the spring of 2017 and the winter of 2019 are striking, they are not exact. In 2017, Labour had suffered a bruising series of votes as parliament voted to trigger Article 50. The overwhelming majority of Labour MPs backed voting to honour the result of the 2016 referendum. Now the majority of Labour MPs want a referendum in order to overturn the 2016 result. John McDonnell, who is at the heart of Corbynism’s success, has led the call for a “final say” vote – clashing with his old friend Jeremy Corbyn, who preferred an election sooner rather than later. The strength of the Corbyn-McDonnell relationship recalls the bond between David Cameron and George Osborne. It has been a central part of Labour’s most effective moments under Corbyn. Now it is fraying dangerously, just as the party gears up for an election

Corbyn knows the type of election he wants to contest: big rallies designed to generate clips for social media and feel-good stories for the local broadcast news and local papers, which will form the majority of his media appearances. His manifesto will be heavy on radical proposals to reshape the British economy and low on Brexit. He will hope that televised debates – an arena he excels in, as opposed to parliament, where he struggles – will expose Boris Johnson, who performed poorly in the TV hustings for the Conservative leadership.

Yet he faces a Conservative campaign with greater unity of purpose, message discipline and policy cohesion than the one he dismantled two years ago. Boris Johnson has ruthlessly used the powers of his office to shut down every political debate that might cause the Tory party pain. He has reversed spending cuts to schools, the NHS and the police in order to make it more difficult for Labour. Part of Corbyn’s 2017 success was that he ran an excellent campaign – but it was also that Theresa May ran a very bad one.

The task facing Johnson is not easy, however, despite his lead in the polls. May began the 2017 campaign with an approval rating not seen in British politics since Tony Blair’s triumph in 1997. She ended it with an approval rating that was as bad as Blair’s when he stood down in 2007, but her salvation lay in the collapse of Ukip. Johnson starts the campaign leading one of the most unpopular governments in history – and with Nigel Farage’s rebranded Ukip, the Brexit Party, still very much alive. Corbyn’s unexpectedly strong performance in 2017 was a story of Labour resurgence. In 2019 he might manage one based on Conservative collapse.

But the main reason why this election may not resemble the last is Jo Swinson, the Liberal Democrat leader. Neither Johnson nor Corbyn know if she will hurt or help them.

In 2017, the Lib Dem campaign was blighted by questions about Tim Farron’s illiberal views on homosexuality and abortion. That allowed Corbyn to emerge as the only hope for liberal and progressive voters – and helped keep Conservative MPs in the south-west in their jobs. In this election there will be a Liberal Democrat leader campaigning on the front foot for the first time since 2010 – and no one knows for certain which party has most to fear from that.