<commit_before>#!/bin/sh

set -x
set -e
set -u

# get current stuff
git clone <EMAIL>:ansible/ansible.git ansible_unified
cd ansible_unified/
git submodule init
git submodule update

# add submodules as remotes
git remote add core_modules <EMAIL>:ansible/ansible-modules-core.git
git remote add extras_modules <EMAIL>:ansible/ansible-modules-extras.git
git fetch --all

# remove submodules
echo "" > .gitmodules
git add .gitmodules
git rm --cached lib/ansible/modules/core/
git rm --cached lib/ansible/modules/extras/
git commit -am "removed core and extras submodules"
rm -rf lib/ansible/modules/core
rm -rf lib/ansible/modules/extras

# merge remotes into old submodule dirs
## core
git merge -s ours --allow-unrelated-histories --no-commit core_modules/devel
git read-tree --prefix=lib/ansible/modules/core -u core_modules/devel
git commit -am 'core modules back to main repo'
## extras
git merge -s ours --allow-unrelated-histories --no-commit extras_modules/devel
git read-tree --prefix=lib/ansible/modules/extras -u extras_modules/devel
git commit -am 'extras modules back to main repo'
<commit_msg>now also unifies plugins in same dir structure<commit_after>#!/bin/sh

set -x
set -e
set -u

# get current stuff
git clone <EMAIL>:ansible/ansible.git ansible_unified
cd ansible_unified/
git submodule init
git submodule update

# add submodules as remotes
git remote add core_modules <EMAIL>:ansible/ansible-modules-core.git
git remote add extras_modules <EMAIL>:ansible/ansible-modules-extras.git
git fetch --all

# remove submodules
echo "" > .gitmodules
git add .gitmodules
git rm --cached lib/ansible/modules/core/
git rm --cached lib/ansible/modules/extras/
git commit -am "removed core and extras submodules"
rm -rf lib/ansible/modules/core
rm -rf lib/ansible/modules/extras

# merge remotes into old submodule dirs
## core
git merge -s ours --allow-unrelated-histories --no-commit core_modules/devel
git read-tree --prefix=lib/ansible/modules/core -u core_modules/devel
git commit -am 'core modules back to main repo'
## extras
git merge -s ours --allow-unrelated-histories --no-commit extras_modules/devel
git read-tree --prefix=lib/ansible/modules/extras -u extras_modules/devel
git commit -am 'extras modules back to main repo'

for subdir in core extras
do
	# unify directories
	for mydir in $(find lib/ansible/modules/${subdir} -type d)
	do
		mkdir -p ${mydir/$subdir\//}
	done

	# move plugins
	for myfile in $(find lib/ansible/modules/${subdir} -type f|grep -v '.github')
	do
		if [ -e ${myfile/$subdir\///} ]; then #mostly to avoid __init__.py clobering
			echo "skipping ${myfile} as it already exists in destination"
		else
			git mv ${myfile} ${myfile/$subdir\//}
		fi
	done

	git rm -rf lib/ansible/modules/${subdir}
done

{'fraction_non_alphanumeric': 0.10706482155863073, 'fraction_numerical': 0.0, 'mean_word_length': 4.031135531135531, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '3477035', 'n_tokens_mistral': 934, 'n_tokens_neox': 904, 'n_words': 305}