diff options
author | W. Trevor King <wking@drexel.edu> | 2010-02-01 12:02:11 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2010-02-01 12:02:11 -0500 |
commit | cf930f941de308f5d46ce89aa7f6358ba3c453d6 (patch) | |
tree | 4a4b2d690e116bf74e1b25a6727f9d3d58950ca6 /libbe | |
parent | 0dd273f8605bc21589a51d3b046a231ff9df6fbb (diff) | |
download | bugseverywhere-cf930f941de308f5d46ce89aa7f6358ba3c453d6.tar.gz |
Fixed Chris' "zero name length for Mercurial w/o ~/.hgrc" bug.
From: Chris Ball <cjb@laptop.org>
Subject: Test suite status
Date: Mon, 01 Feb 2010 11:27:53 -0500
Message-id: <m38wbcor92.fsf@pullcord.laptop.org>
...
I hit the "assert len(name) > 0" in libbe/ui/util/libbe.py, coming from
hg.py when running with no ~/.hgrc. Fixed by the following patch:
=== modified file 'libbe/storage/vcs/hg.py'
--- libbe/storage/vcs/hg.py 2010-01-21 17:45:49 +0000
+++ libbe/storage/vcs/hg.py 2010-02-01 16:17:03 +0000
@@ -87,7 +87,14 @@
return tmp_stdout.getvalue().rstrip('\n')
def _vcs_get_user_id(self):
- return self._u_invoke_client('showconfig', 'ui.username')
+ output = self._u_invoke_client('showconfig', 'ui.username')
+ if output != "":
+ return output.rstrip('\n')
+ else:
+ # guess missing info
+ name = libbe.ui.util.user.get_fallback_username()
+ email = libbe.ui.util.user.get_fallback_email()
+ return libbe.ui.util.user.create_user_id(name, email)
def _vcs_detect(self, path):
"""Detect whether a directory is revision-controlled using Mercurial"""
Diffstat (limited to 'libbe')
-rw-r--r-- | libbe/storage/vcs/hg.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libbe/storage/vcs/hg.py b/libbe/storage/vcs/hg.py index 088a141..97fc470 100644 --- a/libbe/storage/vcs/hg.py +++ b/libbe/storage/vcs/hg.py @@ -87,7 +87,11 @@ class Hg(base.VCS): return tmp_stdout.getvalue().rstrip('\n') def _vcs_get_user_id(self): - return self._u_invoke_client('showconfig', 'ui.username') + output = self._u_invoke_client( + 'showconfig', 'ui.username').rstrip('\n') + if output != '': + return output + return None def _vcs_detect(self, path): """Detect whether a directory is revision-controlled using Mercurial""" |