3 USAGE
='[-m max] [--quiet] repo'
4 LONG_USAGE
='Import hg repository <repo> up to either tip or <max>'
17 while case "$#" in 0) break ;; esac
24 --q|
--qu|
--qui|
--quie|
--quiet)
37 if [ "$#" != 1 ] ; then
44 # make sure we have a marks cache
45 if [ ! -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then
46 touch "$GIT_DIR/$PFX-$SFX_MARKS"
49 GIT_DIR
="$GIT_DIR" python
"$ROOT/hg2git.py" \
52 "$GIT_DIR/$PFX-$SFX_MARKS" \
53 "$GIT_DIR/$PFX-$SFX_HEADS" \
54 "$GIT_DIR/$PFX-$SFX_STATE" \
55 | git-fast-import
$QUIET --export-marks="$GIT_DIR/$PFX-$SFX_MARKS.tmp" \
56 || die
'Git fast-import failed'
58 # move recent marks cache out of the way...
59 if [ -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then
60 mv "$GIT_DIR/$PFX-$SFX_MARKS" "$GIT_DIR/$PFX-$SFX_MARKS.old"
62 touch "$GIT_DIR/$PFX-$SFX_MARKS.old"
65 # ...to create a new merged one
66 cat "$GIT_DIR/$PFX-$SFX_MARKS.old" "$GIT_DIR/$PFX-$SFX_MARKS.tmp" \
67 |
uniq > "$GIT_DIR/$PFX-$SFX_MARKS"
70 rm -rf "$GIT_DIR/$PFX-$SFX_MARKS.old" "$GIT_DIR/$PFX-$SFX_MARKS.tmp"
72 # save SHA1s of current heads for incremental imports
73 # and connectivity (plus sanity checking)
74 for head in `git branch | sed 's#^..##'` ; do
75 id
="`git-rev-parse $head`"
77 done > "$GIT_DIR/$PFX-$SFX_HEADS"
79 # check diff with color:
80 # ( for i in `find . -type f | grep -v '\.git'` ; do diff -u $i $REPO/$i ; done | cdiff ) | less -r