~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-04-29 07:14:39 UTC
  • mfrom: (4310.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090429071439-f7089qmxwc51k9rx
(vila) Respect ~/.ssh/config usernames for bzr+ssh connections
        (#367726)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1132
1132
        config.update({name: values})
1133
1133
        self._save()
1134
1134
 
1135
 
    def get_user(self, scheme, host, port=None, realm=None, path=None, 
 
1135
    def get_user(self, scheme, host, port=None, realm=None, path=None,
1136
1136
                 prompt=None, ask=False, default=None):
1137
1137
        """Get a user from authentication file.
1138
1138
 
1149
1149
        :param ask: Ask the user if there is no explicitly configured username 
1150
1150
                    (optional)
1151
1151
 
 
1152
        :param default: The username returned if none is defined (optional).
 
1153
 
1152
1154
        :return: The found user.
1153
1155
        """
1154
1156
        credentials = self.get_credentials(scheme, host, port, user=None,
1169
1171
                    prompt_host = host
1170
1172
                user = ui.ui_factory.get_username(prompt, host=prompt_host)
1171
1173
            else:
1172
 
                if default is None:
1173
 
                    import getpass
1174
 
                    default = getpass.getuser()
1175
1174
                user = default
1176
1175
        return user
1177
1176