more robust;
authorwenzelm
Sat, 27 Mar 2021 20:37:49 +0100
changeset 73743 97692af929a4
parent 73742 47f055b40ab9
child 73744 9460f1f45405
more robust;
lib/Tools/setup
--- a/lib/Tools/setup	Sat Mar 27 20:24:04 2021 +0100
+++ b/lib/Tools/setup	Sat Mar 27 20:37:49 2021 +0100
@@ -16,6 +16,7 @@
   echo
   echo "  Options are:"
   echo "    -r REV       explicit Mercurial version"
+  echo "    -C           enforce clean update of working directory (no backup!)"
   echo "    -V PATH      version from explicit file or directory (file \"ISABELLE_VERSION\")"
   echo
   echo "  Setup the current ISABELLE_HOME directory, which needs to be a"
@@ -35,18 +36,22 @@
 
 #options
 
-VERSION_REV=""
+CLEAN=""
 VERSION_PATH=""
+VERSION_REV=""
 
-while getopts "r:V:" OPT
+while getopts "CV:r:" OPT
 do
   case "$OPT" in
-    r)
-      VERSION_REV="$OPTARG"
+    C)
+      CLEAN="--clean"
       ;;
     V)
       VERSION_PATH="$OPTARG"
       ;;
+    r)
+      VERSION_REV="$OPTARG"
+      ;;
     \?)
       usage
       ;;
@@ -90,21 +95,22 @@
 
   if "${HG:-hg}" id -r "$REV" >/dev/null 2>/dev/null
   then
-    export PULL=""
+    PULL=""
   else
-    export PULL=true
+    PULL=true
   fi
 
   isabelle components -I
 
   #Atomic exec: avoid inplace update of running script!
+  export CLEAN PULL
   exec bash -c '
     set -e
     if [ -n "$PULL" ]; then
       "${HG:-hg}" pull -r "$REV"
     fi
-    "${HG:-hg}" update -r "$REV"
+    "${HG:-hg}" update -r "$REV" $CLEAN
+    isabelle components -a
     "${HG:-hg}" log -r "$REV"
-    isabelle components -a
   '
 fi