From c16e4cf4bbeb3ce8e7f69f1c404e08cb8ccf6fd7 Mon Sep 17 00:00:00 2001 From: lroche <1540492+lroche@users.noreply.github.com> Date: Fri, 9 Mar 2018 18:33:55 +0100 Subject: [PATCH] initial commit --- Dockerfile | 17 +++++++++++++++++ LICENSE | 20 ++++++++++++++++++++ README.md | 17 +++++++++++++++++ hg2git.sh | 16 ++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md create mode 100644 hg2git.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d721c22 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM buildpack-deps:jessie +MAINTAINER Lionel Roche +RUN mkdir -p work + +WORKDIR work + +#Install fastexport tool: +RUN mkdir -p /usr/local/src \ + && cd /usr/local/src \ + && git clone https://github.com/frej/fast-export.git + +RUN cd /work +COPY hg2git.sh . +RUN chmod +x hg2git.sh + +ENTRYPOINT ["/work/hg2git.sh"] + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a013a75 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2018 Lionel Roche + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..dbd7043 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# Summary +The purpose of hg2git is to convert a Mercurial repository to a Git repository. +All mechanism of conversion is based on [fast-export](https://github.com/frej/fast-export.git) tool. + + +# Launch conversion + + docker run -it -v ~/gitconversion/anyproject-hg:/work/projectname -v ~/gitconversion/project-result-git:/work/result lroche/hg2git projectname + +the run uses two bound volumes, one for hg source, other for git target result. +the name of project has no matter but it will be the same between /work/projectname and the argument of the command (here projectname) + +# How to retrieve git conversion ? + +The result of git conversion can be found behind the /work/result volume + + diff --git a/hg2git.sh b/hg2git.sh new file mode 100644 index 0000000..44a1980 --- /dev/null +++ b/hg2git.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +PROJECT_NAME=$1 + +cd /work/result +mkdir -p $PROJECT_NAME-git +cd $PROJECT_NAME-git +git init +#avoid having unexpected issue: +git config core.ignoreCase false + +/usr/local/src/fast-export/hg-fast-export.sh -r /work/$PROJECT_NAME + +git checkout HEAD + +bash