~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Gordon Tyler
  • Date: 2010-01-14 15:24:04 UTC
  • mto: (5037.3.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5046.
  • Revision ID: gordon@doxxx.net-20100114152404-d64ik2afl96lcml0
Reverted changes to test_rules since the original should work now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 = []
68
71
    def __eq__(self, other):
69
72
        if not isinstance(other, Revision):
70
73
            return False
71
 
        # FIXME: rbc 20050930 parent_ids are not being compared
72
74
        return (
73
75
                self.inventory_sha1 == other.inventory_sha1
74
76
                and self.revision_id == other.revision_id
76
78
                and self.message == other.message
77
79
                and self.timezone == other.timezone
78
80
                and self.committer == other.committer
79
 
                and self.properties == other.properties)
 
81
                and self.properties == other.properties
 
82
                and self.parent_ids == other.parent_ids)
80
83
 
81
84
    def __ne__(self, other):
82
85
        return not self.__eq__(other)
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.
111
114
 
112
115
    def get_summary(self):
113
116
        """Get the first line of the log message for this revision.
 
117
 
 
118
        Return an empty string if message is None.
114
119
        """
115
 
        return self.message.lstrip().split('\n', 1)[0]
 
120
        if self.message:
 
121
            return self.message.lstrip().split('\n', 1)[0]
 
122
        else:
 
123
            return ''
116
124
 
117
125
    @symbol_versioning.deprecated_method(symbol_versioning.deprecated_in((1, 13, 0)))
118
126
    def get_apparent_author(self):