Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jruark-logility opened this issue Mar 25, 2019 · 4 comments
Labels

Comments

@jruark-logility
Copy link

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:

  • Use svn2git to export revisions 1-1000 (for example) into the new git repostory, which loads "release 1" of our product into git.
  • Manually commit the code for "release 1" of our other product from PVCS into git.
  • Use svn2git to export revisions 1001-2000 into the repository, which loads "release 2" of our product into git.
  • Manually commit the code for "release 2" from PVCS.

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
Copy link

eeijlar commented Mar 26, 2019

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
Copy link
Author

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:

  • Run svn2git for some of the Subversion revisions (putting trunk into master)
  • Branch master into a new branch, pvcs
  • Commit code into the pvcs branch and pushed that to the bare repository (and then confirmed the commit was in the bare repository on the pvcs branch)
  • Run svn2git on more Subversion revisions

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
Copy link
Author

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants