<commit_before><commit_msg>Added a helper script to syncrhonise Paasmaker repos from BitBucket to GitHub.<commit_after>#!/usr/bin/env python

import subprocess
import os

# Important notes:
# - This will keep a clone in the directory you run it in.
#   We don't advise running it in any directory.
# - You can adapt this. The repos listed here are for our use.

REPOS = [
	{
		'symbolic': 'paasmaker-interface-python',
		'source': '<EMAIL>:paasmaker/paasmaker-interface-python.git',
		'target': '<EMAIL>:paasmaker/paasmaker-interface-python.git'
	},
	{
		'symbolic': 'paasmaker-interface-php',
		'source': '<EMAIL>:paasmaker/paasmaker-interface-php.git',
		'target': '<EMAIL>:paasmaker/paasmaker-interface-php.git'
	},
	{
		'symbolic': 'paasmaker-interface-ruby',
		'source': '<EMAIL>:paasmaker/paasmaker-interface-ruby.git',
		'target': '<EMAIL>:paasmaker/paasmaker-interface-ruby.git'
	},
]

def run_helper(command, cwd=None):
	print "Executing %s" % " ".join(command)
	if cwd:
		print "In directory %s" % cwd
	subprocess.check_call(command, cwd=cwd)

for repo in REPOS:
	if not os.path.exists(repo['symbolic']):
		print "Initial setup for %s" % repo['symbolic']

		# Clone it.
		command = ['git', 'clone', '--mirror', repo['source'], repo['symbolic']]
		run_helper(command)

		# Add the remote.
		command = ['git', 'remote', 'add', 'target', repo['target']]
		run_helper(command, cwd=repo['symbolic'])

	# Fetch.
	command = ['git', 'fetch']
	run_helper(command, cwd=repo['symbolic'])

	# Push.
	command = ['git', 'push', '--mirror', 'target']
	run_helper(command, cwd=repo['symbolic'])
{'fraction_non_alphanumeric': 0.17443324937027707, 'fraction_numerical': 0.0, 'mean_word_length': 4.82051282051282, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4705434', 'n_tokens_mistral': 601, 'n_tokens_neox': 575, 'n_words': 133}