Jump to content
bastos71230

Fast Export / Import to Git

Recommended Posts

Hi there !

I would like to export a repository from Plastic SCM and import it to a git Repo.

I did an export with 

$ cm fast-export repo@XXX.XXX.XXX.XXX:XXXX repo.fe.01

The file repo.fe.01 was well created (see attachment), then I do this into my new git repository: 

$ cat repo.fe.01 | git fast-import --force --stats

But here is the error output : 

fatal: Branch name doesn't conform to GIT standards: refs/heads/master-Mise en place notifs push
fast-import: dumping crash report to .git/fast_import_crash_9708

So I tried to normailize all my branches names (see attachment repo.fe.01.NEW) but then here is the new error output : 

fatal: Branch name doesn't conform to GIT standards: refs/heads/master
fast-import: dumping crash report to .git/fast_import_crash_10168

 

Any Ideas ?

Regards

Share this post


Link to post
Share on other sites

I solved this using graphic interface instead of command lines : in te branch explorer of your repo -> right click on main branch (I renamed it "master" just in case) -> Sync with git

That worked fine for me, it keeps all the history.

Share this post


Link to post
Share on other sites

Hello,

We've been testing and the fact is that Git doesn't support branches with spaces in the name. 

So I guess that the only solution is renaming all your Plastic SCM having spaces.

By the way, do you know our GitSync and GitServer features? Those are more advanced features when we need to sync git-plastic repositories or work with mixed environments:

https://www.plasticscm.com/features/plasticscm-for-git-users.html

Regards,

Carlos.

Share this post


Link to post
Share on other sites
On 2/27/2017 at 4:04 AM, calbzam said:

Hello,

We've been testing and the fact is that Git doesn't support branches with spaces in the name. 

So I guess that the only solution is renaming all your Plastic SCM having spaces.

Is there an automated way to do this? Using a script perhaps? Or a way to find all the branches with spaces?

Share this post


Link to post
Share on other sites

You can use in your script the "cm find branch --format={name}" to list the branch names and then the "cm renamebranch --help" to rename the branches based on your needs.

Regards,

Carlos.

Share this post


Link to post
Share on other sites

I'll just add to this that labels have the same problem.  I just had to rename a bunch of labels to take spaces out but it was  easy enough to do in the GUI, fortuanately.  Rules for naming references in GIT are (currently) documented here https://git-scm.com/docs/git-check-ref-format
It would be nice if cm fast-export could have highlighted this problem,  instead of producing an invalid, unloadable file. Or make Plastic automatically escape it somehow, but if it does, you'll have to deal with GitSync and gitserver and make sure the rules exactly match, or there will be problems down the track with them.. ones not so easy to fix.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×