# http://felipec.wordpress.com/2012/11/13/git-remote-hg-bzr-2/
# Uncomment to have verbose debug output
-#debug=1
+debug=1
print_usage()
{
# git-remote-hg doesn't work with Mercurial subpaths extension,
# so use it manually
hg_subpaths_config() {
- subpaths=$(hg showconfig | grep "subpaths")
+ subpaths=$(hg showconfig | grep "subpaths" | grep "HG_REPO")
+
+ echo "subpaths = ${subpaths}"
if [ -n ${subpaths} ]; then
sp_src=${subpaths//subpaths./}
# "BRANCH___-___NAME"
branch="${branch// /___}"
+ if [ -n "${debug}" ]; then
+ echo "branch: ${branch}"
+ fi
+
git clone "hg::${src}" "${dest}"
+ cd "${dest}"
+
+ if [ -x ${HOME}/scripts/git-set-local-author.sh ]; then
+ # Make sure commits have correct author for LSI
+ ${HOME}/scripts/git-set-local-author.sh
+ fi
+
if [ "x${branch}" != "xdefault" ]; then
- cd "${dest}"
- git checkout "branches/${branch}"
+ # Make tracking branch
+ git checkout -f "branches/${branch}"
# Adjusting git tree to specific commit specified in
# .hgsubstate:
# to a hash in git using the ${num} variable:
git_rev=$(git log --oneline | sed -n "${num}p" | awk '{print $1}')
git reset --hard ${git_rev}
-
- cd ..
fi
+ cd ..
+
if ! grep -q "${dest}" .gitignore ; then
# Ignore subrepo in top-level git repository
echo "${dest}" >> .gitignore