<commit_before>#!/bin/bash

mkdir -p fedora
cd fedora

#ORIGIN="<EMAIL>:fedora-openstack"
ORIGIN="git://github.com/fedora-openstack"
FEDORA_ORIGIN="git://pkgs.fedoraproject.org"
OUTDIR="out-report"

mkdir -p $OUTDIR

function generate_diff {
  echo "Generating diffs..."
  for PROJ in nova glance keystone swift quantum cinder python-novaclient python-glanceclient python-keystoneclient python-swiftclient python-quantumclient python-cinderclient; do

    echo "processing $PROJ..."

    if [ -d "openstack-$PROJ" ]; then
      pushd "openstack-$PROJ"
      git fetch origin
    else
      git clone "${ORIGIN}/openstack-${PROJ}.git"
      pushd "openstack-$PROJ"
      if [ ${PROJ:0:6} = "python" ]; then
        git remote add fedoraproject "${FEDORA_ORIGIN}/${PROJ}.git"
      else
        git remote add fedoraproject "${FEDORA_ORIGIN}/openstack-${PROJ}.git"
      fi
    fi

    git fetch fedoraproject

    git diff fedoraproject/master upstream/master > ../$OUTDIR/$PROJ.diff
    popd

  done

}

function generate_report {
  echo "Generating report..."
  pushd $OUTDIR

cat > index.html <<-EOF_CAT
<html>
<head>
  <title>Fedora: upstream packager diffs</title>
</head>
<body>
<h1>Fedora: upstream packager diffs</h1>

<h3>Fedora base URL: $FEDORA_ORIGIN</h3>
<h3>Upstream base URL: $ORIGIN</h3>

Diffs by size/project:
<ul>
EOF_CAT

for DIFF in $(ls *.diff); do
  LINE_COUNT=$(wc -l $DIFF | cut -f 1 -d " ")
  echo "<li>$LINE_COUNT: <a href='$DIFF'>$DIFF</a></li>" >> index.html
done

cat >> index.html <<-EOF_CAT
</ul>

** Diffs generated with: <i>git diff fedora/master origin/master</i>
</body>
</html>
EOF_CAT

popd
}

generate_diff
generate_report<commit_msg>Fix origin git remote name.<commit_after>#!/bin/bash

mkdir -p fedora
cd fedora

#ORIGIN="<EMAIL>:fedora-openstack"
ORIGIN="git://github.com/fedora-openstack"
FEDORA_ORIGIN="git://pkgs.fedoraproject.org"
OUTDIR="out-report"

mkdir -p $OUTDIR

function generate_diff {
  echo "Generating diffs..."
  for PROJ in nova glance keystone swift quantum cinder python-novaclient python-glanceclient python-keystoneclient python-swiftclient python-quantumclient python-cinderclient; do

    echo "processing $PROJ..."

    if [ -d "openstack-$PROJ" ]; then
      pushd "openstack-$PROJ"
      git fetch origin
    else
      git clone "${ORIGIN}/openstack-${PROJ}.git"
      pushd "openstack-$PROJ"
      if [ ${PROJ:0:6} = "python" ]; then
        git remote add fedoraproject "${FEDORA_ORIGIN}/${PROJ}.git"
      else
        git remote add fedoraproject "${FEDORA_ORIGIN}/openstack-${PROJ}.git"
      fi
    fi

    git fetch fedoraproject

    git diff fedoraproject/master origin/master > ../$OUTDIR/$PROJ.diff
    popd

  done

}

function generate_report {
  echo "Generating report..."
  pushd $OUTDIR

cat > index.html <<-EOF_CAT
<html>
<head>
  <title>Fedora: upstream packager diffs</title>
</head>
<body>
<h1>Fedora: upstream packager diffs</h1>

<h3>Fedora base URL: $FEDORA_ORIGIN</h3>
<h3>Upstream base URL: $ORIGIN</h3>

Diffs by size/project:
<ul>
EOF_CAT

for DIFF in $(ls *.diff); do
  LINE_COUNT=$(wc -l $DIFF | cut -f 1 -d " ")
  echo "<li>$LINE_COUNT: <a href='$DIFF'>$DIFF</a></li>" >> index.html
done

cat >> index.html <<-EOF_CAT
</ul>

** Diffs generated with: <i>git diff fedora/master upstream/master</i>
</body>
</html>
EOF_CAT

popd
}

generate_diff
generate_report
{'fraction_non_alphanumeric': 0.1456223942823109, 'fraction_numerical': 0.005360333531864205, 'mean_word_length': 3.639502762430939, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1006029', 'n_tokens_mistral': 1317, 'n_tokens_neox': 1260, 'n_words': 303}