aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/command
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/command')
-rw-r--r--libbe/command/base.py4
-rw-r--r--libbe/command/commit.py27
-rw-r--r--libbe/command/diff.py26
-rw-r--r--libbe/command/html.py2
-rw-r--r--libbe/command/import_xml.py12
-rw-r--r--libbe/command/list.py6
-rw-r--r--libbe/command/merge.py10
-rw-r--r--libbe/command/set.py4
-rw-r--r--libbe/command/severity.py2
-rw-r--r--libbe/command/show.py4
-rw-r--r--libbe/command/status.py2
-rw-r--r--libbe/command/subscribe.py6
-rw-r--r--libbe/command/tag.py2
-rw-r--r--libbe/command/target.py2
-rw-r--r--libbe/command/util.py2
15 files changed, 46 insertions, 65 deletions
diff --git a/libbe/command/base.py b/libbe/command/base.py
index 9f50632..6a49413 100644
--- a/libbe/command/base.py
+++ b/libbe/command/base.py
@@ -263,7 +263,7 @@ class Command (object):
self.stdout = codecs.getwriter(output_encoding)(sys.stdout)
self.stdout.encoding = output_encoding
- def help(self, *args):
+ def help(self, *args):
return '\n\n'.join([self._usage(),
self._option_help(),
self._long_help().rstrip('\n')])
@@ -345,7 +345,7 @@ class Command (object):
def _get_storage(self):
"""
Callback for use by commands that need it.
-
+
Note that with the current implementation,
_get_unconnected_storage() will not work after this method
runs, but that shouldn't be an issue for any command I can
diff --git a/libbe/command/commit.py b/libbe/command/commit.py
index 4ef619c..7d82e7d 100644
--- a/libbe/command/commit.py
+++ b/libbe/command/commit.py
@@ -27,30 +27,19 @@ import libbe.ui.util.editor
class Commit (libbe.command.Command):
"""Commit the currently pending changes to the repository
- >>> import os, sys
- >>> import libbe.storage.vcs
- >>> import libbe.storage.vcs.base
- >>> import libbe.util.utility
+ >>> import sys
+ >>> import libbe.bugdir
+ >>> bd = libbe.bugdir.SimpleBugDir(memory=False, versioned=True)
>>> cmd = Commit()
+ >>> cmd._storage = bd.storage
>>> cmd._setup_io = lambda i_enc,o_enc : None
>>> cmd.stdout = sys.stdout
- >>> dir = libbe.util.utility.Dir()
- >>> vcs = libbe.storage.vcs.installed_vcs()
- >>> vcs.repo = dir.path
- >>> vcs.init()
- >>> vcs.connect()
- >>> cmd._storage = vcs
- >>> if vcs.name in libbe.storage.vcs.base.VCS_ORDER:
- ... bd = libbe.bugdir.BugDir(vcs, from_storage=False)
- ... bd.extra_strings = ['hi there']
- ... cmd.run({'user-id':'Joe'}, ['Making a commit']) # doctest: +ELLIPSIS
- ... else:
- ... print 'Committed ...'
+ >>> bd.extra_strings = ['hi there']
+ >>> bd.flush_reload()
+ >>> cmd.run({'user-id':'Joe'}, ['Making a commit']) # doctest: +ELLIPSIS
Committed ...
- >>> vcs.disconnect()
- >>> vcs.destroy()
- >>> dir.cleanup()
+ >>> bd.cleanup()
"""
name = 'commit'
diff --git a/libbe/command/diff.py b/libbe/command/diff.py
index c8b5777..d945f96 100644
--- a/libbe/command/diff.py
+++ b/libbe/command/diff.py
@@ -29,7 +29,7 @@ class Diff (libbe.command.Command):
>>> import sys
>>> import libbe.bugdir
- >>> bd = libbe.bugdir.SimpleBugDir(memory=False)
+ >>> bd = libbe.bugdir.SimpleBugDir(memory=False, versioned=True)
>>> cmd = Diff()
>>> cmd._storage = bd.storage
>>> cmd._setup_io = lambda i_enc,o_enc : None
@@ -39,23 +39,15 @@ class Diff (libbe.command.Command):
>>> bug = bd.bug_from_uuid('a')
>>> bug.status = 'closed'
>>> changed = bd.storage.commit('Closed bug a')
- >>> if bd.storage.versioned == True:
- ... ret = cmd.run(args=[original])
- ... else:
- ... print 'Modified bugs:\\n a:cm: Bug A\\n Changed bug settings:\\n status: open -> closed'
+ >>> ret = cmd.run(args=[original])
Modified bugs:
- a:cm: Bug A
+ abc/a:cm: Bug A
Changed bug settings:
status: open -> closed
- >>> if bd.storage.versioned == True:
- ... ret = cmd.run({'subscribe':'%(bugdir_id)s:mod', 'uuids':True}, [original])
- ... else:
- ... print 'a'
+ >>> ret = cmd.run({'subscribe':'%(bugdir_id)s:mod', 'uuids':True}, [original])
a
- >>> if bd.storage.versioned == False:
- ... ret = cmd.run(args=[original])
- ... else:
- ... raise libbe.command.UserError('This repository not revision-controlled.')
+ >>> bd.storage.versioned = False
+ >>> ret = cmd.run(args=[original])
Traceback (most recent call last):
...
UserError: This repository is not revision-controlled.
@@ -101,7 +93,7 @@ class Diff (libbe.command.Command):
if params['repo'] == None:
if params['revision'] == None: # get the most recent revision
params['revision'] = bugdir.storage.revision_id(-1)
- old_bd = bugdir.duplicate_bugdir(params['revision']) # TODO
+ old_bd = bugdir.duplicate_bugdir(params['revision'])
else:
old_storage = libbe.storage.get_storage(params['repo'])
old_storage.connect()
@@ -113,8 +105,8 @@ class Diff (libbe.command.Command):
raise libbe.command.UserError(
'%s is not revision-controlled.'
% storage.repo)
- old_bd = old_bd_current.duplicate_bugdir(revision) # TODO
- d = libbe.diff.Diff(old_bd, bugir)
+ old_bd = old_bd_current.duplicate_bugdir(revision)
+ d = libbe.diff.Diff(old_bd, bugdir)
tree = d.report_tree(subscriptions)
if params['uuids'] == True:
diff --git a/libbe/command/html.py b/libbe/command/html.py
index 0f993ae..ec818c0 100644
--- a/libbe/command/html.py
+++ b/libbe/command/html.py
@@ -60,7 +60,7 @@ class HTML (libbe.command.Command):
>>> bd.cleanup()
"""
name = 'html'
-
+
def __init__(self, *args, **kwargs):
libbe.command.Command.__init__(self, *args, **kwargs)
self.options.extend([
diff --git a/libbe/command/import_xml.py b/libbe/command/import_xml.py
index e73d90f..2e96848 100644
--- a/libbe/command/import_xml.py
+++ b/libbe/command/import_xml.py
@@ -110,9 +110,9 @@ class Import_XML (libbe.command.Command):
new.explicit_attrs = []
else:
croot_bug,croot_comment = (None, None)
-
+
if params['xml-file'] == '-':
- xml = self.stdin.read().encode(self.stdin.encoding)
+ xml = self.stdin.read().encode(self.stdin.encoding)
else:
self._check_restricted_access(storage, params['xml-file'])
xml = libbe.util.encoding.get_file_contents(
@@ -147,7 +147,7 @@ class Import_XML (libbe.command.Command):
else:
print >> sys.stderr, 'ignoring unknown tag %s in %s' \
% (child.tag, comment_list.tag)
-
+
# merge the new root_comments
if params['add-only'] == True:
accept_changes = False
@@ -172,7 +172,7 @@ class Import_XML (libbe.command.Command):
croot_bug.merge(new_croot_bug, accept_changes=accept_changes,
accept_extra_strings=accept_extra_strings,
accept_comments=accept_comments)
-
+
# merge the new croot_bugs
merged_bugs = []
old_bugs = []
@@ -190,7 +190,7 @@ class Import_XML (libbe.command.Command):
accept_comments=accept_comments)
merged_bugs.append(new)
old_bugs.append(old)
-
+
# protect against programmer error causing data loss:
if croot_bug != None:
comms = [c.uuid for c in croot_comment.traverse()]
@@ -201,7 +201,7 @@ class Import_XML (libbe.command.Command):
if not new in merged_bugs:
assert bugdir.has_bug(new.uuid), \
"bug %s wasn't added" % (new.uuid)
-
+
# save new information
bugdir.storage.writeable = writeable
if croot_bug != None:
diff --git a/libbe/command/list.py b/libbe/command/list.py
index 8bdeaae..d48c7ee 100644
--- a/libbe/command/list.py
+++ b/libbe/command/list.py
@@ -25,7 +25,7 @@ import libbe.bug
import libbe.command
import libbe.command.util
-# get a list of * for cmp_*() comparing two bugs.
+# get a list of * for cmp_*() comparing two bugs.
AVAILABLE_CMPS = [fn[4:] for fn in dir(libbe.bug) if fn[:4] == 'cmp_']
AVAILABLE_CMPS.remove('attr') # a cmp_* template.
@@ -129,7 +129,7 @@ class List (libbe.command.Command):
# parser.add_option(short, long, action="store_true",
# dest=attr, help=help, default=False)
# return parser
-#
+#
# ])
def _run(self, **params):
@@ -144,7 +144,7 @@ class List (libbe.command.Command):
self.result = bugs
if len(bugs) == 0 and params['xml'] == False:
print >> self.stdout, "No matching bugs found"
-
+
# sort bugs
bugs = self._sort_bugs(bugs, cmp_list)
diff --git a/libbe/command/merge.py b/libbe/command/merge.py
index e3bf943..447b4ae 100644
--- a/libbe/command/merge.py
+++ b/libbe/command/merge.py
@@ -63,8 +63,8 @@ class Merge (libbe.command.Command):
Short name : abc/a
Severity : minor
Status : open
- Assigned :
- Reporter :
+ Assigned :
+ Reporter :
Creator : John Doe <jdoe@example.com>
Created : ...
Bug A
@@ -109,8 +109,8 @@ class Merge (libbe.command.Command):
Short name : abc/b
Severity : minor
Status : closed
- Assigned :
- Reporter :
+ Assigned :
+ Reporter :
Creator : Jane Doe <jdoe@example.com>
Created : ...
Bug B
@@ -168,7 +168,7 @@ class Merge (libbe.command.Command):
comment.storage = None
comment.alt_id = comment.uuid
comment.storage = bugdir.storage
- comment.uuid = libbe.util.id.uuid_gen()
+ comment.uuid = libbe.util.id.uuid_gen()
comment.save() # force onto disk under bugA
for comment in newCommTree: # just the child comments
diff --git a/libbe/command/set.py b/libbe/command/set.py
index aaf2b58..4fe0117 100644
--- a/libbe/command/set.py
+++ b/libbe/command/set.py
@@ -87,11 +87,11 @@ class Set (libbe.command.Command):
def _long_help(self):
return """
-Show or change per-tree settings.
+Show or change per-tree settings.
If name and value are supplied, the name is set to a new value.
If no value is specified, the current value is printed.
-If no arguments are provided, all names and values are listed.
+If no arguments are provided, all names and values are listed.
To unset a setting, set it to "none".
diff --git a/libbe/command/severity.py b/libbe/command/severity.py
index 9289138..7c1d305 100644
--- a/libbe/command/severity.py
+++ b/libbe/command/severity.py
@@ -59,7 +59,7 @@ class Severity (libbe.command.Command):
repeatable=True,
completion_callback=libbe.command.util.complete_bug_id),
])
-
+
def _run(self, **params):
bugdir = self._get_bugdir()
for bug_id in params['bug-id']:
diff --git a/libbe/command/show.py b/libbe/command/show.py
index 1a569a6..1b498aa 100644
--- a/libbe/command/show.py
+++ b/libbe/command/show.py
@@ -45,8 +45,8 @@ class Show (libbe.command.Command):
Short name : abc/a
Severity : minor
Status : open
- Assigned :
- Reporter :
+ Assigned :
+ Reporter :
Creator : John Doe <jdoe@example.com>
Created : ...
Bug A
diff --git a/libbe/command/status.py b/libbe/command/status.py
index 7cf5858..323963a 100644
--- a/libbe/command/status.py
+++ b/libbe/command/status.py
@@ -56,7 +56,7 @@ class Status (libbe.command.Command):
repeatable=True,
completion_callback=libbe.command.util.complete_bug_id),
])
-
+
def _run(self, **params):
bugdir = self._get_bugdir()
for bug_id in params['bug-id']:
diff --git a/libbe/command/subscribe.py b/libbe/command/subscribe.py
index 4f72624..a837f99 100644
--- a/libbe/command/subscribe.py
+++ b/libbe/command/subscribe.py
@@ -131,7 +131,7 @@ class Subscribe (libbe.command.Command):
params['types'] = 'all'
servers = params['servers'].split(',')
types = params['types'].split(',')
-
+
if len(params['id']) == 0:
params['id'] = [libbe.diff.BUGDIR_ID]
for _id in params['id']:
@@ -159,7 +159,7 @@ class Subscribe (libbe.command.Command):
else: # add the tag
estrs = subscribe(estrs, subscriber, types, servers, type_root)
entity.extra_strings = estrs # reassign to notice change
-
+
if params['list-all'] == True:
bugdir.load_all_bugs()
subscriptions = get_bugdir_subscribers(bugdir, servers[0])
@@ -168,7 +168,7 @@ class Subscribe (libbe.command.Command):
for estr in entity.extra_strings:
if estr.startswith(TAG):
subscriptions.append(estr[len(TAG):])
-
+
if len(subscriptions) > 0:
print >> self.stdout, 'Subscriptions for %s:' % entity_name
print >> self.stdout, '\n'.join(subscriptions)
diff --git a/libbe/command/tag.py b/libbe/command/tag.py
index 26ff1b5..bdb3f31 100644
--- a/libbe/command/tag.py
+++ b/libbe/command/tag.py
@@ -134,7 +134,7 @@ class Tag (libbe.command.Command):
for estr in bug.extra_strings:
if estr.startswith(TAG_TAG):
tags.append(estr[len(TAG_TAG):])
-
+
if len(tags) > 0:
print "Tags for %s:" % bug.id.user()
print '\n'.join(tags)
diff --git a/libbe/command/target.py b/libbe/command/target.py
index 034c532..df836db 100644
--- a/libbe/command/target.py
+++ b/libbe/command/target.py
@@ -58,7 +58,7 @@ class Target (libbe.command.Command):
>>> bd.cleanup()
"""
name = 'target'
-
+
def __init__(self, *args, **kwargs):
libbe.command.Command.__init__(self, *args, **kwargs)
self.options.extend([
diff --git a/libbe/command/util.py b/libbe/command/util.py
index a4aaf5f..3bd02d0 100644
--- a/libbe/command/util.py
+++ b/libbe/command/util.py
@@ -32,7 +32,7 @@ def complete_path(command, argument, fragment=None):
if len(comps) == 1 and os.path.isdir(comps[0]):
comps.extend(glob.glob(comps[0]+'/*'))
return comps
-
+
def complete_status(command, argument, fragment=None):
return [fragment]
def complete_severity(command, argument, fragment=None):