~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

(vila) Fix test failures blocking package builds. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005-2011 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
 
18
 
17
19
# TODO: Some kind of command-line display of revision properties:
18
20
# perhaps show them in log -v and allow them as options to the commit command.
19
21
 
20
22
 
21
23
from bzrlib.lazy_import import lazy_import
22
24
lazy_import(globals(), """
23
 
from bzrlib import deprecated_graph
24
25
from bzrlib import bugtracker
25
26
""")
26
27
from bzrlib import (
28
29
    symbol_versioning,
29
30
    )
30
31
from bzrlib.osutils import contains_whitespace
31
 
from bzrlib.progress import DummyProgress
32
32
 
33
33
NULL_REVISION="null:"
34
34
CURRENT_REVISION="current:"
54
54
 
55
55
    def __init__(self, revision_id, properties=None, **args):
56
56
        self.revision_id = revision_id
57
 
        self.properties = properties or {}
58
 
        self._check_properties()
 
57
        if properties is None:
 
58
            self.properties = {}
 
59
        else:
 
60
            self.properties = properties
 
61
            self._check_properties()
59
62
        self.committer = None
60
63
        self.parent_ids = []
61
64
        self.parent_sha1s = []
88
91
                raise ValueError("invalid property name %r" % name)
89
92
            if not isinstance(value, basestring):
90
93
                raise ValueError("invalid property value %r for %r" %
91
 
                                 (name, value))
 
94
                                 (value, name))
92
95
 
93
96
    def get_history(self, repository):
94
97
        """Return the canonical line-of-history for this revision.
119
122
        else:
120
123
            return ''
121
124
 
122
 
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((1, 13, 0)))
123
 
    def get_apparent_author(self):
124
 
        """Return the apparent author of this revision.
125
 
 
126
 
        This method is deprecated in favour of get_apparent_authors.
127
 
 
128
 
        If the revision properties contain any author names,
129
 
        return the first. Otherwise return the committer name.
130
 
        """
131
 
        authors = self.get_apparent_authors()
132
 
        if authors:
133
 
            return authors[0]
134
 
        else:
135
 
            return None
136
 
 
137
125
    def get_apparent_authors(self):
138
126
        """Return the apparent authors of this revision.
139
127