Rev 3852: Catch exceptions from pwd and raise a better error (Andrew Bennetts) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Nov 25 18:31:49 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3852
revision-id: pqm at pqm.ubuntu.com-20081125183146-g6pgo3yeyggtvh9s
parent: pqm at pqm.ubuntu.com-20081125175638-cyrknpibcz284nf2
parent: john at arbash-meinel.com-20081125171926-ilhylvejbztofjex
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2008-11-25 18:31:46 +0000
message:
  Catch exceptions from pwd and raise a better error (Andrew Bennetts)
modified:
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
    ------------------------------------------------------------
    revno: 3849.1.1
    revision-id: john at arbash-meinel.com-20081125171926-ilhylvejbztofjex
    parent: pqm at pqm.ubuntu.com-20081125152232-c22rycit2dfzm11f
    author: Andrew Bennetts <andrew.bennetts at canonical.com>
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: catch_pwd_error
    timestamp: Tue 2008-11-25 11:19:26 -0600
    message:
      Catch exceptions from pwd and raise a better error
    modified:
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2008-10-16 18:30:32 +0000
+++ b/bzrlib/config.py	2008-11-25 17:19:26 +0000
@@ -839,7 +839,11 @@
     try:
         import pwd
         uid = os.getuid()
-        w = pwd.getpwuid(uid)
+        try:
+            w = pwd.getpwuid(uid)
+        except KeyError:
+            raise errors.BzrCommandError('Unable to determine your name.  '
+                'Please use "bzr whoami" to set it.')
 
         # we try utf-8 first, because on many variants (like Linux),
         # /etc/passwd "should" be in utf-8, and because it's unlikely to give




More information about the bazaar-commits mailing list