10. VCS - Mercurial

10.1. Repository Manipulation

Check out graft, transpose.

10.1.1. convert

Make sure, that there are no modifications in source repository:

hg -R /home/ws/project/ws_rfid/demo status -q

Get filemap of active files:

hg -R /home/ws/project/ws_rfid/demo status -c | sed 's,^C,include,' >filemap.txt

Convert source repo to new repo without deleted files:

hg convert --filemap filemap.txt /home/ws/project/ws_rfid/demo demo

Update new repo:

( cd demo && hg update -C )
rm -rf "${dest_repo}"
cat <<'EOF' >filemap
include "adhoc"
rename "adhoc" "."
hg convert --filemap filemap /home/ws/project/ws-util "${dest_repo}"
cd "${dest_repo}" || exit 1
hg update -C

10.1.2. Remove unwanted branches, clone –rev

Remove unwanted branches:

hg clone --rev xxx URL

Also copy .hg/hgrc!