<commit_before>package crystal.server;

import java.io.File;
import java.io.IOException;

import org.junit.Assert;

import crystal.client.ProjectPreferences;
import crystal.model.ConflictResult.ResultStatus;
import crystal.model.DataSource;
import crystal.util.RunIt;
import crystal.util.TimeUtility;

/**
 * Performs hg clone operations.  
 * Acts as the back end for Crystal.
 * 
 * @author brun
 * 
 */
public class HgStateChecker {


	/*
	 * @arg String pathToHg: the path to the hg executable
	 * @arg String pathToRepo: the full path to the remote repo
	 * @arg String tempWorkPath: path to a temp directory
	 * @return: Whether or not the pathToRepo is a valid hg repository
	 */
	public static boolean isHGRepository(String pathToHg, String pathToRepo, String tempWorkPath) throws IOException {
		Assert.assertNotNull(pathToHg);
		Assert.assertNotNull(pathToRepo);
		Assert.assertNotNull(tempWorkPath);
		
		String[] myArgs = { "clone", pathToRepo };
		String output = RunIt.execute(pathToHg, myArgs, tempWorkPath);
		
		return (output.indexOf("does not appear to be an hg repository!") < 0);
	}<commit_msg>made HgStateChecker.isHGRepository clean up after itself<commit_after>package crystal.server;

import java.io.File;
import java.io.IOException;

import org.junit.Assert;

import crystal.client.ProjectPreferences;
import crystal.model.ConflictResult.ResultStatus;
import crystal.model.DataSource;
import crystal.util.RunIt;
import crystal.util.TimeUtility;

/**
 * Performs hg clone operations.  
 * Acts as the back end for Crystal.
 * 
 * @author brun
 * 
 */
public class HgStateChecker {


	/*
	 * @arg String pathToHg: the path to the hg executable
	 * @arg String pathToRepo: the full path to the remote repo
	 * @arg String tempWorkPath: path to a temp directory
	 * @return: Whether or not the pathToRepo is a valid hg repository
	 */
	public static boolean isHGRepository(String pathToHg, String pathToRepo, String tempWorkPath) throws IOException {
		Assert.assertNotNull(pathToHg);
		Assert.assertNotNull(pathToRepo);
		Assert.assertNotNull(tempWorkPath);
		
		String[] myArgs = { "clone", pathToRepo };
		String output = RunIt.execute(pathToHg, myArgs, tempWorkPath + "status_check");
		
		RunIt.deleteDirectory(new File(tempWorkPath + "status_check"));
		
		return (output.indexOf("does not appear to be an hg repository!") < 0);
	}
{'fraction_non_alphanumeric': 0.09368376430690971, 'fraction_numerical': 0.000847816871555744, 'mean_word_length': 4.605700712589074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '916817', 'n_tokens_mistral': 745, 'n_tokens_neox': 694, 'n_words': 219}