Пример #1
0
    def testValidPushlog(self):
        pushes = _parse_changes(validPushlog)
        self.failUnlessEqual(len(pushes), 2)

        self.failUnlessEqual(pushes[0]['changesets'][0]['node'],
                             '4c23e51a484f077ea27af3ea4a4ee13da5aeb5e6')
        self.failUnlessEqual(pushes[0]['date'], 1282358416)
        self.failUnlessEqual(len(pushes[0]['changesets'][0]['files']), 4)
        self.failUnlessEqual(pushes[0]['changesets'][0]['branch'],
                             'GECKO20b5pre_20100820_RELBRANCH')
        self.failUnlessEqual(pushes[0]['changesets'][0]['author'],
                             'Jim Chen <*****@*****.**>')
        self.failUnlessEqual(pushes[0]['user'], '*****@*****.**')

        self.failUnlessEqual(pushes[1]['changesets'][0]['node'],
                             'ee6fb954cbc3de0f76e84cad6bdff452116e1b03')
        self.failUnlessEqual(pushes[1]['date'], 1282362551)
        self.failUnlessEqual(len(pushes[1]['changesets'][0]['files']), 7)
        self.failUnlessEqual(pushes[1]['changesets'][0]['branch'], 'default')
        self.failUnlessEqual(pushes[1]['user'], '*****@*****.**')
        self.failUnlessEqual(pushes[1]['changesets'][0]['author'],
                             'Bobby Holley <*****@*****.**>')

        self.failUnlessEqual(pushes[1]['changesets'][1]['node'],
                             '33be08836cb164f9e546231fc59e9e4cf98ed991')
        self.failUnlessEqual(len(pushes[1]['changesets'][1]['files']), 1)
        self.failUnlessEqual(pushes[1]['changesets'][1]['branch'], 'default')
        self.failUnlessEqual(pushes[1]['changesets'][1]['author'],
                             'Bobby Holley <*****@*****.**>')
Пример #2
0
    def testValidPushlog(self):
        pushes = hgpoller._parse_changes(validPushlog)
        self.failUnlessEqual(len(pushes), 2)

        self.failUnlessEqual(pushes[0]['changesets'][0]['node'],
                             '4c23e51a484f077ea27af3ea4a4ee13da5aeb5e6')
        self.failUnlessEqual(pushes[0]['date'], 1282358416)
        self.failUnlessEqual(len(pushes[0]['changesets'][0]['files']), 4)
        self.failUnlessEqual(pushes[0]['changesets'][0]['branch'],
                             'GECKO20b5pre_20100820_RELBRANCH')
        self.failUnlessEqual(pushes[0]['changesets'][0]['author'],
                             'Jim Chen <*****@*****.**>')
        self.failUnlessEqual(pushes[0]['user'], '*****@*****.**')

        self.failUnlessEqual(pushes[1]['changesets'][0]['node'],
                             'ee6fb954cbc3de0f76e84cad6bdff452116e1b03')
        self.failUnlessEqual(pushes[1]['date'], 1282362551)
        self.failUnlessEqual(len(pushes[1]['changesets'][0]['files']), 7)
        self.failUnlessEqual(pushes[1]['changesets'][0]['branch'], 'default')
        self.failUnlessEqual(pushes[1]['user'], '*****@*****.**')
        self.failUnlessEqual(pushes[1]['changesets'][0]['author'],
                             'Bobby Holley <*****@*****.**>')

        self.failUnlessEqual(pushes[1]['changesets'][1]['node'],
                             '33be08836cb164f9e546231fc59e9e4cf98ed991')
        self.failUnlessEqual(len(pushes[1]['changesets'][1]['files']), 1)
        self.failUnlessEqual(pushes[1]['changesets'][1]['branch'], 'default')
        self.failUnlessEqual(pushes[1]['changesets'][1]['author'],
                             'Bobby Holley <*****@*****.**>')
Пример #3
0
def getChanges(base_url,
               last_changeset=None,
               tips_only=False,
               ca_certs=None,
               username=None,
               password=None):
    bits = urlparse.urlparse(base_url)
    if bits.scheme == 'https':
        assert ca_certs, "you must specify ca_certs"

    params = [('full', '1')]
    if last_changeset:
        params.append(('fromchange', last_changeset))
    if tips_only:
        params.append(('tipsonly', '1'))
    url = "%s/json-pushes?%s" % (base_url, urllib.urlencode(params))

    log.debug("Fetching %s", url)

    if bits.scheme == 'https':
        handle = validating_https_open(url, ca_certs, username, password)
    else:
        handle = urllib2.urlopen(url)

    data = handle.read()
    return _parse_changes(data)
Пример #4
0
    def testValidPushlog(self):
        changes = _parse_changes(validPushlog)
        self.failUnlessEqual(len(changes), 3)

        self.failUnlessEqual(changes[0]['changeset'], '4c23e51a484f077ea27af3ea4a4ee13da5aeb5e6')
        self.failUnlessEqual(changes[0]['updated'], 1282358416)
        self.failUnlessEqual(len(changes[0]['files']), 4)
        self.failUnlessEqual(changes[0]['branch'], 'GECKO20b5pre_20100820_RELBRANCH')
        self.failUnlessEqual(changes[0]['author'], '*****@*****.**')

        self.failUnlessEqual(changes[1]['changeset'], 'ee6fb954cbc3de0f76e84cad6bdff452116e1b03')
        self.failUnlessEqual(changes[1]['updated'], 1282362551)
        self.failUnlessEqual(len(changes[1]['files']), 7)
        self.failUnlessEqual(changes[1]['branch'], 'default')
        self.failUnlessEqual(changes[1]['author'], '*****@*****.**')

        self.failUnlessEqual(changes[2]['changeset'], '33be08836cb164f9e546231fc59e9e4cf98ed991')
        self.failUnlessEqual(changes[2]['updated'], 1282362551)
        self.failUnlessEqual(len(changes[2]['files']), 1)
        self.failUnlessEqual(changes[2]['branch'], 'default')
        self.failUnlessEqual(changes[2]['author'], '*****@*****.**')
Пример #5
0
def getChanges(base_url, last_changeset=None, tips_only=False, ca_certs=None,
        username=None, password=None):
    bits = urlparse.urlparse(base_url)
    if bits.scheme == 'https':
        assert ca_certs, "you must specify ca_certs"

    params = [('full', '1')]
    if last_changeset:
        params.append( ('fromchange', last_changeset) )
    if tips_only:
        params.append( ('tipsonly', '1') )
    url = "%s/json-pushes?%s" % (base_url, urllib.urlencode(params))

    log.debug("Fetching %s", url)

    if bits.scheme == 'https':
        handle = validating_https_open(url, ca_certs, username, password)
    else:
        handle = urllib2.urlopen(url)

    data = handle.read()
    return _parse_changes(data)