3 # Copyright (c) 2007 Rocco Rutte <pdmef@gmx.net>
4 # License: MIT <http://www.opensource.org/licenses/mit-license.php>
13 PYTHON
=${PYTHON:python}
15 USAGE
="[-r <repo>] -R <rev>"
16 LONG_USAGE
="Print SHA1s of latest changes per branch up to <rev> useful
17 to reset import and restart at <rev>.
18 If <repo> is omitted, use last hg repository as obtained from state file,
19 GIT_DIR/$PFX-$SFX_STATE by default.
22 -R Hg revision to reset to
23 -r Mercurial repository to use
29 while case "$#" in 0) break ;; esac
32 -r|
--r|
--re|
--rep|
--repo)
37 # pass any other options down to hg2git.py
47 # for convenience: get default repo from state file
48 if [ x
"$REPO" = x
-a -f "$GIT_DIR/$PFX-$SFX_STATE" ] ; then
49 REPO
="`egrep '^:repo ' "$GIT_DIR/$PFX-$SFX_STATE" | cut -d ' ' -f 2`"
50 echo "Using last hg repository \"$REPO\""
53 # make sure we have a marks cache
54 if [ ! -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then
55 touch "$GIT_DIR/$PFX-$SFX_MARKS"
58 GIT_DIR
="$GIT_DIR" $PYTHON "$ROOT/hg-reset.py" \
60 --marks "$GIT_DIR/$PFX-$SFX_MARKS" \
61 --heads "$GIT_DIR/$PFX-$SFX_HEADS" \
62 --status "$GIT_DIR/$PFX-$SFX_STATE" \