translate / translate-project

The Translate Project
4 stars 3 forks source link

Migrate Virtaal to Git #2119

Closed julen closed 12 years ago

julen commented 12 years ago

This bug is for tracking the migration of Virtaal to Git.

julen commented 12 years ago

I'd say here we want to import trunk + virtaal-0.6 and virtaal-0.7 branches.

julen commented 12 years ago

For Virtaal we are interested on migrating:

julen commented 12 years ago

I'm working on this, and based on Friedel's script we were trying to exclude SVN directories that refer to branches that we were not interested on importing.

That is something like: svn2git https://translate.svn.sourceforge.net/svnroot/translate/src/ --trunk trunk/virtaal --exclude [Pp]ootle- --exclude django- --exclude mozootle- --exclude toolkit- --exclude translate --metadata --revision 7125 --verbose

But that doesn't exclude any tags or branches. Looking at svn2git code, I can see that only excludes directories that are within (unless other names specified) trunk/, branches/, or tags/:

  unless exclude.empty?
    # Add exclude paths to the command line; some versions of git support
    # this for fetch only, later also for init.
    regex = []
    unless rootistrunk
      regex << "#{trunk}[/]" unless trunk.nil?
      regex << "#{tags}[/][^/]+[/]" unless tags.nil?
      regex << "#{branches}[/][^/]+[/]" unless branches.nil?
    end
    regex = '^(?:' + regex.join('|') + ')(?:' + exclude.join('|') + ')'
    cmd += "'--ignore-paths=#{regex}'"
  end

Since that will never match 'branches/foo-x.y/', we could adjust that to exclude those branches.

But even if the branches are not imported, I think the commits that affect the excluded branches/tags will be there (will have to check later), so we'll need to manually rewrite the commits' history to remove the affecting commits by using git-filter-branch.

julen commented 12 years ago

While doing the import an error is raised: error: Untracked working tree file '.cvsignore' would be overwritten by merge.

At that point, issuing a 'git reset' would make the working tree clean.

Then to finish the import, just run 'svn2git --rebase', which will continue with the process of converting tags and branches into git.

'git branch' and 'git tag' should now list imported branches and tags. Remove them as needed with 'git branch -d ' and 'git tag -d '.

To push to the remote repository, first add the remote (say it has 'origin' as its name) and then push: git push -u origin --all git push -u origin --tag

The first command will push all the branches and the second one all the tags.

julen commented 12 years ago

Created attachment 819

Migration rules file

julen commented 12 years ago

Repository live at https://github.com/translate/virtaal/