To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / extra / fast-export / hg-reset.sh @ 1545:f81fcbde7eaf
History | View | Annotate | Download (1.48 KB)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
|
| 3 |
# Copyright (c) 2007, 2008 Rocco Rutte <pdmef@gmx.net> and others. |
| 4 |
# License: MIT <http://www.opensource.org/licenses/mit-license.php> |
| 5 |
|
| 6 |
ROOT="`dirname $0`" |
| 7 |
REPO="" |
| 8 |
PFX="hg2git" |
| 9 |
SFX_MARKS="marks" |
| 10 |
SFX_MAPPING="mapping" |
| 11 |
SFX_HEADS="heads" |
| 12 |
SFX_STATE="state" |
| 13 |
QUIET="" |
| 14 |
PYTHON=${PYTHON:-python}
|
| 15 |
|
| 16 |
USAGE="[-r <repo>] -R <rev>" |
| 17 |
LONG_USAGE="Print SHA1s of latest changes per branch up to <rev> useful |
| 18 |
to reset import and restart at <rev>. |
| 19 |
If <repo> is omitted, use last hg repository as obtained from state file, |
| 20 |
GIT_DIR/$PFX-$SFX_STATE by default. |
| 21 |
|
| 22 |
Options: |
| 23 |
-R Hg revision to reset to |
| 24 |
-r Mercurial repository to use |
| 25 |
" |
| 26 |
|
| 27 |
. "$(git --exec-path)/git-sh-setup" |
| 28 |
cd_to_toplevel |
| 29 |
|
| 30 |
while case "$#" in 0) break ;; esac |
| 31 |
do |
| 32 |
case "$1" in |
| 33 |
-r|--r|--re|--rep|--repo) |
| 34 |
shift |
| 35 |
REPO="$1" |
| 36 |
;; |
| 37 |
-*) |
| 38 |
# pass any other options down to hg2git.py |
| 39 |
break |
| 40 |
;; |
| 41 |
*) |
| 42 |
break |
| 43 |
;; |
| 44 |
esac |
| 45 |
shift |
| 46 |
done |
| 47 |
|
| 48 |
# for convenience: get default repo from state file |
| 49 |
if [ x"$REPO" = x -a -f "$GIT_DIR/$PFX-$SFX_STATE" ] ; then |
| 50 |
REPO="`grep '^:repo ' "$GIT_DIR/$PFX-$SFX_STATE" | cut -d ' ' -f 2`" |
| 51 |
echo "Using last hg repository \"$REPO\"" |
| 52 |
fi |
| 53 |
|
| 54 |
# make sure we have a marks cache |
| 55 |
if [ ! -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then |
| 56 |
touch "$GIT_DIR/$PFX-$SFX_MARKS" |
| 57 |
fi |
| 58 |
|
| 59 |
GIT_DIR="$GIT_DIR" $PYTHON "$ROOT/hg-reset.py" \ |
| 60 |
--repo "$REPO" \ |
| 61 |
--marks "$GIT_DIR/$PFX-$SFX_MARKS" \ |
| 62 |
--mapping "$GIT_DIR/$PFX-$SFX_MAPPING" \ |
| 63 |
--heads "$GIT_DIR/$PFX-$SFX_HEADS" \ |
| 64 |
--status "$GIT_DIR/$PFX-$SFX_STATE" \ |
| 65 |
"$@" |
| 66 |
|
| 67 |
exit $? |