Package: github2gitlab
github2gitlabgithub2gitlab is a command line tool to mirror projects from GitHub
to GitLab. It does the following, in sequence:Upload the ~/.ssh/id_rsa.pub ssh key to gitlab if not foundCreate the gitlab project if it does not existMirror the github git repository to the gitlab git repositoryCreate or update the GitLab merge requests to match the
GitHub pull requestsExamplesMirrorhttp://github.com/dachary/testtohttp://workbench.dachary.org/dachary/testgithub2gitlab\--gitlab-urlhttp://workbench.dachary.org\--gitlab-tokensxQJ67SQKihMrGWVf\--github-repodachary/testMirrorhttp://github.com/ceph/cephtohttp://workbench.dachary.org/ceph/ceph-backportsand use the GitHub
token to be allowed to do more requests than when anonymous.
Use –ignore-closed to get rid of pull requests that are closed and
were never merged.github2gitlab\--gitlab-urlhttp://workbench.dachary.org\--gitlab-tokensxQJ67SQKihMrGWVf\--gitlab-repoceph/ceph-backports\--github-token64933d355fda9844aadd4e224d\--github-repoceph/ceph\--ignore-closedMirroring detailsThe GitHub git repository contains a reference for each pull requests.
For instance the pull request 483 has the refs/pull/483/head reference
which is the tip of the branch that was pushed. If the pull request is
open and can be merged on the destination, the reference
refs/pull/483/merge also exists and is the result of the merge.Instead of mirroring the refs/pull/* references to GitLab, they are
moved to refs/heads/pull/* so they become branches. If GitLab CI is
watching the project, it will run a job each time the pull/*/head
reference is updated.The pull requests title and description are mirrored exactly. The
state of the pull request cannot be mapped exactly and is translated
as follows:if the pull request is opened, the merge request is opened
if the pull request is closed,
  if the pull request merged_at field is null,
    the merge request is closed
  else
    the merge request is mergedIf a merge request is opened to mirror a pull request that has been
merged already, GitLab will refuse to set it to the merged state
because it notices that there would be nothing to merge. In this case
the merge request is set to the closed state and the :MERGED: string
is append to the description.GitLab APIhttp://doc.gitlab.com/ce/api/GitHub APIhttps://developer.github.com/v3/HackingGet the code : git clonehttp://workbench.dachary.org/dachary/github2gitlab.gitRun the unit tests : toxRun the integration tests. They require a gitlab token and a github token from
actual users with permissions to delete and create projects. The github project
specified with –github-repo and the github project specified with –gitlab-repo
will be removed and all their data and git repository lost during the test.PYTHONPATH=. tests/integration.py–gitlab-urlhttp://workbench.dachary.org–gitlab-token XXXXXXXXX –gitlab-repo dachary/testrepo2 –github-token XXXXXXXXX –github-repo dachary/testrepo –ssh-public-key ~/.ssh/id_rsa.pub –verboseTag a versionversion=1.3.0 ; perl -pi -e “s/^version.*/version = $version/” setup.cfg ; for i in 1 2 ; do python setup.py sdist ; amend=$(git log -1 –oneline | grep –quiet “version $version” && echo –amend) ; git commit $amend -m “version $version” ChangeLog setup.cfg ; git tag -a -f -m “version $version” $version ; doneCheck the documentation : rst2html < README.rst > /tmp/a.htmlPublish a new versionpython setup.py sdist upload –signgit push ; git push –tagspypi maintenancepython setup.py register # if the project does not yet existtrim old versions athttps://pypi.python.org/pypi/github2gitlab