using System.Collections.Generic;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace TGServiceInterface
{
///
/// Information about a pull request
///
[DataContract]
public class PullRequestInfo
{
///
/// Construct a PullRequestInfo
///
/// The PR number
/// The PR's author
/// The PR's title
/// The commit the PR was merged locally at
public PullRequestInfo(int number, string author, string title, string sha)
{
Number = number;
Author = author;
Title = title;
Sha = sha;
}
///
/// The PR number
///
[DataMember]
public int Number { get; private set; }
///
/// The PR's author
///
[DataMember]
public string Author { get; private set; }
///
/// The PR's title
///
[DataMember]
public string Title { get; private set; }
///
/// The commit the PR was merged locally at
///
[DataMember]
public string Sha { get; private set; }
}
///
/// Interface for managing the code repository
///
[ServiceContract]
public interface ITGRepository
{
///
/// If the repo is currently undergoing an operation
///
/// true if the repo is busy, false otherwise
[OperationContract]
bool OperationInProgress();
///
/// Gets the progress of repository operations, not all operations are supported
///
/// A value between 0 and 100 representing the progress of the current operation or -1 if the operation cannot be monitored
[OperationContract]
int CheckoutProgress();
///
/// Check if the repository is valid, if not Setup must be called
///
/// true if the repository is valid, false otherwise
[OperationContract]
bool Exists();
///
/// Deletes whatever may be left over and clones the repo at remote and checks out branch master
/// Will move config and data dirs to a backup location if they exist
/// runs asyncronously
///
/// The address of the repo to clone. If ssh protocol is used, repository_private_key.txt must exist in the server directory.
/// The branch of the repo to checkout
/// null on success, error message on failure
[OperationContract]
string Setup(string remote, string branch = "master");
///
/// Gets the sha of the current HEAD
///
/// If set to true and HEAD is currently a branch, will instead return the sha of the tracked remote branch if it exists
/// null on success, error message on failure
/// The sha of the current HEAD on success, null on failure
[OperationContract]
string GetHead(bool useTracked, out string error);
///
/// Gets the name of the current branch
///
/// null on success, error message on failure
/// The name of the current branch on success, null on failure
[OperationContract]
string GetBranch(out string error);
///
/// Gets the url of the current origin
///
/// null on success, error message on failure
/// The url of the current origin on success, null on failure
[OperationContract]
string GetRemote(out string error);
///
/// Hard checks out the passed object name
///
/// The branch, commit, or tag to checkout
/// null on success, error message on failure
[OperationContract]
string Checkout(string objectName);
///
/// Fetches the origin and merges it into the current branch
///
/// If true, the operation will perform a hard reset instead of a merge
/// null on success, error message on failure
[OperationContract]
string Update(bool reset);
///
/// Runs git reset --hard
///
/// Changes command to git reset --hard origin/branch_name if true
/// null on success, error message on failure
[OperationContract]
string Reset(bool tracked);
///
/// Merges the target pull request into the current branch if the remote is a github repository
///
/// The github pull request number in the remote repository
/// null on success, error message on failure
[OperationContract]
string MergePullRequest(int PRnumber);
//Returns a list of PR# -> Sha of the currently merged pull requests
//returns null on failure and error will be set
///
/// Get the currently merged pull requests. Note that switching branches will delete this list and switching back won't restore it
///
/// null on success, error message on failure
/// A list of PullRequestInfo
[OperationContract]
IList MergedPullRequests(out string error);
///
/// Gets the name of the configured git committer
///
/// The name of the configured git committer
[OperationContract]
string GetCommitterName();
///
/// Sets the name of the configured git committer
///
/// The name to set
[OperationContract]
void SetCommitterName(string newName);
///
/// Gets the email of the configured git committer
///
/// The email of the configured git committer
[OperationContract]
string GetCommitterEmail();
///
/// Sets the email of the configured git committer
///
/// The email to set
[OperationContract]
void SetCommitterEmail(string newEmail);
///
/// Updates the html changelog
///
/// null on success, error on failure
/// The output of the python script
[OperationContract]
string GenerateChangelog(out string error);
///
/// Pushes the changelog to the currently git, this operation will only run if the changelog is the only difference to be pushed (i.e. no PRs merged)
///
/// null on success, error on failure
[OperationContract]
string PushChangelog();
///
/// Sets the path to the python 2.7 installation
///
/// The new path
/// true if the path exists, false otherwise
[OperationContract]
bool SetPythonPath(string path);
///
/// Gets the path to the python 2.7 installation
///
/// The path to the python 2.7 installation
[OperationContract]
string PythonPath();
///
/// List the tagged commits of the repo at which compiles took place
///
/// null on success, error message on failure
/// A dictionary of tag name -> commit on success, null on failure
[OperationContract]
IDictionary ListBackups(out string error);
///
/// Updates the cached TGS3.json to the repo's version
/// Compiles will not succeed if these two to not match
///
/// null on success, error message on failure
[OperationContract]
string UpdateTGS3Json();
}
}