cd ../
[ -d admin ] || die "Could not locate admin directory"
+if [ -d .bzr ]; then
+ vcs=bzr
+elif [ -d .git ]; then
+ vcs=git
+else
+ die "Cannot determine vcs"
+fi
+
usage ()
{
[ "$quiet" ] && exec 1> /dev/null
-echo "Running bzr status..."
+## Run status on inputs, list modified files on stdout.
+status ()
+{
+ local statflag="-S"
+ [ "$vcs" = "git" ] && statflag="-s"
-bzr status -S ${autogendir:+$sources} ${ldefs_flag:+lisp} \
- ${info_flag:+doc} >| $tempfile || \
- die "bzr status error for input files"
+ $vcs status $statflag "$@" >| $tempfile || die "$vcs status error for $@"
-## The lisp portion could be more permissive, eg only care about .el files.
-while read stat file; do
+ local stat file modified
- case $stat in
- M)
- echo "Locally modified: $file"
- [ "$force" ] || die "There are local modifications"
- ;;
+ while read stat file; do
- *) die "Unexpected status ($stat) for $file" ;;
- esac
-done < $tempfile
+ [ "$stat" != "M" ] && \
+ die "Unexpected status ($stat) for generated $file"
+ modified="$modified $file"
+
+ done < $tempfile
+
+ echo "$modified"
+
+ return 0
+} # function status
+
+
+echo "Checking input file status..."
+
+## The lisp portion could be more permissive, eg only care about .el files.
+modified=$(status ${autogendir:+$sources} ${ldefs_flag:+lisp} ${info_flag:+doc}) || die
+
+[ "$modified" ] && {
+ echo "Locally modified: $modified"
+ [ "$force" ] || die "There are local modifications"
+}
## Probably this is overkill, and there's no need to "bootstrap" just
echo "Committing..."
- ## bzr status output is always relative to top-level, not PWD.
- bzr commit -m "Auto-commit of $type files." "$@" || return $?
+ $vcs commit -m "Auto-commit of $type files." "$@" || return $?
+
+ [ "$vcs" = "git" ] && {
+ $vcs push || return $?
+ }
echo "Committed files: $@"
} # function commit
*-xtra.texi|*efaq-w32.texi) continue ;;
esac
- dircat=`sed -n -e 's/@value{emacsname}/Emacs/' -e 's/^@dircategory //p' $file`
+ dircat=$(sed -n -e 's/@value{emacsname}/Emacs/' -e 's/^@dircategory //p' $file)
## TODO warn about unknown topics (check-info in top-level
## Makefile does this).
done
done
- bzr status -S $outfile >| $tempfile || \
- die "bzr status error for generated $outfile"
-
local modified
- while read stat file; do
+ modified=$(status $outfile) || die
- [ "$stat" != "M" ] && \
- die "Unexpected status ($stat) for generated $file"
-
- modified="$modified $file"
-
- done < $tempfile
-
- commit "info/dir" $modified || die "bzr commit error"
+ commit "info/dir" $modified || die "commit error"
} # function info_dir
echo "Checking status of generated files..."
- bzr status -S $basegen >| $tempfile || \
- die "bzr status error for generated files"
-
- modified=
-
- while read stat file; do
-
- [ "$stat" != "M" ] && \
- die "Unexpected status ($stat) for generated $file"
-
- modified="$modified $file"
+ modified=$(status $basegen) || die
- done < $tempfile
-
- cd $oldpwd
+ ## bzr status output is always relative to top-level, not PWD.
+ [ "$vcs" = "bzr" ] && cd $oldpwd
- commit "generated" $modified || die "bzr commit error"
+ commit "generated" $modified || die "commit error"
exit 0
} # $autogendir
echo "Finding loaddef targets..."
-sed -n -e '/^AUTOGEN_VCS/,/^$/ s/\\//p' lisp/Makefile.in | \
- sed '/AUTOGEN_VCS/d' >| $tempfile || die "sed error"
+sed -n -e '/^AUTOGEN_VCS/,/^$/p' lisp/Makefile.in | \
+ sed -e '/AUTOGEN_VCS/d' -e '/^$/d' -e 's/\\//' \
+ >| $tempfile || die "sed error"
genfiles=
while read genfile; do
- [ -r lisp/$genfile ] || die "Unable to read $genfile"
+ genfile=lisp/$genfile
+ [ -r $genfile ] || die "Unable to read $genfile"
genfiles="$genfiles $genfile"
done < $tempfile
cp $ldefs_in $ldefs_out || die "cp ldefs_boot error"
-cd lisp
-
echo "Checking status of loaddef files..."
## It probably would be fine to just check+commit lisp/, since
## making autoloads should not effect any other files. But better
## safe than sorry.
-bzr status -S $genfiles ${ldefs_out#lisp/} >| $tempfile || \
- die "bzr status error for generated files"
-
-
-modified=
-
-while read stat file; do
-
- [ "$stat" != "M" ] && die "Unexpected status ($stat) for generated $file"
- modified="$modified $file"
-
-done < $tempfile
-
-
-cd ../
+modified=$(status $genfiles $ldefs_out) || die
-commit "loaddefs" $modified || die "bzr commit error"
+commit "loaddefs" $modified || die "commit error"
exit 0