from atlassian import Stash

stash = Stash(
    url='http://localhost:7990',
    username='******',
    password='******')

changelog = stash.get_changelog(
    project='DEMO',
    repository='example-repository',
    ref_from='develop',
    ref_to='master')

print(changelog)
示例#2
0
from pprint import pprint
from atlassian import Stash


def html(project):
    html = '<tr><td>{project_key}</td><td>{project_name}</td><td><ul>'.format(**project)
    for user in project['project_administrators']:
        html += '\n\t<li><a href="mailto:{email}">{name}</a></li>'.format(**user)
    return html + '</ul></td></tr>\n'

stash = Stash(
    url='http://localhost:7990',
    username='******',
    password='******')

data = stash.project('DEMO')
pprint(html(data))
import logging
from atlassian import Stash


logging.basicConfig(level=logging.DEBUG, format='[%(asctime).19s] [%(levelname)s] %(message)s')
logging.getLogger('requests').setLevel(logging.WARNING)
log = logging.getLogger('stash-projects-administrators')

stash = Stash(
    url='http://localhost:7990',
    username='******',
    password='******')

html = '<table><tr><th>Project Key</th><th>Project Name</th><th>Administrator</th></tr>'

for data in stash.all_project_administrators():
    html += '<tr><td>{project_key}</td><td>{project_name}</td><td><ul>'.format(**data)
    for user in data['project_administrators']:
        html += '<li><a href="mailto:{email}">{name}</a></li>'.format(**user)
    html += '</ul></td></tr>'

html += '</table><p></p><p></p>'

print(html)
Clean branches for closed issues
"""
PROJECT_KEY = 'PROJ'
REPOS = ['repo1', 'repo2']
ACCEPTED_ISSUE_STATUSES = ["Closed", "Verified"]
EXCLUDE_REPO_RULES = config.exclude_parameters
LAST_COMMIT_CONDITION_IN_DAYS = 75
ATLASSIAN_USER = config.JIRA_LOGIN
ATLASSIAN_PASSWORD = config.JIRA_PASSWORD
JIRA_URL = "http://localhost:8080"

logging.basicConfig(level=logging.ERROR)
jira = Jira(url=JIRA_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD)

stash = Stash(url=config.STASH_URL,
              username=ATLASSIAN_USER,
              password=ATLASSIAN_PASSWORD)

flag = True
time_now = int(time.time()) * 1000
delta_for_time_ms = LAST_COMMIT_CONDITION_IN_DAYS * 24 * 60 * 60 * 1000
commit_info_key = "com.atlassian.bitbucket.server.bitbucket-branch:latest-commit-metadata"
out_going_pull_request = "com.atlassian.bitbucket.server.bitbucket-ref-metadata:outgoing-pull-request-metadata"
branch_related_issues = "com.atlassian.bitbucket.server.bitbucket-jira:branch-list-jira-issues"


def is_can_removed_branch(branch_candidate):
    branch_id_name = branch_candidate.get('id')
    # Just exclude exist mainstream branches
    if any(x in branch_id_name for x in EXCLUDE_REPO_RULES):
        print(branch.get('displayId') + " in exclusion list")
示例#5
0
 def test_init_stash(self):
     stash = Stash(url=STASH_URL,
                   username=ATLASSIAN_USER,
                   password=ATLASSIAN_PASSWORD)
from pprint import pprint
from atlassian import Stash


def html(project):
    html = '<tr><td>{project_key}</td><td>{project_name}</td><td><ul>'.format(**project)
    for user in project['project_administrators']:
        html += '\n\t<li><a href="mailto:{email}">{name}</a></li>'.format(**user)
    return html + '</ul></td></tr>\n'

stash = Stash(
    url='http://localhost:7990',
    username='******',
    password='******')

data = stash.project('DEMO')
pprint(html(data))
示例#7
0
Clean branches for closed issues
"""
PROJECT_KEY = "PROJ"
REPOS = ["repo1", "repo2"]
ACCEPTED_ISSUE_STATUSES = ["Closed", "Verified"]
EXCLUDE_REPO_RULES = ["refs/heads/release/", "refs/heads/master/", "development"]
LAST_COMMIT_CONDITION_IN_DAYS = 75
ATLASSIAN_USER = "******"
ATLASSIAN_PASSWORD = "******"
JIRA_URL = "http://localhost:8080"
STASH_URL = "http://localhost:5999"

logging.basicConfig(level=logging.ERROR)
jira = Jira(url=JIRA_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD)

stash = Stash(url=STASH_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD)

flag = True
time_now = int(time.time()) * 1000
delta_for_time_ms = LAST_COMMIT_CONDITION_IN_DAYS * 24 * 60 * 60 * 1000
commit_info_key = "com.atlassian.bitbucket.server.bitbucket-branch:latest-commit-metadata"
out_going_pull_request = "com.atlassian.bitbucket.server.bitbucket-ref-metadata:outgoing-pull-request-metadata"
branch_related_issues = "com.atlassian.bitbucket.server.bitbucket-jira:branch-list-jira-issues"


def is_can_removed_branch(branch_candidate):
    branch_id_name = branch_candidate.get("id")
    # Just exclude exist mainstream branches
    if any(x in branch_id_name for x in EXCLUDE_REPO_RULES):
        print(branch.get("displayId") + " in exclusion list")
        return False
import logging
from atlassian import Stash

logging.basicConfig(level=logging.DEBUG,
                    format='[%(asctime).19s] [%(levelname)s] %(message)s')
logging.getLogger('requests').setLevel(logging.WARNING)
log = logging.getLogger('stash-projects-administrators')

stash = Stash(url='http://localhost:7990', username='******', password='******')

html = '<table><tr><th>Project Key</th><th>Project Name</th><th>Administrator</th></tr>'

for data in stash.all_project_administrators():
    html += '<tr><td>{project_key}</td><td>{project_name}</td><td><ul>'.format(
        **data)
    for user in data['project_administrators']:
        html += '<li><a href="mailto:{email}">{name}</a></li>'.format(**user)
    html += '</ul></td></tr>'

html += '</table><p></p><p></p>'

print(html)
示例#9
0
from atlassian import Stash

stash = Stash(url='http://localhost:7990', username='******', password='******')

changelog = stash.get_changelog(project='DEMO',
                                repository='example-repository',
                                ref_from='develop',
                                ref_to='master')

print(changelog)