~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Jonathan Lange
  • Date: 2009-03-12 07:35:17 UTC
  • mto: This revision was merged to the branch mainline in revision 4134.
  • Revision ID: jml@canonical.com-20090312073517-z8di5cdnoydh6jcs
Add Revision.iter_bugs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from bzrlib.lazy_import import lazy_import
22
22
lazy_import(globals(), """
23
23
from bzrlib import deprecated_graph
 
24
from bzrlib import bugtracker
24
25
""")
25
26
from bzrlib import (
26
27
    errors,
140
141
        else:
141
142
            return authors.split("\n")
142
143
 
 
144
    def iter_bugs(self):
 
145
        """Iterate over the bugs associated with this revision."""
 
146
        bug_property = self.properties.get('bugs', None)
 
147
        if bug_property is None:
 
148
            return
 
149
        for line in bug_property.splitlines():
 
150
            try:
 
151
                url, status = line.split(None, 2)
 
152
            except ValueError:
 
153
                raise errors.InvalidLineInBugsProperty(line)
 
154
            if status not in bugtracker.ALLOWED_BUG_STATUSES:
 
155
                raise errors.InvalidBugStatus(status)
 
156
            yield url, status
 
157
 
143
158
 
144
159
def iter_ancestors(revision_id, revision_source, only_present=False):
145
160
    ancestors = (revision_id,)