Improved output for multi branch imports and noted another little todo item
[fast-export.git] / hg-reset.sh
blob4204005032011bacbe5ef7ae5ceae243b60e3c48
1 #!/bin/sh
3 # Copyright (c) 2007 Rocco Rutte <pdmef@gmx.net>
4 # License: MIT <http://www.opensource.org/licenses/mit-license.php>
6 ROOT="`dirname $0`"
7 REPO=""
8 PFX="hg2git"
9 SFX_MARKS="marks"
10 SFX_HEADS="heads"
11 SFX_STATE="state"
12 QUIET=""
14 USAGE="[-r <repo>] -R <rev>"
15 LONG_USAGE="Print SHA1s of latest changes per branch up to <rev> useful
16 to reset import and restart at <rev>.
17 If <repo> is omitted, use last hg repository as obtained from state file,
18 GIT_DIR/$PFX-$SFX_STATE by default.
20 Options:
21 -R Hg revision to reset to
22 -r Mercurial repository to use
25 . git-sh-setup
26 cd_to_toplevel
28 while case "$#" in 0) break ;; esac
30 case "$1" in
31 -r|--r|--re|--rep|--repo)
32 shift
33 REPO="$1"
35 -*)
36 # pass any other options down to hg2git.py
37 break
40 break
42 esac
43 shift
44 done
46 # for convenience: get default repo from state file
47 if [ x"$REPO" = x -a -f "$GIT_DIR/$PFX-$SFX_STATE" ] ; then
48 REPO="`egrep '^:repo ' "$GIT_DIR/$PFX-$SFX_STATE" | cut -d ' ' -f 2`"
49 echo "Using last hg repository \"$REPO\""
52 # make sure we have a marks cache
53 if [ ! -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then
54 touch "$GIT_DIR/$PFX-$SFX_MARKS"
57 GIT_DIR="$GIT_DIR" python "$ROOT/hg-reset.py" \
58 --repo "$REPO" \
59 --marks "$GIT_DIR/$PFX-$SFX_MARKS" \
60 --heads "$GIT_DIR/$PFX-$SFX_HEADS" \
61 --status "$GIT_DIR/$PFX-$SFX_STATE" \
62 "$@"
64 exit $?