Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:ralphbean/bugwarrior into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Dec 1, 2015
2 parents aa91974 + d077f57 commit a646205
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
13 changes: 6 additions & 7 deletions bugwarrior/db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ConfigParser import NoOptionError
from ConfigParser import NoOptionError, NoSectionError
import os
import re
import subprocess
Expand Down Expand Up @@ -292,9 +292,8 @@ def run_hooks(conf, name):
def synchronize(issue_generator, conf, main_section, dry_run=False):
def _bool_option(section, option, default):
try:
return section in conf.sections() and \
asbool(conf.get(section, option, default))
except NoOptionError:
return asbool(conf.get(section, option))
except (NoSectionError, NoOptionError):
return default

targets = [t.strip() for t in conf.get(main_section, 'targets').split(',')]
Expand Down Expand Up @@ -324,9 +323,9 @@ def _bool_option(section, option, default):
marshal=True,
)

legacy_matching = _bool_option(main_section, 'legacy_matching', 'False')
merge_annotations = _bool_option(main_section, 'merge_annotations', 'True')
merge_tags = _bool_option(main_section, 'merge_tags', 'True')
legacy_matching = _bool_option(main_section, 'legacy_matching', False)
merge_annotations = _bool_option(main_section, 'merge_annotations', True)
merge_tags = _bool_option(main_section, 'merge_tags', True)

issue_updates = {
'new': [],
Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/docs/services/github.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set to ralphbean (my account). But I have some targets with
there.

If two-factor authentication is used, ``github.token`` must be given rather
than ``github.password``. To get a token, go to the "Applications" section of
than ``github.password``. To get a token, go to the "Personal access tokens" section of
your profile settings. Only the ``public_repo`` scope is required, but access
to private repos can be gained with ``repo`` as well.

Expand Down
8 changes: 8 additions & 0 deletions bugwarrior/docs/services/gitlab.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Here's an example of a Gitlab target::
service = gitlab
gitlab.login = ralphbean
gitlab.token = OMG_LULZ
gitlab.host = gitlab.com

The above example is the minimum required to import issues from
Gitlab. You can also feel free to use any of the
Expand Down Expand Up @@ -89,6 +90,13 @@ If your Gitlab instance is only available over HTTP, set::

gitlab.use_https = False

Do Not Verify SSL Certificate
+++++++++++++++++++++++++++++

If want to ignore verifying the SSL certificate, set::

gitlab.verify_ssl = False


Provided UDA Fields
-------------------
Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/docs/services/pagure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The Pagure issue tracker allows you to attach tags to issues; to
use those pagure tags as taskwarrior tags, you can use the
``pagure.import_tags`` option::

github.import_tags = True
pagure.import_tags = True

Also, if you would like to control how these taskwarrior tags are created, you
can specify a template used for converting the Pagure tag into a Taskwarrior
Expand Down
12 changes: 9 additions & 3 deletions bugwarrior/services/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ def to_taskwarrior(self):
if milestone:
milestone = milestone['title']
if created:
created = self.parse_date(created)
created = self.parse_date(created).replace(microsecond=0)
if updated:
updated = self.parse_date(updated)
updated = self.parse_date(updated).replace(microsecond=0)
if author:
author = author['username']
if assignee:
Expand Down Expand Up @@ -203,6 +203,10 @@ def __init__(self, *args, **kw):
else:
self.scheme = 'http'

self.verify_ssl = self.config_get_default(
'verify_ssl', default=True, to_type=asbool
)

self.exclude_repos = []
if self.config_get_default('exclude_repos', None):
self.exclude_repos = [
Expand Down Expand Up @@ -274,7 +278,9 @@ def _fetch(self, tmpl, **kwargs):
url = tmpl.format(scheme=self.scheme, host=self.auth[0])
headers = {'PRIVATE-TOKEN': self.auth[1]}

response = requests.get(url, headers=headers, **kwargs)
if not self.verify_ssl:
requests.packages.urllib3.disable_warnings()
response = requests.get(url, headers=headers, verify=self.verify_ssl, **kwargs)

if callable(response.json):
json_res = response.json()
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"nose",
"jira>=0.22",
"megaplan>=1.4",
"pypandoc",
"pyac"
],
test_suite='nose.collector',
entry_points="""
Expand Down
6 changes: 3 additions & 3 deletions tests/test_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def test_to_taskwarrior(self):
'project': self.arbitrary_extra['project'],
'priority': self.service.default_priority,
'annotations': [],
'tags': ['feature'],
'tags': [u'feature'],
issue.URL: self.arbitrary_extra['issue_url'],
issue.REPO: 'project',
issue.STATE: self.arbitrary_issue['state'],
issue.TYPE: self.arbitrary_extra['type'],
issue.TITLE: self.arbitrary_issue['title'],
issue.NUMBER: self.arbitrary_issue['iid'],
issue.UPDATED_AT: self.arbitrary_updated,
issue.CREATED_AT: self.arbitrary_created,
issue.UPDATED_AT: self.arbitrary_updated.replace(microsecond=0),
issue.CREATED_AT: self.arbitrary_created.replace(microsecond=0),
issue.DESCRIPTION: self.arbitrary_issue['description'],
issue.MILESTONE: self.arbitrary_issue['milestone']['title'],
issue.UPVOTES: 0,
Expand Down

0 comments on commit a646205

Please sign in to comment.