mirror of
https://github.com/frej/fast-export.git
synced 2026-05-07 02:26:51 +02:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
667404e836 | ||
|
|
38e236962d | ||
|
|
dbb8158527 | ||
|
|
bb0bcda7ba | ||
|
|
838b654614 | ||
|
|
f179afce65 |
@@ -27,10 +27,10 @@ command line option.
|
|||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Example mercurial repo folder structure (~/mercurial):
|
Example mercurial repo folder structure (~/mercurial) containing two subrepos:
|
||||||
src/...
|
src/...
|
||||||
subrepo/subrepo1
|
subrepos/subrepo1
|
||||||
subrepo/subrepo2
|
subrepos/subrepo2
|
||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
Create an empty new folder where all the converted git modules will be imported:
|
Create an empty new folder where all the converted git modules will be imported:
|
||||||
@@ -41,18 +41,18 @@ Create an empty new folder where all the converted git modules will be imported:
|
|||||||
mkdir submodule1
|
mkdir submodule1
|
||||||
cd submodule1
|
cd submodule1
|
||||||
git init
|
git init
|
||||||
hg-fast-export.sh -r ~/mercurial/subrepo1
|
hg-fast-export.sh -r ~/mercurial/subrepos/subrepo1
|
||||||
cd ..
|
cd ..
|
||||||
mkdir submodule2
|
mkdir submodule2
|
||||||
cd submodule2
|
cd submodule2
|
||||||
git init
|
git init
|
||||||
hg-fast-export.sh -r ~/mercurial/subrepo2
|
hg-fast-export.sh -r ~/mercurial/subrepos/subrepo2
|
||||||
|
|
||||||
### Create mapping file
|
### Create mapping file
|
||||||
cd ~/imported-gits
|
cd ~/imported-gits
|
||||||
cat > submodule-mappings << EOF
|
cat > submodule-mappings << EOF
|
||||||
"subrepo/subrepo1"="../submodule1"
|
"subrepos/subrepo1"="../submodule1"
|
||||||
"subrepo/subrepo2"="../submodule2"
|
"subrepos/subrepo2"="../submodule2"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
### Convert main repository
|
### Convert main repository
|
||||||
@@ -60,16 +60,16 @@ Create an empty new folder where all the converted git modules will be imported:
|
|||||||
mkdir git-main-repo
|
mkdir git-main-repo
|
||||||
cd git-main-repo
|
cd git-main-repo
|
||||||
git init
|
git init
|
||||||
hg-fast-export.sh -r ~/mercurial --subrepo-map=../submodule-mappings
|
hg-fast-export.sh -r ~/mercurial --subrepo-map=~/imported-gits/submodule-mappings
|
||||||
|
|
||||||
### Result
|
### Result
|
||||||
The resulting repository will now contain the subrepo/subrepo1 and
|
The resulting repository will now contain the submodules at the paths
|
||||||
subrepo/subrepo1 submodules. The created .gitmodules file will look
|
`subrepos/subrepo1` and `subrepos/subrepo2`. The created .gitmodules
|
||||||
like:
|
file will look like:
|
||||||
|
|
||||||
[submodule "subrepo/subrepo1"]
|
[submodule "subrepos/subrepo1"]
|
||||||
path = subrepo/subrepo1
|
path = subrepos/subrepo1
|
||||||
url = ../submodule1
|
url = ../submodule1
|
||||||
[submodule "subrepo/subrepo2"]
|
[submodule "subrepos/subrepo2"]
|
||||||
path = subrepo/subrepo2
|
path = subrepos/subrepo2
|
||||||
url = ../submodule2
|
url = ../submodule2
|
||||||
|
|||||||
@@ -133,7 +133,10 @@ is to convert line endings in text files from CRLF to git's preferred LF:
|
|||||||
# $2 = Mercurial's hash of the file
|
# $2 = Mercurial's hash of the file
|
||||||
# $3 = "1" if Mercurial reports the file as binary, otherwise "0"
|
# $3 = "1" if Mercurial reports the file as binary, otherwise "0"
|
||||||
|
|
||||||
if [ "$3" == "1" ]; then cat; else dos2unix; fi
|
if [ "$3" == "1" ]; then cat; else dos2unix -q; fi
|
||||||
|
# -q option in call to dos2unix allows to avoid returning an
|
||||||
|
# error code when handling non-ascii based text files (like UTF-16
|
||||||
|
# encoded text files)
|
||||||
-- End of crlf-filter.sh --
|
-- End of crlf-filter.sh --
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ def sanitize_name(name,what="branch", mapping={}):
|
|||||||
if not auto_sanitize:
|
if not auto_sanitize:
|
||||||
return mapping.get(name,name)
|
return mapping.get(name,name)
|
||||||
n=mapping.get(name,name)
|
n=mapping.get(name,name)
|
||||||
p=re.compile(b'([[ ~^:?\\\\*]|\.\.)')
|
p=re.compile(b'([\\[ ~^:?\\\\*]|\.\.)')
|
||||||
n=p.sub(b'_', n)
|
n=p.sub(b'_', n)
|
||||||
if n[-1:] in (b'/', b'.'): n=n[:-1]+b'_'
|
if n[-1:] in (b'/', b'.'): n=n[:-1]+b'_'
|
||||||
n=b'/'.join([dot(s) for s in n.split(b'/')])
|
n=b'/'.join([dot(s) for s in n.split(b'/')])
|
||||||
|
|||||||
Reference in New Issue
Block a user