Connecting Plastic SCM to githubWe’ve taught Plastic SCM to speak the 21th century SCM “lingua franca”: fast-import format as defined by git here. What does it mean? First, it means you can import or export a repo from git (so, an easy way to try and move to Plastic SCM, while keeping a safe exit for the non-believers!). Since almost anything out there is able to be exported to “fast-import” format… it also means you can easily move to Plastic SCM from CVS, SVN, Git, Mercurial, ClearCase, Perforce… anything!
Import a repo from githubFirst things first: how do you import from github?
Suppose you want to import the following repo: git://github.com/twopointzero/NUnit.git
First you clone it locally:
$ git clone https://github.com/postmodern/ronin.git
Then you fast-export it:
$ git fast-export --all -C --tag-of-filtered-object=drop --signed-tags=strip > repo.fe
And now you go and import it to plasticscm:
$ cm mkrep myrepo@localhost:8084 (optionally create a new repo!!!) $ cm fast-import myrepo@localhost:80804 repo.fe
And you’re done! Open the branch explorer in Plastic and... :)
Export from Plastic SCMWe’ve also implemented the “fast-export” command so exporting is as easy as:
$ cm fast-export myrepo@localhost:80804 repo.fast-exported
And again… you’re done!
Incrementally synching with gitWhat if you needed to work “incrementally” with git from Plastic SCM?
Such as the following:
Basically, you’ll need to take advantage of the incremental import/export provided by the fast-import/fast-export toolset using “marks”.
The following diagram depicts the process and shows the commands :
Initial export from git to plasticCreate the package on git
$ git fast-export --all -C --tag-of-filtered-object=drop --signed-tags=strip \ --export-marks=marks.git > repo.fe
And get it imported in Plastic SCM
$ cm fast-import repo@localhost:80804 repo.fe \ --export-marks=marks.cm
Make some changes on plastic and send them back
Send them back to git:
$ cm fast-export repo@localhost:80804 repo.fe.00 --import-marks=marks.cm --export-marks=marks.cm
And import them in git:
$ cat repo.fe.00 | git fast-import --export-marks=marks.git --import-marks=marks.git
More changes now from the git side and back to plastic
$ git fast-export --all -C --tag-of-filtered-object=drop --signed-tags=strip \ --export-marks=marks.git --import-marks=marks.git > repo.fe.01 $ cm fast-import repo@localhost:80804 repo.fe.01 \ --import-marks=marks.cm --export-marks=marks.cm
Please note we’re always using the files “marks.cm” to hold the import/export marks from Plastic SCM and the file “marks.git” to contain the ones from git.
The “packages” have been named repo.fe first then the second is repo.fe.00 and repo.fe.01eventually.
The process can go on and on n.
LimitationsBy using “fast-import/export” there’s one limitation you must keep in mind: concurrent changes are not allowed.
I mean: if you make changes on “master” and at the same time you make changes on the corresponding “/main”, the system won’t be able to deal with it!
The current solution is able to handle the scenario if you make changes at one side at the time.
Using feature branches, for instance, get rids of the potential collisions anyway.