<commit_before>'use strict';

const childProcess = require('child_process');
const path = require('path');
const fs = require('fs');

const ini = require('ini');
const del = require('del');
const Promise = require('pinkie-promise');
const sanitizeFilename = require('sanitize-filename');
const mkdirp = require('mkdirp');
const url = require('url');
const decamelizeKeys = require('decamelize-keys');

const TAG_PATH = '.git/refs/tags';
const BRANCH_PATH = '.git/refs/heads';
const GIT_CONFIG_PATH = '.git/config';

function execCommand(gitArgs) {
	return new Promise((resolve, reject) => {
		console.log('starting: ', `git ${gitArgs.join(' ')}`);

		const child = childProcess.spawn('git', gitArgs);
		child.stdout.pipe(process.stdout);
		child.stderr.pipe(process.stderr);
		child.on('close', code => {
			if (code === 0) {
				resolve();
			} else {
				reject(new Error('git svn clone failed'));
			}
		});
	});
}

function parseOptions(options) {
	const gitArgs = [];
	if (options) {
		options = decamelizeKeys(options, '-');
		for (const key of Object.keys(options)) {
			if (typeof options[key] === 'boolean') {
				gitArgs.push(`--${key}`);
			} else {
				gitArgs.push(`--${key}=${options[key]}`);
			}
		}
	}
	return gitArgs;
}

function migrate() {}

migrate.clone = function (svnRepoUrl, options) {
	const urlParts = url.parse(svnRepoUrl);
	const urlPathList = urlParts.path.replace(/\/+$/, '').split('/');
	const repoName = urlPathList.pop();
	del.sync(repoName);

	const gitArgs = [
		'svn',
		'clone'
	];
	gitArgs.push(svnRepoUrl);
	gitArgs.push('--stdlayout');

	return execCommand(gitArgs.concat(parseOptions(options))).then(() => Promise.resolve(repoName));
};<commit_msg>add prefix as default clone parameter<commit_after>'use strict';

const childProcess = require('child_process');
const path = require('path');
const fs = require('fs');

const ini = require('ini');
const del = require('del');
const Promise = require('pinkie-promise');
const sanitizeFilename = require('sanitize-filename');
const mkdirp = require('mkdirp');
const url = require('url');
const decamelizeKeys = require('decamelize-keys');

const TAG_PATH = '.git/refs/tags';
const BRANCH_PATH = '.git/refs/heads';
const GIT_CONFIG_PATH = '.git/config';

function execCommand(gitArgs) {
	return new Promise((resolve, reject) => {
		console.log('starting: ', `git ${gitArgs.join(' ')}`);

		const child = childProcess.spawn('git', gitArgs);
		child.stdout.pipe(process.stdout);
		child.stderr.pipe(process.stderr);
		child.on('close', code => {
			if (code === 0) {
				resolve();
			} else {
				reject(new Error('git svn clone failed'));
			}
		});
	});
}

function parseOptions(options) {
	const gitArgs = [];
	if (options) {
		options = decamelizeKeys(options, '-');
		for (const key of Object.keys(options)) {
			if (typeof options[key] === 'boolean') {
				gitArgs.push(`--${key}`);
			} else {
				gitArgs.push(`--${key}=${options[key]}`);
			}
		}
	}
	return gitArgs;
}

function migrate() {}

migrate.clone = function (svnRepoUrl, options) {
	const urlParts = url.parse(svnRepoUrl);
	const urlPathList = urlParts.path.replace(/\/+$/, '').split('/');
	const repoName = urlPathList.pop();
	del.sync(repoName);

	const gitArgs = [
		'svn',
		'clone'
	];
	gitArgs.push(svnRepoUrl);
	gitArgs.push('--stdlayout');
	gitArgs.push('--prefix=origin/');

	return execCommand(gitArgs.concat(parseOptions(options))).then(() => Promise.resolve(repoName));
};
{'fraction_non_alphanumeric': 0.19249781913346903, 'fraction_numerical': 0.0005815644082582146, 'mean_word_length': 4.639344262295082, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3237179', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1156, 'n_words': 238}