<commit_before>package org.jenkinsci.plugins.pretestedintegration.scm.mercurial;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.logging.Logger;

import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.AbstractProject;
import hudson.model.Node;
import hudson.model.TaskListener;
import hudson.plugins.mercurial.HgExe;
import hudson.plugins.mercurial.MercurialSCM;
import hudson.plugins.mercurial.MercurialTagAction;
import hudson.plugins.mercurial.PollComparator;
import hudson.scm.PollingResult.Change;
import hudson.scm.SCM;

@Extension
public class MercurialComparator extends PollComparator {

	private String LOG_PREFIX = "[PREINT-HG] ";
	
	@Override
	public Change compare(SCM scm, Launcher launcher, TaskListener listener, MercurialTagAction baseline, PrintStream output, Node node, FilePath repository, AbstractProject<?,?> project) 
			throws IOException, InterruptedException {
		
		logger.finest("Entering MercurialComparator compare");
		listener.getLogger().println(LOG_PREFIX + "Entering comparator, this is going to be exiting!");
		HgExe hg = new HgExe((MercurialSCM) scm, launcher, node, listener, new EnvVars());
		
		hg.run("pull").join();
		
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		int exitCode = hg.run("log","-r","not(branch(default))","--template","{node}\n").stdout(out).join();
		
		
		if(exitCode == 0 && out.size() > 0) {
			listener.getLogger().println(LOG_PREFIX + "Changes found, triggering build");
			return Change.SIGNIFICANT;
		}
		
		logger.finest("Exiting MercurialComparator compare without result");
		listener.getLogger().println(LOG_PREFIX + "No changes found. Move along, nothing to see here.");
		return Change.NONE;
	}
	
	private static final long serialVersionUID = 1L;
	private static Logger logger = Logger.getLogger(MercurialComparator.class.getName());
}
<commit_msg>hg calls now uses the correct workspace<commit_after>package org.jenkinsci.plugins.pretestedintegration.scm.mercurial;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.logging.Logger;

import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.AbstractProject;
import hudson.model.Node;
import hudson.model.TaskListener;
import hudson.plugins.mercurial.HgExe;
import hudson.plugins.mercurial.MercurialSCM;
import hudson.plugins.mercurial.MercurialTagAction;
import hudson.plugins.mercurial.PollComparator;
import hudson.scm.PollingResult.Change;
import hudson.scm.SCM;

@Extension
public class MercurialComparator extends PollComparator {

	private String LOG_PREFIX = "[PREINT-HG] ";
	
	@Override
	public Change compare(SCM scm, Launcher launcher, TaskListener listener, MercurialTagAction baseline, PrintStream output, Node node, FilePath repository, AbstractProject<?,?> project) 
			throws IOException, InterruptedException {
		
		logger.finest("Entering MercurialComparator compare");
		listener.getLogger().println(LOG_PREFIX + "Entering comparator, this is going to be exiting!");
		HgExe hg = new HgExe((MercurialSCM) scm, launcher, node, listener, new EnvVars());
		
		hg.run("pull").pwd(project.getWorkspace()).join();
		
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		int exitCode = hg.run("log","-r","not(branch(default))","--template","{node}\n").stdout(out).pwd(project.getWorkspace()).join();
		
		
		if(exitCode == 0 && out.size() > 0) {
			listener.getLogger().println(LOG_PREFIX + "Changes found, triggering build");
			return Change.SIGNIFICANT;
		}
		
		logger.finest("Exiting MercurialComparator compare without result");
		listener.getLogger().println(LOG_PREFIX + "No changes found. Move along, nothing to see here.");
		return Change.NONE;
	}
	
	private static final long serialVersionUID = 1L;
	private static Logger logger = Logger.getLogger(MercurialComparator.class.getName());
}

{'fraction_non_alphanumeric': 0.11544227886056972, 'fraction_numerical': 0.0014992503748125937, 'mean_word_length': 5.842735042735042, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3961920', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1194, 'n_words': 280}