org.jenkinsci.plugins.pretestedintegration
Class HgUtils

java.lang.Object
  extended by org.jenkinsci.plugins.pretestedintegration.HgUtils

public class HgUtils
extends Object

Collection of static methods for interacting with Mercurial. TODO: All functionality in this class must be moved once we finish our design for interacting with different SCMs through a single interface.


Constructor Summary
HgUtils()
           
 
Method Summary
static hudson.util.ArgumentListBuilder createArgumentListBuilder(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          Get an interface to the Mercurial executable corresponding to the current build.
static Hashtable<String,String> getCommitInfoByRev(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener, String rev)
          Returns a dictionary with the fields "changeset", "branch", "user", "date", "message" for a given revision.
static Hashtable<String,String> getNewestCommitInfo(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          Returns a dictionary with the fields "changeset", "branch", "user", "date", "message".
static BufferedReader runScmCommand(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener, hudson.util.ArgumentListBuilder cmd)
          Run an Mercurial command given an ArgumentListBuilder describing the arguments.
static BufferedReader runScmCommand(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener, String[] command)
          Run an Mercurial command given a list of arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HgUtils

public HgUtils()
Method Detail

createArgumentListBuilder

public static hudson.util.ArgumentListBuilder createArgumentListBuilder(hudson.model.AbstractBuild build,
                                                                        hudson.Launcher launcher,
                                                                        hudson.model.BuildListener listener)
                                                                 throws IOException,
                                                                        InterruptedException
Get an interface to the Mercurial executable corresponding to the current build.

Parameters:
AbstractBuild -
Launcher -
BuildListener -
Throws:
IOException
InterruptedException

runScmCommand

public static BufferedReader runScmCommand(hudson.model.AbstractBuild build,
                                           hudson.Launcher launcher,
                                           hudson.model.BuildListener listener,
                                           String[] command)
                                    throws hudson.AbortException,
                                           IOException,
                                           InterruptedException
Run an Mercurial command given a list of arguments.

Parameters:
AbstractBuild -
Launcher -
BuildListener -
String[] - List of arguments for the Mercurial executable.
Returns:
A reader through which one can get the output of the command.
Throws:
hudson.AbortException
IOException
InterruptedException

runScmCommand

public static BufferedReader runScmCommand(hudson.model.AbstractBuild build,
                                           hudson.Launcher launcher,
                                           hudson.model.BuildListener listener,
                                           hudson.util.ArgumentListBuilder cmd)
                                    throws hudson.AbortException,
                                           IOException,
                                           InterruptedException
Run an Mercurial command given an ArgumentListBuilder describing the arguments.

Parameters:
AbstractBuild -
Launcher -
BuildListener -
ArgumentListBuilder - Argument list describing what to pass to the Mercurial executable.
Returns:
BufferedReader
Throws:
hudson.AbortException
IOException
InterruptedException

getNewestCommitInfo

public static Hashtable<String,String> getNewestCommitInfo(hudson.model.AbstractBuild build,
                                                           hudson.Launcher launcher,
                                                           hudson.model.BuildListener listener)
                                                    throws IOException,
                                                           InterruptedException,
                                                           hudson.AbortException
Returns a dictionary with the fields "changeset", "branch", "user", "date", "message". Each field will be null if the corresponding field is not defined in the log. Except, "branch" will be default if the commit is made on the default branch.

Parameters:
AbstractBuild -
Launcher -
BuildListener -
Returns:
Throws:
IOException
InterruptedException
hudson.AbortException

getCommitInfoByRev

public static Hashtable<String,String> getCommitInfoByRev(hudson.model.AbstractBuild build,
                                                          hudson.Launcher launcher,
                                                          hudson.model.BuildListener listener,
                                                          String rev)
                                                   throws IOException,
                                                          InterruptedException,
                                                          hudson.AbortException
Returns a dictionary with the fields "changeset", "branch", "user", "date", "message" for a given revision. Each field will be null if the corresponding field is not defined in the log. Except, "branch" will be default if the commit is made on the default branch.

Parameters:
AbstractBuild -
Launcher -
BuildListener -
Returns:
Throws:
IOException
InterruptedException
hudson.AbortException


Copyright © 2004-2013. All Rights Reserved.