aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
Diffstat (limited to 'libbe')
-rw-r--r--libbe/command/new.py9
-rw-r--r--libbe/storage/util/config.py4
-rw-r--r--libbe/storage/vcs/darcs.py17
-rw-r--r--libbe/ui/util/user.py4
4 files changed, 25 insertions, 9 deletions
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