Perche migrare
Mercurial e Git sono sistemi fratelli — entrambi distribuiti, content-addressed.
Lo strumento standard: fast-export
git clone https://github.com/frej/fast-export.git
cd ~/path-to-hg-repo
git init ../git-repo
cd ../git-repo
~/fast-export/hg-fast-export.sh -r ../path-to-hg-repo
git checkout HEAD
Mappatura autori
# authors.txt
"Jane Doe" = "Jane Doe <[email protected]>"
"bob" = "Bob Smith <[email protected]>"
~/fast-export/hg-fast-export.sh -r ../hg-repo -A authors.txt
Gestione branch
- I named branch di Mercurial sono etichette permanenti.
- I branch Git sono puntatori mutabili.
Branch chiusi
git for-each-ref refs/heads/closed-* --format='%(refname:short)' \
| xargs -n 1 git branch -D
Tag
hg tags
git tag
Verificare l'integrita
hg log --template '{node}\n' | wc -l
git log --all --pretty=format:'%H' | wc -l
hg cat -r <hg-rev> path/to/file > /tmp/hg-file
git show <git-sha>:path/to/file > /tmp/git-file
diff /tmp/hg-file /tmp/git-file
Pushare a un host Git
git remote add origin https://github.com/team/repo.git
git push -u origin --all
git push origin --tags
Traduzione del workflow
Gli utenti Mercurial sono spesso scioccati dall'index di Git.
Estensioni e hook
mq → git rebase -i. histedit → anche git rebase -i.
Aftercare
Tenere il repo Mercurial read-only per almeno un ciclo di release.