~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: James Westby
  • Date: 2009-02-26 19:21:53 UTC
  • mto: This revision was merged to the branch mainline in revision 4077.
  • Revision ID: jw+debian@jameswestby.net-20090226192153-wcqvwsjb5cn37lb9
Allow specifying multiple authors for a revision.

The revision property "author" is now a "\n"-separated list of authors.

--author can be specified multiple times to populate that list at commit
time.

get_apparent_author() is deprecated in favour of get_apparent_authors(),
which will return a list.

Some things (e.g. annotate) still just use the first item from that list,
but there is now support for other code to use all of the authors.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
        """
113
113
        return self.message.lstrip().split('\n', 1)[0]
114
114
 
 
115
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((1, 13, 0)))
115
116
    def get_apparent_author(self):
116
117
        """Return the apparent author of this revision.
117
118
 
118
 
        If the revision properties contain the author name,
119
 
        return it. Otherwise return the committer name.
120
 
        """
121
 
        return self.properties.get('author', self.committer)
 
119
        This method is deprecated in favour of get_apparent_authors.
 
120
 
 
121
        If the revision properties contain any author names,
 
122
        return the first. Otherwise return the committer name.
 
123
        """
 
124
        return self.get_apparent_authors()[0]
 
125
 
 
126
    def get_apparent_authors(self):
 
127
        """Return the apparent authors of this revision.
 
128
 
 
129
        If the revision properties contain the names of the authors,
 
130
        return them. Otherwise return the committer name.
 
131
 
 
132
        The return value will be a list containing at least one element.
 
133
        """
 
134
        author = self.properties.get('author', None)
 
135
        if author is None:
 
136
            return [self.committer]
 
137
        else:
 
138
            return author.split("\n")
122
139
 
123
140
 
124
141
def iter_ancestors(revision_id, revision_source, only_present=False):