Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Locate a build from a not default branch by a build number #67

Open
picbeats opened this issue Feb 26, 2014 · 0 comments
Open

Locate a build from a not default branch by a build number #67

picbeats opened this issue Feb 26, 2014 · 0 comments

Comments

@picbeats
Copy link

Default behavior of TC REST API is that if not explicitly specified the locator gets only builds on the default branch.
Request "/httpAuth/app/rest/builds?locator=number:10999"
does not work if build 10999 is not on default branch. It is documented, thought not quite obvious behavior. Unfortunately, in the 3.5 release it isn't possible to specify build number and branch in the same locator. To solve this i modified WithDimensions method to accept the build number.

Now i can search like this:
// find build by number and build type id
var bl = BuildLocator.WithDimensions(
number:"10999",
branch:"default:any",
buildType: BuildTypeLocator.WithId("MyBuildId"));

Subject: [PATCH] Specifiy number in the dimensions locator


src/TeamCitySharp/Locators/BuildLocator.cs | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/TeamCitySharp/Locators/BuildLocator.cs b/src/TeamCitySharp/Locators/BuildLocator.cs
index 1823d6d..bcd12b1 100644
--- a/src/TeamCitySharp/Locators/BuildLocator.cs
+++ b/src/TeamCitySharp/Locators/BuildLocator.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;

namespace TeamCitySharp.Locators
@@ -40,7 +40,9 @@ namespace TeamCitySharp.Locators
BuildLocator sinceBuild = null,
DateTime? sinceDate = null,
string[] tags = null,

  •                                              string branch = null
    
  •                                              string branch = null,
    
  •                                              string number = null
    
    •    )
      
      {
      return new BuildLocator
      @@ -58,7 +60,8 @@ namespace TeamCitySharp.Locators
      SinceBuild = sinceBuild,
      SinceDate = sinceDate,
      Tags = tags,
  •                       Branch = branch
    
  •                       Branch = branch,
    
  •                       Number = number
                    };
     }
    

@@ -86,13 +89,13 @@ namespace TeamCitySharp.Locators
return "id:" + Id;
}

  •        if (Number != null)
    
  •        {
    
  •            return "number:" + Number;
    

- }

         var locatorFields = new List<string>();
  •       if (Number != null)
    
  •       {
    
  •           locatorFields.Add("number:" + Number);
    
  •       }
    
    •    if (BuildType != null)
         {
             locatorFields.Add("buildType:(" + BuildType + ")");
      
    --
    1.8.3.msysgit.0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant