Mercurial > hgsubversion
comparison tools/common.sh @ 304:ce676eff002b
First merge, totally untested.
| author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
|---|---|
| date | Fri, 01 May 2009 10:28:59 +0200 |
| parents | 52cc0982dfcd |
| children | 5071b8511572 |
comparison
equal
deleted
inserted
replaced
| 303:f423a8780832 | 304:ce676eff002b |
|---|---|
| 1 function verify_current_revision() | |
| 2 { | |
| 3 /bin/rm -rf * | |
| 4 exportcmd="svn export `hg svn info 2> /dev/null | grep '^URL: ' | sed 's/URL: //'` -r`hg svn info | grep ^Revision | sed 's/.*: //;s/ .*//'` . --force" | |
| 5 `echo $exportcmd` > /dev/null | |
| 6 x=$? | |
| 7 if [[ "$x" != "0" ]] ; then | |
| 8 echo $exportcmd | |
| 9 echo 'export failed!' | |
| 10 return 255 | |
| 11 fi | |
| 12 if [[ "`hg st | wc -l | python -c 'import sys; print sys.stdin.read().strip()'`" == "0" ]] ; then | |
| 13 return 0 | |
| 14 else | |
| 15 if [[ $1 != "keep" ]] ; then | |
| 16 revert_all_files | |
| 17 fi | |
| 18 return 1 | |
| 19 fi | |
| 20 } | |
| 21 | |
| 22 function revert_all_files() | |
| 23 { | |
| 24 hg revert --all | |
| 25 hg purge | |
| 26 } |
