diff options
author | W. Trevor King <wking@drexel.edu> | 2009-08-04 15:43:33 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-08-04 15:43:33 -0400 |
commit | 895fd728ca61afd6cad5d1a81974975616807b4f (patch) | |
tree | 64caaedbb4484242c6b8bd55ad0378624c047e24 | |
parent | 71492739d8870fe352eeca281b4ae7df78a9047f (diff) | |
parent | 75577588a978be2d7d8a8a71a00ea5b6ee53d944 (diff) | |
download | bugseverywhere-895fd728ca61afd6cad5d1a81974975616807b4f.tar.gz |
Merged bugfix branch be.missing-git-config
4 files changed, 80 insertions, 4 deletions
diff --git a/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/comments/d4a87066-c5f4-49f1-9bd9-a872c8e4ffe6/body b/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/comments/d4a87066-c5f4-49f1-9bd9-a872c8e4ffe6/body new file mode 100644 index 0000000..d29c749 --- /dev/null +++ b/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/comments/d4a87066-c5f4-49f1-9bd9-a872c8e4ffe6/body @@ -0,0 +1,43 @@ +BE should not crash when be list|show is used on a git repository that +have not the config variables user.name and user.email defined in the +.git/config file. + +To view the bug, in my opinion shold not be mandatory to have these two options +defined + + +Traceroute: + +galactica:~/Devel/dumb> be show 996 +Traceback (most recent call last): + File "/usr/bin/be", line 62, in <module> + sys.exit(cmdutil.execute(args[0], args[1:])) + File "/usr/lib/python2.5/site-packages/libbe/cmdutil.py", line 76, in execute + ret = cmd.execute([a.decode(enc) for a in args]) + File "/usr/lib/python2.5/site-packages/becommands/show.py", line 60, in execute + bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) + File "/usr/lib/python2.5/site-packages/libbe/bugdir.py", line 302, in __init__ + self.load() + File "/usr/lib/python2.5/site-packages/libbe/bugdir.py", line 382, in load + self.load_settings() + File "/usr/lib/python2.5/site-packages/libbe/bugdir.py", line 411, in load_settings + self._setup_user_id(self.user_id) + File "/usr/lib/python2.5/site-packages/libbe/properties.py", line 293, in _fget + value = generator(self) + File "/usr/lib/python2.5/site-packages/libbe/bugdir.py", line 177, in _guess_user_id + return self.rcs.get_user_id() + File "/usr/lib/python2.5/site-packages/libbe/rcs.py", line 258, in get_user_id + id = self._rcs_get_user_id() + File "/usr/lib/python2.5/site-packages/libbe/git.py", line 56, in _rcs_get_user_id + status,output,error = self._u_invoke_client("config", "user.name") + File "/usr/lib/python2.5/site-packages/libbe/rcs.py", line 458, in _u_invoke_client + return self._u_invoke(cl_args, stdin=stdin,expect=expect,cwd=directory) + File "/usr/lib/python2.5/site-packages/libbe/rcs.py", line 450, in _u_invoke + raise CommandError(args, status, error) +libbe.rcs.CommandError: Command failed (1): + + +while executing + ['git', 'config', 'user.name'] +galactica:~/Devel/dumb> + diff --git a/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/comments/d4a87066-c5f4-49f1-9bd9-a872c8e4ffe6/values b/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/comments/d4a87066-c5f4-49f1-9bd9-a872c8e4ffe6/values new file mode 100644 index 0000000..d6d1b61 --- /dev/null +++ b/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/comments/d4a87066-c5f4-49f1-9bd9-a872c8e4ffe6/values @@ -0,0 +1,8 @@ +Content-type: text/plain + + +Date: Mon, 03 Aug 2009 20:33:30 +0000 + + +From: Gianluca Montecchi <gian@grys.it> + diff --git a/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/values b/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/values new file mode 100644 index 0000000..375e44d --- /dev/null +++ b/.be/bugs/dcca51b3-bf8f-4482-8f67-662cfbcb9c6c/values @@ -0,0 +1,17 @@ +creator: Gianluca Montecchi <gian@grys.it> + + +reporter: Gianluca Montecchi <gian@grys.it> + + +severity: minor + + +status: fixed + + +summary: BE should not crash if user.email and user.name are not defined + + +time: Mon, 03 Aug 2009 20:30:43 +0000 + diff --git a/libbe/git.py b/libbe/git.py index f7e9646..53bc030 100644 --- a/libbe/git.py +++ b/libbe/git.py @@ -53,10 +53,18 @@ class Git(RCS): def _rcs_init(self, path): self._u_invoke_client("init", directory=path) def _rcs_get_user_id(self): - status,output,error = self._u_invoke_client("config", "user.name") - name = output.rstrip('\n') - status,output,error = self._u_invoke_client("config", "user.email") - email = output.rstrip('\n') + status,output,error = \ + self._u_invoke_client("config", "user.name", expect=(0,1)) + if status == 0: + name = output.rstrip('\n') + else: + name = "" + status,output,error = \ + self._u_invoke_client("config", "user.email", expect=(0,1)) + if status == 0: + email = output.rstrip('\n') + else: + email = "" if name != "" or email != "": # got something! # guess missing info, if necessary if name == "": |