JERUSALEM — The two main Palestinian factions, Fatah and Hamas, announced Wednesday that they were putting aside years of bitter rivalry to create an interim unity government and hold elections within a year, a surprise move that promised to reshape the diplomatic landscape of the Middle East.