Mercurial > mxe-octave
changeset 2492:b48e499007b7
patch tool: check preconditions for import.
author | Ryan Pavlik <rpavlik@iastate.edu> |
---|---|
date | Mon, 07 May 2012 12:55:30 -0500 |
parents | 14be80e4c69f |
children | f8ba2ad7cd81 |
files | tools/patch-tool-mxe |
diffstat | 1 files changed, 16 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/patch-tool-mxe Mon May 07 12:45:03 2012 -0500 +++ b/tools/patch-tool-mxe Mon May 07 12:55:30 2012 -0500 @@ -87,11 +87,22 @@ function import_patch { setupEnv - cd $gitsdir/$pkg_subdir && \ - cat $mxedir/src/$pkg-1-fixes.patch | \ - sed '/^From/,$ !d' | \ - sed s/'^From: .*'/"From: $author"/'g;' | \ - git am --keep-cr + if [ ! -d $gitsdir/$pkg_subdir ]; then + echo "Error: $gitsdir/$pkg_subdir does not exist, so cannot import patches. Cancelling import - try 'init' first." >&2 + exit 1 + fi + + if [ -f $mxedir/src/$pkg-1-fixes.patch ]; then + cd $gitsdir/$pkg_subdir && \ + cat $mxedir/src/$pkg-1-fixes.patch | \ + sed '/^From/,$ !d' | \ + sed s/'^From: .*'/"From: $author"/'g;' | \ + git am --keep-cr && \ + echo "Imported $mxedir/src/$pkg-1-fixes.patch" + else + echo "patch-tool managed file $mxedir/src/$pkg-1-fixes.patch not found. Cancelling import." >&2 + exit 1 + fi } case "$cmd" in