I have an old source code repository which I would like to share publicly. However, it includes some files which I do not want to share. I would like to create a new VCS branch with these files removed entirely from its history, but would like to keep as much of the rest of the history as possible intact, esp. commit messages, and ideally also commit dates.
It is currently a Bazaar repository, although I expect to convert it and publish it as a Git repository using bzr-git. Solutions for either VCS are acceptable.
I imagine a hypothetical tool "regenerate-repo" which would recreate the repository, one commit at a time, while executing an arbitrary command between each commit, eg:
regenerate-repo $old_repo $new_repo --each-time='rm -R private-folder'
Does such a tool exist, or is there another way to accomplish my goal?