if configuration.preferredLibType == 'REST':

    # get the configuration properties from the UI
    params = {
        'url': configuration.url,
        'username': configuration.username,
        'password': configuration.password,
        'proxyHost': configuration.proxyHost,
        'proxyPort': configuration.proxyPort,
        'domain': configuration.domain,
        'authenticationMethod': configuration.authenticationMethod
    }

    # do an http request to the server
    response = HttpRequest(params).get('/_apis/projectcollections',
                                       contentType='application/json')

    # check response status code, if is different than 200 exit with error code
    if response.status != 200:
        sys.exit(1)
elif configuration.preferredLibType == 'SDK':
    System.setProperty("com.microsoft.tfs.jni.native.base-directory",
                       os.getcwd() + "/conf/native")

    collectionUrl = configuration.url + "/"
    if configuration.authenticationMethod == 'Ntlm':
        credentials = NTCredentials(configuration.username,
                                    configuration.domain,
                                    configuration.password)
    else:
        credentials = UsernamePasswordCredentials(configuration.username,
Exemple #2
0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

import json
from xlrhttp.HttpRequest import HttpRequest

if tfsServer is None:
    print "No server provided"
    sys.exit(1)

request = HttpRequest(tfsServer, username, password, domain)
url = "%s/%s/_apis/tfvc/changesets?api-version=1.0" % (collection, project)

response = request.get(url)

if not response.isSuccessful():
    raise Exception(
        "Error in getting repositories. Server return [%s], with content [%s]"
        % (response.status, response.response))

json_object = json.loads(response.response)

commits = json_object["value"]
latest_commit = commits[0]
changesetId = latest_commit["changesetId"]
Exemple #3
0
#
# Copyright 2017 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

import sys
from xlrhttp.HttpRequest import HttpRequest

# get the configuration properties from the UI
params = {
    'url': configuration.url,
    'username': configuration.username,
    'password': configuration.password,
    'proxyHost': configuration.proxyHost,
    'proxyPort': configuration.proxyPort
}

# do an http request to the server
response = HttpRequest(params).get(configuration.apiUrl + 'getworkspaces',
                                   contentType='application/json')

# check response status code, if is different than 200 exit with error code
if response.status != 200:
    sys.exit(1)