hgforest-crew / test-forest

#! /bin/sh

echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH
echo "forest=" >> $HGRCPATH

echo "# setup initial forest"
hg init toplevel
echo "f" > toplevel/f
mkdir toplevel/d
echo "d/f" > toplevel/d/f
mkdir toplevel/d/d
echo "d/d/f" > toplevel/d/d/f
hg init toplevel/d/d/t
echo "d/d/t/f" > toplevel/d/d/t/f
hg init toplevel/t
echo "t/f" > toplevel/t/f
hg init toplevel/t/t
echo "t/t/f" > toplevel/t/t/f
hg commit --cwd toplevel -A -m "start" -d "0 0"
hg commit --cwd toplevel/d/d/t -A -m "start" -d "0 0"
hg commit --cwd toplevel/t -A -m "start" -d "0 0"
hg commit --cwd toplevel/t/t -A -m "start" -d "0 0"

echo "# ftrees"
hg ftrees --cwd toplevel

echo "# fstatus"
echo "x" >> toplevel/d/d/t/f
echo "new" >> toplevel/t/t/f2
hg fstatus --cwd toplevel
hg revert --cwd toplevel/d/d/t --no-backup  f
rm -f toplevel/t/t/f2
hg fstatus --cwd toplevel

echo "# fclone"
hg fclone toplevel topcopy
hg fsnap --cwd topcopy > top-snap

echo "# fsnap"
hg fsnap --cwd toplevel > top-snap1
echo "x" >> toplevel/t/t/f
hg commit --cwd toplevel/t/t -m "new line" -d "0 0"
echo "f2" > toplevel/d/d/f2
hg commit --cwd toplevel/d/d -A -m "new file" -d "0 0"
hg fsnap --cwd toplevel > top-snap2
diff -u top-snap1 top-snap2 | \
    sed -e 's/--- top-snap1.*$/--- top-snap1/' \
        -e 's/+++ top-snap2.*$/+++ top-snap2/'

echo "# fseed"
hg clone toplevel newtop
hg fseed --cwd newtop ../top-snap default
rm -rf newtop

echo "# fpull"
hg fpull --cwd topcopy -u ../top-snap default | sed "s@$HGTMP@HGTMP@g"

echo "# fpush"
echo "t/t/f" > topcopy/t/t/f
hg commit --cwd topcopy/t/t -m "delete new line" -d "0 0"
hg remove --cwd topcopy d/d/f2
hg commit --cwd topcopy/d/d -m "remove new file" -d "0 0"
hg fpush --cwd topcopy ../top-snap default | sed "s@$HGTMP@HGTMP@g"

# create an mq patch in topcopy/t
hg qinit --cwd topcopy/t
hg qnew --cwd topcopy/t mq-patch
echo "zzz" > topcopy/t/z
hg add --cwd topcopy/t z
hg qrefresh --cwd topcopy/t

echo "# fstatus + mq"
hg fstatus --cwd topcopy

echo "# fclone + mq"
hg fclone topcopy newtop
rm -rf newtop

echo "# fsnap + mq"
hg fsnap --cwd topcopy ../top-snap1

echo "# fpull + mq"
hg fpull --cwd topcopy -u ../top-snap default | sed "s@$HGTMP@HGTMP@g"

echo "# fpush + mq"
hg fpush --cwd topcopy ../top-snap default | sed "s@$HGTMP@HGTMP@g"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.