rewrite revert command. fix issues 93, 123, 147.
new version does these things:
- saves backup copies of modified files (issue 147)
- prints output like other commands, and errors when files not found
(issue 123)
- marks files added/removed (issue 93)
#!/bin/sh
hg init
echo 123 > a
echo 123 > c
echo 123 > e
hg add a c e
hg commit -m "first" -d "1000000 0" a c e
echo 123 > b
echo %% should show b unknown
hg status
echo 12 > c
echo %% should show b unknown and c modified
hg status
hg add b
echo %% should show b added and c modified
hg status
hg rm a
echo %% should show a removed, b added and c modified
hg status
hg revert a
echo %% should show b added, copy saved, and c modified
hg status
hg revert b
echo %% should show b unknown, b.bak unknown, and c modified
hg status
hg revert --no-backup c
echo %% should show unknown: b b.bak
hg status
echo %% should show a b b.bak c e
ls
echo %% should save backup to e.0
echo z > e
hg revert --backup='%p.%R'
echo %% should say no changes needed
hg revert a
echo %% should say file not managed
echo q > q
hg revert q
echo %% should say file not found
hg revert notfound
true