Admin/PIDE/convert
author blanchet
Tue, 15 Oct 2013 10:59:34 +0200
changeset 54109 80660c529d74
parent 53498 05313b45a5ae
permissions -rwxr-xr-x
addressed rare case where the same symbol would be treated alternately as a function and as a predicate -- adding "top2I top_boolI" to a problem that didn't talk about "top" was a way to trigger the issue

#!/usr/bin/env bash

THIS="$(cd "$(dirname "$0")"; pwd)"
SUPER="$(cd "$THIS/.."; pwd)"

ISABELLE_REPOS="$(cd "$THIS/../.."; pwd)"


## main

FILEMAP="/tmp/filemap$$"

echo "include COPYRIGHT" > "$FILEMAP"
(
  cd "$ISABELLE_REPOS"
  for FILE in $(find src/Pure -name "*.scala")
  do
    if grep "Module:.*PIDE" "$FILE" >/dev/null; then
      if [ "$("${HG:-hg}" status -u -n --color=never "$FILE")" = "" ]; then
        echo "include $FILE" >> "$FILEMAP"
        echo "rename $FILE src/$(basename "$FILE")" >> "$FILEMAP"
      fi
    fi
  done
)

cat "$FILEMAP"

"${HG:-hg}" convert --filemap "$FILEMAP" "$ISABELLE_REPOS" PIDE-repos

rm -f "$FILEMAP"