diff options
Diffstat (limited to 'libbe')
-rw-r--r-- | libbe/command/base.py | 2 | ||||
-rw-r--r-- | libbe/command/diff.py | 18 | ||||
-rw-r--r-- | libbe/command/new.py | 2 | ||||
-rw-r--r-- | libbe/command/set.py | 28 | ||||
-rw-r--r-- | libbe/command/subscribe.py | 8 | ||||
-rw-r--r-- | libbe/command/util.py | 2 | ||||
-rw-r--r-- | libbe/diff.py | 4 |
7 files changed, 31 insertions, 33 deletions
diff --git a/libbe/command/base.py b/libbe/command/base.py index 74573a3..9f50632 100644 --- a/libbe/command/base.py +++ b/libbe/command/base.py @@ -266,7 +266,7 @@ class Command (object): def help(self, *args): return '\n\n'.join([self._usage(), self._option_help(), - self._long_help()]) + self._long_help().rstrip('\n')]) def _usage(self): usage = 'usage: be %s [options]' % self.name diff --git a/libbe/command/diff.py b/libbe/command/diff.py index 05242db..6a7c36b 100644 --- a/libbe/command/diff.py +++ b/libbe/command/diff.py @@ -30,7 +30,7 @@ class Diff (libbe.command.Command): >>> import sys >>> import libbe.bugdir >>> bd = libbe.bugdir.SimpleBugDir(memory=False) - >>> cmd = Subscribe() + >>> cmd = Diff() >>> cmd._storage = bd.storage >>> cmd._setup_io = lambda i_enc,o_enc : None >>> cmd.stdout = sys.stdout @@ -38,8 +38,8 @@ class Diff (libbe.command.Command): >>> original = bd.storage.commit('Original status') >>> bug = bd.bug_from_uuid('a') >>> bug.status = 'closed' - >>> changed = bd.vcs.commit('Closed bug a') - >>> if bd.vcs.versioned == True: + >>> 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' @@ -47,12 +47,12 @@ class Diff (libbe.command.Command): a:cm: Bug A Changed bug settings: status: open -> closed - >>> if bd.vcs.versioned == True: + >>> if bd.storage.versioned == True: ... ret = cmd.run({'subscribe':'%(bugdir_id)s:mod', 'uuids':True}, [original]) ... else: ... print 'a' a - >>> if bd.vcs.versioned == False: + >>> if bd.storage.versioned == False: ... ret = cmd.run(args=[original]) ... else: ... raise libbe.command.UserError('This repository not revision-controlled.') @@ -131,10 +131,10 @@ class Diff (libbe.command.Command): def _long_help(self): return """ -Uses the VCS to compare the current tree with a previous tree, and -prints a pretty report. If REVISION is given, it is a specifier for -the particular previous tree to use. Specifiers are specific to their -VCS. +Uses the storage backend to compare the current tree with a previous +tree, and prints a pretty report. If REVISION is given, it is a +specifier for the particular previous tree to use. Specifiers are +specific to their storage backend. For Arch your specifier must be a fully-qualified revision name. diff --git a/libbe/command/new.py b/libbe/command/new.py index de215fa..57ff5dc 100644 --- a/libbe/command/new.py +++ b/libbe/command/new.py @@ -35,9 +35,11 @@ class New (libbe.command.Command): >>> cmd._setup_io = lambda i_enc,o_enc : None >>> cmd.stdout = sys.stdout + >>> uuid_gen = libbe.util.id.uuid_gen >>> libbe.util.id.uuid_gen = lambda: 'X' >>> ret = cmd.run(args=['this is a test',]) Created bug with ID abc/X + >>> libbe.util.id.uuid_gen = uuid_gen >>> bd.flush_reload() >>> bug = bd.bug_from_uuid('X') >>> print bug.summary diff --git a/libbe/command/set.py b/libbe/command/set.py index cea6fb9..aaf2b58 100644 --- a/libbe/command/set.py +++ b/libbe/command/set.py @@ -85,6 +85,20 @@ class Set (libbe.command.Command): setattr(bugdir, attr, params['value']) return 0 + def _long_help(self): + return """ +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. + +To unset a setting, set it to "none". + +Allowed settings are: + +%s""" % ('\n'.join(get_bugdir_settings()),) + def get_bugdir_settings(): settings = [] for s in libbe.bugdir.BugDir.settings_properties: @@ -109,20 +123,6 @@ def get_bugdir_settings(): documented_settings.append('%s\n%s' % (s, '\n'.join(doc))) return documented_settings -longhelp=""" -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. - -To unset a setting, set it to "none". - -Allowed settings are: - -%s""" % ('\n'.join(get_bugdir_settings()),) - - def _value_string(bugdir, setting): val = bugdir.settings.get(setting, EMPTY) if val == EMPTY: diff --git a/libbe/command/subscribe.py b/libbe/command/subscribe.py index 5c5acdb..e86a9c8 100644 --- a/libbe/command/subscribe.py +++ b/libbe/command/subscribe.py @@ -35,14 +35,14 @@ class Subscribe (libbe.command.Command): >>> import libbe.bugdir >>> bd = libbe.bugdir.SimpleBugDir(memory=False) >>> cmd = Subscribe() - >>> cmd._storage = bd.storage + >>> cmd._bugdir = bd >>> cmd._setup_io = lambda i_enc,o_enc : None >>> cmd.stdout = sys.stdout >>> a = bd.bug_from_uuid('a') >>> print a.extra_strings [] - >>> ret = cmd.run({'subscriber':'John Doe <j@doe.com>'], ['/a']) # doctest: +NORMALIZE_WHITESPACE + >>> ret = cmd.run({'subscriber':'John Doe <j@doe.com>'}, ['/a']) # doctest: +NORMALIZE_WHITESPACE Subscriptions for abc/a: John Doe <j@doe.com> all * >>> bd.flush_reload() @@ -57,7 +57,7 @@ class Subscribe (libbe.command.Command): Subscriptions for a: Jane Doe <J@doe.com> all a.com,a.edu,b.net John Doe <j@doe.com> all * - >>> ret = cmd.run({'-u', 'subscriber':'Jane Doe <J@doe.com>', 'servers':'a.com'}, ['/a']) # doctest: +NORMALIZE_WHITESPACE + >>> ret = cmd.run({'unsubscribe':True, 'subscriber':'Jane Doe <J@doe.com>', 'servers':'a.com'}, ['/a']) # doctest: +NORMALIZE_WHITESPACE Subscriptions for a: Jane Doe <J@doe.com> all a.edu,b.net John Doe <j@doe.com> all * @@ -69,7 +69,7 @@ class Subscribe (libbe.command.Command): Subscriptions for a: John Doe <j@doe.com> all * >>> ret = cmd.run({'unsubscribe':True, 'subscriber':'John Doe <j@doe.com>'}, ['/a']) - >>> ret = cmd.run({'subscriber':'Jane Doe <J@doe.com>', '-t':'new'}, 'DIR']) # doctest: +NORMALIZE_WHITESPACE + >>> ret = cmd.run({'subscriber':'Jane Doe <J@doe.com>', 'types':'new'}, ['DIR']) # doctest: +NORMALIZE_WHITESPACE Subscriptions for bug directory: Jane Doe <J@doe.com> new * >>> ret = cmd.run({'subscriber':'Jane Doe <J@doe.com>'}, ['DIR']) # doctest: +NORMALIZE_WHITESPACE diff --git a/libbe/command/util.py b/libbe/command/util.py index f6734d5..a4aaf5f 100644 --- a/libbe/command/util.py +++ b/libbe/command/util.py @@ -87,7 +87,7 @@ def select_values(string, possible_values, name="unkown"): blacklisted_values = set(string[1:].split(',')) for value in blacklisted_values: if value not in possible_values: - raise UserError('Invalid %s %s\n %s' + raise libbe.command.UserError('Invalid %s %s\n %s' % (name, value, possible_values)) possible_values.remove(value) else: diff --git a/libbe/diff.py b/libbe/diff.py index 7acce54..f8e5f91 100644 --- a/libbe/diff.py +++ b/libbe/diff.py @@ -638,7 +638,3 @@ class Diff (object): def comment_body_change_string(self, bodies): old_body,new_body = bodies return difflib.unified_diff(old_body, new_body) - - -if libbe.TESTING == True: - suite = doctest.DocTestSuite() |