diff options
-rw-r--r-- | doc/conf.py | 9 | ||||
-rw-r--r-- | doc/generate-libbe-txt.py | 8 | ||||
-rw-r--r-- | doc/hacking.txt | 47 | ||||
-rw-r--r-- | doc/index.txt | 18 | ||||
-rw-r--r-- | doc/install.txt | 2 | ||||
-rw-r--r-- | doc/tutorial.txt | 23 | ||||
-rw-r--r-- | libbe/command/new.py | 9 | ||||
-rw-r--r-- | libbe/storage/util/config.py | 4 | ||||
-rw-r--r-- | libbe/storage/vcs/darcs.py | 17 | ||||
-rw-r--r-- | libbe/ui/util/user.py | 4 |
10 files changed, 84 insertions, 57 deletions
diff --git a/doc/conf.py b/doc/conf.py index 1090a28..371480e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -25,7 +25,8 @@ import libbe.version # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.coverage', +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary', + 'sphinx.ext.doctest', 'sphinx.ext.coverage', 'numpydoc'] # Add any paths that contain templates here, relative to this directory. @@ -196,3 +197,9 @@ latex_documents = [ # If false, no module index is generated. #latex_use_modindex = True + +# -- Options for Intersphinx --------------------------------------------------- + +intersphinx_mapping = { + 'http://docs.python.org/dev': None, + } diff --git a/doc/generate-libbe-txt.py b/doc/generate-libbe-txt.py index 35eb5c4..77f775a 100644 --- a/doc/generate-libbe-txt.py +++ b/doc/generate-libbe-txt.py @@ -34,10 +34,10 @@ def toctree(children): ' %s.txt' % c for c in sorted(children) ] + ['', '']) -def make_module_txt(modname, children): - filename = os.path.join('libbe', '%s.txt' % modname) - if not os.path.exists('libbe'): - os.mkdir('libbe') +def make_module_txt(modname, children, subdir='libbe'): + filename = os.path.join(subdir, '%s.txt' % modname) + if not os.path.exists(subdir): + os.mkdir(subdir) if os.path.exists(filename): return None # don't overwrite potentially hand-written files. f = file(filename, 'w') diff --git a/doc/hacking.txt b/doc/hacking.txt index 5b075f9..54be7bc 100644 --- a/doc/hacking.txt +++ b/doc/hacking.txt @@ -6,15 +6,19 @@ Adding commands =============== To write a plugin, you simply create a new file in the -``libbe/commands/`` directory. Take a look at one of the simpler -plugins (e.g. ``remove.py``) for an example of how that looks, and to -start getting a feel for the libbe interface. +:file:`libbe/command/` directory. Take a look at one of the simpler +plugins (e.g. :mod:`libbe.command.remove`) for an example of how that +looks, and to start getting a feel for the libbe interface. -See ``libbe/commands/base.py`` for the definition of the important -classes ``Option``, ``Argument``, ``Command``, ``InputOutput``, -``StorageCallbacks``, and ``UserInterface`` classes. You'll be -subclassing ``Command`` for your command, but all those classes will -be important. +See :mod:`libbe.command.base` for the definition of the important +classes :class:`~libbe.command.base.Option`, +:class:`~libbe.command.base.Argument`, +:class:`~libbe.command.base.Command`, +:class:`~libbe.command.base.InputOutput`, +:class:`~libbe.command.base.StorageCallbacks`, and +:class:`~libbe.command.base.UserInterface`. You'll be subclassing +:class:`~libbe.command.base.Command` for your command, but all those +classes will be important. Command completion @@ -22,21 +26,22 @@ Command completion BE implements a general framework to make it easy to support command completion for arbitrary plugins. In order to support this system, -any of your completable ``Argument()`` instances (in your command's -``.options`` or ``.args``) should be initialized with some valid -completion_callback function. Some common cases are defined in -``libbe.command.util``. If you need more flexibility, see -``libbe.command.list``'s ``--sort`` option for an example of -extensions via ``libbe.command.util.Completer``, or write a custom -completion function from scratch. +any of your completable :class:`~libbe.command.base.Argument` +instances (in your command's ``.options`` or ``.args``) should be +initialized with some valid completion_callback function. Some common +cases are defined in :mod:`libbe.command.util`. If you need more +flexibility, see :mod:`libbe.command.list`\'s ``--sort`` option for an +example of extensions via :class:`libbe.command.util.Completer`, or +write a custom completion function from scratch. Adding user interfaces ====================== -Take a look at ``libbe/ui/command_line.py`` for an example. Basically -you'll need to setup a ``UserInterface`` instance for running commands. -More details to come after I write an HTML UI... +Take a look at :mod:`libbe.ui.command_line` for an example. +Basically you'll need to setup a +:class:`~libbe.command.base.UserInterface` instance for running +commands. More details to come after I write an HTML UI... Testing @@ -50,11 +55,11 @@ for example: be$ python test.py libbe.command.merge -For a definition of "any tests", see ``test.py``'s +For a definition of "any tests", see :file:`test.py`'s ``add_module_tests()`` function. Note that you will need to run ``make`` before testing a clean BE -branch to auto-generate required files like ``libbe/_version.py``. +branch to auto-generate required files like :file:`libbe/_version.py`. Profiling @@ -71,5 +76,5 @@ It's often useful to toss:: import sys, traceback print >> sys.stderr, '-'*60, '\n', '\n'.join(traceback.format_stack()[-10:]) -into expensive functions (e.g. ``libbe.util.subproc.invoke()``) if +into expensive functions (e.g. :func:`libbe.util.subproc.invoke`) if you're not sure why they're being called. diff --git a/doc/index.txt b/doc/index.txt index 30b0318..77e756e 100644 --- a/doc/index.txt +++ b/doc/index.txt @@ -21,15 +21,15 @@ Contents: .. toctree:: :maxdepth: 2 - install.txt - tutorial.txt - email.txt - html.txt - distributed_bugtracking.txt - hacking.txt - spam.txt - libbe/libbe.txt - doc.txt + install + tutorial + email + html + distributed_bugtracking + hacking + spam + libbe/libbe + doc Indices and tables ================== diff --git a/doc/install.txt b/doc/install.txt index b1d153e..3749189 100644 --- a/doc/install.txt +++ b/doc/install.txt @@ -14,7 +14,7 @@ need to run:: $ make -to build some auto-generated files (e.g. ``libbe/_version.py``), and:: +to build some auto-generated files (e.g. :mod:`libbe._version`), and:: $ make install diff --git a/doc/tutorial.txt b/doc/tutorial.txt index 7932c9c..592aef5 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -15,16 +15,15 @@ and helps keep the bug repository in sync with the code. However, there are some differences compared to centralized bugtrackers. Because bugs and comments can be created by several -users in parallel, they have globally unique IDs_ rather than numbers. -There is also a developer-friendly command-line_ interface to -compliment the user-friendly web_ and email_ interfaces. This -tutorial will focus on the command-line interface as the most -powerful, and leave the web and email interfaces to other documents. +users in parallel, they have globally unique +:mod:`IDs </libbe.util.id>` rather than numbers. There is also a +developer-friendly command-line_ interface to compliment the +user-friendly :doc:`web </tutorial-html>` and +:doc:`email </tutorial-email>` interfaces. This tutorial will focus +on the command-line interface as the most powerful, and leave the web +and email interfaces to other documents. .. _command-line: `Command-line interface`_ -.. _web: tutorial-html.txt -.. _email: tutorial-email.txt -.. _IDs: libbe/libbe.util.id.txt Installation ============ @@ -39,13 +38,13 @@ Bugs If you have any problems with BE, you can look for matching bugs:: - $ be --repo http://bugseverywhere.org/bugs list + $ be --repo http://bugs.bugseverywhere.org/ list If your bug isn't listed, please open a new bug:: - $ be --repo http://bugseverywhere.org/bugs new 'bug' + $ be --repo http://bugs.bugseverywhere.org/ new 'bug' Created bug with ID bea/abc - $ be --repo http://bugseverywhere.org/bugs comment bea/def + $ be --repo http://bugs.bugseverywhere.org/ comment bea/def <editor spawned for comments> @@ -266,7 +265,7 @@ Compare with a previous revision ``480``:: Compare your BE branch with the trunk:: - $ be diff --repo http://bugseverywhere.org/bugs/ + $ be diff --repo http://bugs.bugseverywhere.org/ Manipulating bugs ----------------- diff --git a/libbe/command/new.py b/libbe/command/new.py index be18306..a2982a8 100644 --- a/libbe/command/new.py +++ b/libbe/command/new.py @@ -68,6 +68,10 @@ class New (libbe.command.Command): help='The user who reported the bug', arg=libbe.command.Argument( name='reporter', metavar='NAME')), + libbe.command.Option(name='creator', short_name='c', + help='The user who created the bug', + arg=libbe.command.Argument( + name='creator', metavar='NAME')), libbe.command.Option(name='assigned', short_name='a', help='The developer in charge of the bug', arg=libbe.command.Argument( @@ -85,7 +89,10 @@ class New (libbe.command.Command): summary = params['summary'] bugdir = self._get_bugdir() bug = bugdir.new_bug(summary=summary.strip()) - bug.creator = self._get_user_id() + if params['creator'] != None: + bug.creator = params['creator'] + else: + bug.creator = self._get_user_id() if params['reporter'] != None: bug.reporter = params['reporter'] else: diff --git a/libbe/storage/util/config.py b/libbe/storage/util/config.py index 724d2d3..7d59712 100644 --- a/libbe/storage/util/config.py +++ b/libbe/storage/util/config.py @@ -37,8 +37,10 @@ Initialized with :func:`libbe.util.encoding.get_filesystem_encoding`. def path(): """Return the path to the per-user config file. + + Defaults to :file:`~/.bugs_everywhere`. """ - return os.path.expanduser("~/.bugs_everywhere") + return os.path.expanduser(os.path.join('~','.bugs_everywhere')) def set_val(name, value, section="DEFAULT", encoding=None): """Set a value in the per-user config file. diff --git a/libbe/storage/vcs/darcs.py b/libbe/storage/vcs/darcs.py index 0f23278..b0e5705 100644 --- a/libbe/storage/vcs/darcs.py +++ b/libbe/storage/vcs/darcs.py @@ -112,13 +112,15 @@ class Darcs(base.VCS): def _vcs_get_user_id(self): # following http://darcs.net/manual/node4.html#SECTION00410030000000000000 - # as of June 29th, 2009 + # as of June 22th, 2010 if self.repo == None: return None - darcs_dir = os.path.join(self.repo, '_darcs') - if darcs_dir != None: - for pref_file in ['author', 'email']: - pref_path = os.path.join(darcs_dir, 'prefs', pref_file) + for pref_file in ['author', 'email']: + for prefs_dir in [os.path.join(self.repo, '_darcs', 'prefs'), + os.path.expanduser(os.path.join('~', '.darcs'))]: + if prefs_dir == None: + continue + pref_path = os.path.join(prefs_dir, pref_file) if os.path.exists(pref_path): return self._vcs_get_file_contents(pref_path).strip() for env_variable in ['DARCS_EMAIL', 'EMAIL']: @@ -153,7 +155,10 @@ class Darcs(base.VCS): def _vcs_add(self, path): if os.path.isdir(path): return - self._u_invoke_client('add', path) + if self.version_cmp(0, 9, 10) == 1: + self._u_invoke_client('add', '--boring', path) + else: # really old versions <= 0.9.10 lack --boring + self._u_invoke_client('add', path) def _vcs_remove(self, path): if not os.path.isdir(self._u_abspath(path)): diff --git a/libbe/ui/util/user.py b/libbe/ui/util/user.py index 460a1dd..412575f 100644 --- a/libbe/ui/util/user.py +++ b/libbe/ui/util/user.py @@ -101,10 +101,12 @@ def get_user_id(storage=None): The source order is: - 1. Global BE configuration. + 1. Global BE configuration [#]_ (default section, setting 'user'). 2. `storage.get_user_id`, if that function is defined. 3. :func:`get_fallback_username` and :func:`get_fallback_email`. + .. [#] See :mod:`libbe.storage.util.config`. + Notes ----- Sometimes the storage will keep track of the user ID (e.g. most |