[pkg-tasktools] Bug#886383: bugwarrior: phabricator import fails due to no issues found (= undefined 'issue' dict)

Nicolas Schier nicolas at fjasle.eu
Fri Jan 5 07:41:48 UTC 2018


Package: bugwarrior
Version: 1.5.1-2
Severity: normal
Tags: patch

Dear maintainer(s),

I have added these lines to my ~/.config/bugwarrior/bugwarriorrc
attempting to import my issues from our phabricator instance (even
though I still not have any):

	[phabricator]
	phabricator.only_if_assigned = PHID-USER-7yut3lpslyc2mmm5mxuj,NSchier
	phabricator.user_phids = PHID-USER-7yut3lpslyc2mmm5mxuj
	#phabricator.project_phids = PHID-PROJ-wak4hlhspgyjxgx4ibsg
	service = phabricator

(The 'project_phids' setting is disabled, as the local installation does
not provide the required API (that could make up yet another bug report,
as the error is not catched).)

When running 'bugwarrior-pull', I get this output:

	$ bugwarrior-pull --dry-run
	INFO:bugwarrior.db:Service-defined UDAs exist: you can optionally use the `bugwarrior-uda` command to export a list of UDAs you can add to your taskrc file.
	INFO:bugwarrior.services:Starting to aggregate remote issues.
	INFO:bugwarrior.services:Spawning 1 workers.
	INFO:bugwarrior.services:Working on [phabricator]
	INFO:bugwarrior.services.phab:Found 0 issues
	INFO:bugwarrior.services.phab:Found 39 differentials
	ERROR:bugwarrior.services:Worker for [phabricator] failed: local variable 'issue' referenced before assignment
	Traceback (most recent call last):
	  File "/usr/lib/python3/dist-packages/bugwarrior/services/__init__.py", line 506, in _aggregate_issues
	    for issue in service.issues():
	  File "/usr/lib/python3/dist-packages/bugwarrior/services/phab.py", line 147, in issues
	    project = projects.get(issue['projectPHIDs'][0], project)
	UnboundLocalError: local variable 'issue' referenced before assignment
	INFO:bugwarrior.services:Done with [phabricator] in 0.116974s
	INFO:bugwarrior.services:Terminating workers
			'type': 'issue',
	CRITICAL:bugwarrior.command:Aborted (critical error in target 'phabricator')

Without really knowing what I'm doing, I simply patched the
'bugwarrior/services/phab.py' and can now import the stuff I want to
have:

	$ bugwarrior-pull
	INFO:bugwarrior.db:Service-defined UDAs exist: you can optionally use the `bugwarrior-uda` command to export a list of UDAs you can add to your taskrc file.
	INFO:bugwarrior.services:Starting to aggregate remote issues.
	INFO:bugwarrior.services:Spawning 1 workers.
	INFO:bugwarrior.services:Working on [phabricator]
	INFO:bugwarrior.services.phab:Found 0 issues
	INFO:bugwarrior.services.phab:Found 39 differentials
	INFO:bugwarrior.services:Done with [phabricator] in 0.119559s
	INFO:bugwarrior.services:Done aggregating remote issues.
	INFO:bugwarrior.db:Adding 2 tasks
	INFO:bugwarrior.db:Adding task (bw)PR#D3625 - ARM: etc/scripts/p...
	INFO:bugwarrior.db:Adding task (bw)PR#D3448 - Reduce compilation warnings
	INFO:bugwarrior.db:Updating 0 tasks
	INFO:bugwarrior.db:Closing 0 tasks

I don't know, if the patch breaks something, when there are issues
found...  but for me it works with that patch, currently.

Kind regards,
Nicolas


-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'oldoldstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=nb:nn:dk:se:de:en:C, LC_CTYPE=nb:nn:dk:se:de:en:C (charmap=UTF-8) (ignored: LC_ALL set to nb_NO.UTF-8), LANGUAGE=nb_NO.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to nb_NO.UTF-8)
Shell: /bin/sh linked to /usr/bin/bash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bugwarrior depends on:
ii  libjs-sphinxdoc        1.6.5-4
ii  python3                3.6.4-1
ii  python3-click          6.7-2
ii  python3-dateutil       2.6.1-1
ii  python3-dogpile.cache  0.6.2-5
ii  python3-future         0.15.2-4
ii  python3-jinja2         2.10-1
ii  python3-lockfile       1:0.12.2-2
ii  python3-requests       2.18.1-1
ii  python3-six            1.11.0-1
ii  python3-taskw          1.2.0-1
ii  python3-tz             2017.2-2

Versions of packages bugwarrior recommends:
ii  python3-keyring      10.5.1-1
ii  python3-phabricator  0.7.0-1

bugwarrior suggests no packages.

-- no debconf information
-------------- next part --------------
diff --git a/bugwarrior/services/phab.py b/bugwarrior/services/phab.py
index 37155fa..bca942d 100644
--- a/bugwarrior/services/phab.py
+++ b/bugwarrior/services/phab.py
@@ -97,6 +97,7 @@ class PhabricatorService(IssueService):
 
         log.info("Found %i issues" % len(issues))
 
+        issue = {'projectPHIDs': []}
         for phid, issue in issues:
 
             project = self.target  # a sensible default


More information about the pkg-tasktools-discuss mailing list