The repository already supports to go back to an old version. Check the repository attributes where it shows the version and let you choose to go back.
Why do you want to save every version as a new file if the repository can return any specified version to you?
Cheers