Пример #1
0
        internal static bool ExistsAttributeName(
            RestApi restApi,
            string repository,
            string attributeName)
        {
            string query = string.Format("attributetype where name='{0}' ", attributeName);

            JArray findResult = TrunkMergebotApi.Find(
                restApi,
                repository,
                query,
                DATE_FORMAT,
                "retrieve the list of attributes named " + attributeName,
                new string[] { "name" });

            return(findResult != null && findResult.Count > 0);
        }
Пример #2
0
        internal static string GetBranchName(
            RestApi restApi, string repository, string branchId)
        {
            string query = string.Format("branch where id={0}", branchId);

            JArray findResult = TrunkMergebotApi.Find(
                restApi,
                repository,
                query,
                DATE_FORMAT,
                "retrieve a single branch by ID",
                new string[] { "name" });

            if (findResult.Count == 0)
            {
                return(string.Empty);
            }

            return(GetStringValue((JObject)findResult[0], "name"));
        }
Пример #3
0
        internal static List <Branch> FindResolvedBranches(
            RestApi restApi,
            string repository,
            string prefix,
            string statusAttributeName,
            string resolvedStatusAttributeValue)
        {
            string query = string.Format(
                "branch where ( name like '{0}%' or name like '{1}%' or name like '{2}%' ) " +
                "and date > '{3}' " +
                "and attribute='{4}' and ( attrvalue='{5}' or attrvalue='{6}' or attrvalue='{7}') ",
                prefix,
                prefix.ToLowerInvariant(),
                prefix.ToUpperInvariant(),
                DateTime.Now.AddYears(-1).ToString(DATE_FORMAT),
                statusAttributeName,
                resolvedStatusAttributeValue,
                resolvedStatusAttributeValue.ToLowerInvariant(),
                resolvedStatusAttributeValue.ToUpperInvariant());

            JArray findResult = TrunkMergebotApi.Find(
                restApi,
                repository,
                query,
                DATE_FORMAT,
                "retrieve the list of branches to process",
                new string[] { "id", "name", "owner", "comment" });

            List <Branch> result = new List <Branch>();

            foreach (JObject obj in findResult)
            {
                result.Add(new Branch(
                               repository,
                               GetStringValue(obj, "id"),
                               GetStringValue(obj, "name"),
                               GetStringValue(obj, "owner"),
                               GetStringValue(obj, "comment")));
            }
            return(result);
        }