fixed 1.3.5 merge conflict.
This commit is contained in:
parent
8afbe8cacf
commit
91c179eaea
1 changed files with 0 additions and 26 deletions
|
|
@ -7,11 +7,6 @@ __copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms
|
|||
import requests
|
||||
import logging
|
||||
import base64
|
||||
<<<<<<< HEAD
|
||||
|
||||
from ..exceptions import ConfigurationInvalid
|
||||
=======
|
||||
>>>>>>> 77753ca02602d3a798d6b0a22535e6fd69ff448a
|
||||
|
||||
BRANCH_HEAD_URL = "https://api.bitbucket.org/2.0/repositories/{user}/{repo}/commit/{branch}"
|
||||
|
||||
|
|
@ -19,14 +14,6 @@ logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.bitb
|
|||
|
||||
|
||||
def _get_latest_commit(user, repo, branch, api_user=None, api_password=None):
|
||||
<<<<<<< HEAD
|
||||
url = BRANCH_HEAD_URL.format(user=user, repo=repo, branch=branch)
|
||||
headers = {}
|
||||
if api_user is not None and api_password is not None:
|
||||
headers['authorization'] = 'Basic {}'.format(
|
||||
base64.b64encode(b"{user}:{pw}".format(user=api_user, pw=api_password)))
|
||||
r = requests.get(url, headers=headers)
|
||||
=======
|
||||
from ..exceptions import NetworkError
|
||||
|
||||
url = BRANCH_HEAD_URL.format(user=user, repo=repo, branch=branch)
|
||||
|
|
@ -39,7 +26,6 @@ def _get_latest_commit(user, repo, branch, api_user=None, api_password=None):
|
|||
r = requests.get(url, headers=headers, timeout=(3.05, 30))
|
||||
except requests.ConnectionError as exc:
|
||||
raise NetworkError(cause=exc)
|
||||
>>>>>>> 77753ca02602d3a798d6b0a22535e6fd69ff448a
|
||||
|
||||
if not r.status_code == requests.codes.ok:
|
||||
return None
|
||||
|
|
@ -61,21 +47,10 @@ def get_latest(target, check, online=True):
|
|||
if "branch" in check and check["branch"] is not None:
|
||||
branch = check["branch"]
|
||||
|
||||
<<<<<<< HEAD
|
||||
api_user = check["api_user"] if 'api_user' in check else None
|
||||
api_password = check["api_password"] if 'api_password' in check else None
|
||||
|
||||
current = None
|
||||
if "current" in check:
|
||||
current = check["current"]
|
||||
|
||||
remote_commit = _get_latest_commit(check["user"], check["repo"], branch, api_user, api_password)
|
||||
=======
|
||||
api_user = check.get("api_user")
|
||||
api_password = check.get("api_password")
|
||||
|
||||
current = check.get("current")
|
||||
>>>>>>> 77753ca02602d3a798d6b0a22535e6fd69ff448a
|
||||
|
||||
information = dict(
|
||||
local=dict(name="Commit {commit}".format(commit=current if current is not None else "unknown"), value=current),
|
||||
|
|
@ -94,4 +69,3 @@ def get_latest(target, check, online=True):
|
|||
logger.debug("Target: %s, local: %s, remote: %s" % (target, current, remote_commit))
|
||||
|
||||
return information, is_current
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue