~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Vincent Ladeuil
  • Date: 2009-04-27 16:10:10 UTC
  • mto: (4310.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4311.
  • Revision ID: v.ladeuil+lp@free.fr-20090427161010-7swfzeagf63cpixd
Fix bug #367726 by reverting some default user handling introduced
while fixing bug #256612.

* bzrlib/transport/ssh.py:
(_paramiko_auth): Explicitly use getpass.getuser() as default
user.

* bzrlib/transport/ftp/_gssapi.py:
(GSSAPIFtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/transport/ftp/__init__.py:
(FtpTransport._create_connection): Explicitly use
getpass.getuser() as default user.

* bzrlib/tests/test_sftp_transport.py:
(TestUsesAuthConfig.test_sftp_is_none_if_no_config)
(TestUsesAuthConfig.test_sftp_doesnt_prompt_username): Revert to
None as the default user.

* bzrlib/tests/test_remote.py:
(TestRemoteSSHTransportAuthentication): The really offending one:
revert to None as the default user.

* bzrlib/tests/test_config.py:
(TestAuthenticationConfig.test_username_default_no_prompt): Update
test (and some PEP8).

* bzrlib/smtp_connection.py:
(SMTPConnection._authenticate): Revert to None as the default
user.

* bzrlib/plugins/launchpad/account.py:
(_get_auth_user): Revert default value handling.

* bzrlib/config.py:
(AuthenticationConfig.get_user): Fix doc-string. Leave default
value handling to callers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
28
28
    symbol_versioning,
29
29
    )
30
30
from bzrlib.osutils import contains_whitespace
 
31
from bzrlib.progress import DummyProgress
31
32
 
32
33
NULL_REVISION="null:"
33
34
CURRENT_REVISION="current:"
53
54
 
54
55
    def __init__(self, revision_id, properties=None, **args):
55
56
        self.revision_id = revision_id
56
 
        if properties is None:
57
 
            self.properties = {}
58
 
        else:
59
 
            self.properties = properties
60
 
            self._check_properties()
 
57
        self.properties = properties or {}
 
58
        self._check_properties()
61
59
        self.committer = None
62
60
        self.parent_ids = []
63
61
        self.parent_sha1s = []
70
68
    def __eq__(self, other):
71
69
        if not isinstance(other, Revision):
72
70
            return False
 
71
        # FIXME: rbc 20050930 parent_ids are not being compared
73
72
        return (
74
73
                self.inventory_sha1 == other.inventory_sha1
75
74
                and self.revision_id == other.revision_id
77
76
                and self.message == other.message
78
77
                and self.timezone == other.timezone
79
78
                and self.committer == other.committer
80
 
                and self.properties == other.properties
81
 
                and self.parent_ids == other.parent_ids)
 
79
                and self.properties == other.properties)
82
80
 
83
81
    def __ne__(self, other):
84
82
        return not self.__eq__(other)
90
88
                raise ValueError("invalid property name %r" % name)
91
89
            if not isinstance(value, basestring):
92
90
                raise ValueError("invalid property value %r for %r" %
93
 
                                 (value, name))
 
91
                                 (name, value))
94
92
 
95
93
    def get_history(self, repository):
96
94
        """Return the canonical line-of-history for this revision.
113
111
 
114
112
    def get_summary(self):
115
113
        """Get the first line of the log message for this revision.
116
 
 
117
 
        Return an empty string if message is None.
118
 
        """
119
 
        if self.message:
120
 
            return self.message.lstrip().split('\n', 1)[0]
 
114
        """
 
115
        return self.message.lstrip().split('\n', 1)[0]
 
116
 
 
117
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((1, 13, 0)))
 
118
    def get_apparent_author(self):
 
119
        """Return the apparent author of this revision.
 
120
 
 
121
        This method is deprecated in favour of get_apparent_authors.
 
122
 
 
123
        If the revision properties contain any author names,
 
124
        return the first. Otherwise return the committer name.
 
125
        """
 
126
        authors = self.get_apparent_authors()
 
127
        if authors:
 
128
            return authors[0]
121
129
        else:
122
 
            return ''
 
130
            return None
123
131
 
124
132
    def get_apparent_authors(self):
125
133
        """Return the apparent authors of this revision.