Skip to content

Commit

Permalink
fixed 1.3.5 merge conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-ing committed Oct 27, 2017
1 parent 8afbe8c commit 91c179e
Showing 1 changed file with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,13 @@
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}"

logger = logging.getLogger("octoprint.plugins.softwareupdate.version_checks.bitbucket_commit")


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)
Expand All @@ -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
Expand All @@ -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),
Expand All @@ -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

0 comments on commit 91c179e

Please sign in to comment.