diff options
Diffstat (limited to 'libbe/command')
-rw-r--r-- | libbe/command/import_xml.py | 2 | ||||
-rw-r--r-- | libbe/command/init.py | 9 | ||||
-rw-r--r-- | libbe/command/list.py | 22 |
3 files changed, 22 insertions, 11 deletions
diff --git a/libbe/command/import_xml.py b/libbe/command/import_xml.py index 598ecb8..287d8b7 100644 --- a/libbe/command/import_xml.py +++ b/libbe/command/import_xml.py @@ -115,7 +115,7 @@ class Import_XML (libbe.command.Command): if params['xml-file'] == '-': xml = self.stdin.read().encode(self.stdin.encoding) else: - self._check_restricted_access(storage, params['xml-file']) + self._check_restricted_access(bugdir.storage, params['xml-file']) xml = libbe.util.encoding.get_file_contents( params['xml-file']) diff --git a/libbe/command/init.py b/libbe/command/init.py index 7fdbdae..7b83645 100644 --- a/libbe/command/init.py +++ b/libbe/command/init.py @@ -49,6 +49,9 @@ class Init (libbe.command.Command): BE repository initialized. >>> bd = libbe.bugdir.BugDir(vcs) >>> vcs.disconnect() + >>> vcs.connect() + >>> bugdir = libbe.bugdir.BugDir(vcs, from_storage=True) + >>> vcs.disconnect() >>> vcs.destroy() >>> dir.cleanup() @@ -66,6 +69,9 @@ class Init (libbe.command.Command): Using ... for revision control. BE repository initialized. >>> vcs.disconnect() + >>> vcs.connect() + >>> bugdir = libbe.bugdir.BugDir(vcs, from_storage=True) + >>> vcs.disconnect() >>> vcs.destroy() >>> dir.cleanup() """ @@ -87,8 +93,9 @@ class Init (libbe.command.Command): pass storage.init() storage.connect() + self.ui.storage_callbacks.set_storage(storage) bd = libbe.bugdir.BugDir(storage, from_storage=False) - bd.save() + self.ui.storage_callbacks.set_bugdir(bd) if bd.storage.name is not 'None': print >> self.stdout, \ 'Using %s for revision control.' % storage.name diff --git a/libbe/command/list.py b/libbe/command/list.py index 44be71b..73c60a9 100644 --- a/libbe/command/list.py +++ b/libbe/command/list.py @@ -107,8 +107,10 @@ class List (libbe.command.Command): libbe.command.Option(name='assigned', short_name='a', help='Only show bugs matching ASSIGNED', arg=libbe.command.Argument( - name='assigned', metavar='ASSIGNED', default='all', + name='assigned', metavar='ASSIGNED', default=None, completion_callback=libbe.command.util.complete_assigned)), + libbe.command.Option(name='mine', short_name='m', + help='List bugs assigned to you'), libbe.command.Option(name='extra-strings', short_name='e', help='Only show bugs matching STRINGS, e.g. --extra-strings' ' TAG:working,TAG:xml', @@ -136,7 +138,6 @@ class List (libbe.command.Command): # ("U", "unconfirmed", "List unconfirmed bugs"), # ("o", "open", "List open bugs"), # ("T", "test", "List bugs in testing"), -# ("m", "mine", "List bugs assigned to you")) # for s in bools: # attr = s[1].replace('-','_') # short = "-%c" % s[0] @@ -153,14 +154,14 @@ class List (libbe.command.Command): writeable = bugdir.storage.writeable bugdir.storage.writeable = False cmp_list, status, severity, assigned, extra_strings_regexps = \ - self._parse_params(params) + self._parse_params(bugdir, params) filter = Filter(status, severity, assigned, extra_strings_regexps=extra_strings_regexps) bugs = [bugdir.bug_from_uuid(uuid) for uuid in bugdir.uuids()] bugs = [b for b in bugs if filter(bugdir, b) == True] self.result = bugs if len(bugs) == 0 and params['xml'] == False: - print >> self.stdout, "No matching bugs found" + print >> self.stdout, 'No matching bugs found' # sort bugs bugs = self._sort_bugs(bugs, cmp_list) @@ -174,13 +175,13 @@ class List (libbe.command.Command): bugdir.storage.writeable = writeable return 0 - def _parse_params(self, params): + def _parse_params(self, bugdir, params): cmp_list = [] if params['sort'] != None: for cmp in params['sort'].sort_by.split(','): if cmp not in AVAILABLE_CMPS: raise libbe.command.UserError( - "Invalid sort on '%s'.\nValid sorts:\n %s" + 'Invalid sort on "%s".\nValid sorts:\n %s' % (cmp, '\n '.join(AVAILABLE_CMPS))) cmp_list.append(eval('libbe.bug.cmp_%s' % cmp)) # select status @@ -203,11 +204,14 @@ class List (libbe.command.Command): severity = libbe.command.util.select_values( params['severity'], bug.severity_values) # select assigned - if params['assigned'] == "all": - assigned = "all" + if params['assigned'] == None: + if params['mine'] == True: + assigned = [self._get_user_id()] + else: + assigned = 'all' else: assigned = libbe.command.util.select_values( - params['assigned'], libbe.command.util.assignees()) + params['assigned'], libbe.command.util.assignees(bugdir)) for i in range(len(assigned)): if assigned[i] == '-': assigned[i] = params['user-id'] |