~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/interfaces/diff.py

[r=bac][bug=835024] New error_description property on
        InitializeDistroSeriesJob.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
# pylint: disable-msg=E0211,E0213
11
11
    'IDiff',
12
12
    'IIncrementalDiff',
13
13
    'IPreviewDiff',
14
 
    'IStaticDiff',
15
 
    'IStaticDiffSource',
16
14
    ]
17
15
 
18
16
from lazr.restful.declarations import (
82
80
        IRevision, readonly=True, title=_('The new revision of the diff.'))
83
81
 
84
82
 
85
 
class IStaticDiff(Interface):
86
 
    """A diff with a fixed value, i.e. between two revisions."""
87
 
 
88
 
    from_revision_id = exported(TextLine(readonly=True))
89
 
 
90
 
    to_revision_id = exported(TextLine(readonly=True))
91
 
 
92
 
    diff = exported(
93
 
        Reference(IDiff, title=_('The Diff object.'), readonly=True))
94
 
 
95
 
    def destroySelf():
96
 
        """Destroy this object."""
97
 
 
98
 
 
99
 
class IStaticDiffSource(Interface):
100
 
    """Component that can acquire StaticDiffs."""
101
 
 
102
 
    def acquire(from_revision_id, to_revision_id, repository, filename=None):
103
 
        """Get or create a StaticDiff."""
104
 
 
105
 
    def acquireFromText(from_revision_id, to_revision_id, text,
106
 
                        filename=None):
107
 
        """Get or create a StaticDiff from a string.
108
 
 
109
 
        If a StaticDiff exists for this revision_id pair, the text is ignored.
110
 
 
111
 
        :param from_revision_id: The id of the old revision.
112
 
        :param to_revision_id: The id of the new revision.
113
 
        :param text: The text of the diff, as bytes.
114
 
        :param filename: The filename to store for the diff.  Randomly
115
 
            generated if not supplied.
116
 
        """
117
 
 
118
 
 
119
83
class IPreviewDiff(IDiff):
120
84
    """A diff generated to show actual diff between two branches.
121
85