Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Changes by ChangeId and By BuildLocator #112

Open
sebingel opened this issue Feb 9, 2018 · 2 comments
Open

Get Changes by ChangeId and By BuildLocator #112

sebingel opened this issue Feb 9, 2018 · 2 comments

Comments

@sebingel
Copy link

sebingel commented Feb 9, 2018

Feature Request

Expose a method from which i can get changes from the TeamCity API.
Something like IConnectedTc.GetChanges(IChangesHavingBuilder having)
Changes are already present but are only accessible from an IBuild.
It would be nice to i.e. retrieve changes by the corresponding git commit hash:
/app/rest/changes/version:GITHASH
or get pending changes for a branch in a buildconfiguration:
/app/rest/changes?locator=buildType:(id:BUILDCONFIGID),pending:true,branch:BRANCHNAME

[Test]
public void GetChangesByChangeId()
{
    var changes = new RemoteTc(c=>c.ToHost("HOST").AsGuest())
        .GetChanges(c => c.ChangeId("GITHASH"))
}

[Test]
public void GetChangesByBuildLocator()
{
    var changes = new RemoteTc(c=>c.ToHost("HOST").AsGuest())
        .GetChanges(
            c => c.Build( 
                b => b.BuildConfiguration(
                    t => t.Id("BUILDCONFIGID"))
                .IsPending()
                .OnBranch(b => b.Name("BRANCHNAME"))
        )
    );
}

Affected versions

Product Version
FluentTc 0.0.0.249
TeamCity 2017.2.2 (build 50909)
Autofac
EasyHttp
SharpZipLib
System.IO.Abstractions
TeamCity.ServiceMessages
@borismod
Copy link
Contributor

@sebingel thank you for opening this issue. Does the tests I've added make sense?

@borismod borismod changed the title Get Changes without IBuild Get Changes by ChangeId and By BuildLocator Feb 12, 2018
@sebingel
Copy link
Author

sebingel commented Feb 13, 2018

@borismod sort of.
Test 1 should be .GetChanges(c => c.Version("GITHASH")).
TeamCity API calls the VCS revision Version. Although a .GetChanges(c => c.ChangeId("CHANGEID")) would be nice too.

In Test 2 it looks like you want to get the changes for a certain build. Am i right?
The API call /app/rest/changes?locator=buildType:(id:BUILDCONFIGID),pending:true,branch:BRANCHNAME gets changes for a certain buildconfiguration and branch and pending refers to the changes too, not the build.

var changes = new RemoteTc(c=>c.ToHost("HOST").AsGuest())
				.GetChanges(c => c.BuildConfiguration(bc => bc.Id("BUILDCONFIGID"))
				.IsPending().OnBranch("BRANCHNAME"));

I hope that makes some sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants