svn-all-fast-export / svn2git

:octopus: A fast-import based converter for an svn repo to git repos
GNU General Public License v3.0
262 stars 100 forks source link

Resuming import deletes commits made to git repository not from the import itself #69

Open jruark-logility opened 5 years ago

jruark-logility commented 5 years ago

I am trying to export a Subversion repository that contains multiple releases of a product into a new git repository. Along the way I am also export code from a different system (Serena PVCS) by hand into this same repository. My goal has been to do the following:

I do the manual commits by cloning the bare repository svn2git created into a new folder. I check out master, add all my code from PVCS, commit, and push back into the bare repository.

However, when I run svn2git the second time to load the next batch of revisions, it actually completely wipes out my manual commits in the bare repository, as if they had never existed. They don't show up in the git log within the bare repository. When I "git pull" in my local copy I created for adding the code from PVCS, it reports divergence of the remote branch and does a commit for a merge.

Each time I run svn2git it seems to wipe out my commits that didn't come from subversion.

Am I doing the process incorrectly, or is this just not possible, to run svn2git into what is essentially an existing repository that has code from other commits?

eeijlar commented 5 years ago

I expect that it is overwriting your repository. What you could try is to create a new rule on your second run which doesn't write the commits to master, instead it writes them to a new branch:

match /Project/trunk
  repository my-existing-repo
  branch second-run
end match

Then, you could merge the second-run branch onto master after you have done your second svn2git run.

git checkout master
git merge second-run
jruark-logility commented 5 years ago

Thanks for the suggestion. Unfortunately, even when writing to a different branch, it wiped out my non-Subversion commits on master during the execution of svn2git. I also tried the following:

When I inspected the bare repository, the pvcs branch was gone along with its commit, as if I'd never done it. And this with my svn2git configuration never referencing the pvcs branch.

Is there any way to tell svn2git to leave existing (non-Subversion-related) branches alone?

Thanks again!

jruark-logility commented 5 years ago

I don't understand git fast import very well, but I see in the source it uses the --force option and there's no way to disable that. Might my plan of putting all my PVCS code on a separate branch during the migration work if I didn't have --force in there?

jruark-logility commented 5 years ago

Sigh, nevermind my last two comments. Doing git log --all | grep pvcs, looking for my branch name, didn't work because piping the log output doesn't include the branch names on the commit hash lines. Odds. Anyway, my branch and commit are still there, just not in the place in the log history that I expect them to be. But I think that's probably ok. No replies needed for now, as I'll explore my approach of loading my PVCS history into its own branch.