~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Curtis Hovey
  • Date: 2011-08-12 14:39:51 UTC
  • mto: This revision was merged to the branch mainline in revision 13685.
  • Revision ID: curtis.hovey@canonical.com-20110812143951-74vfvrt37gtt4fz2
Sorted imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2010 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',
14
16
    ]
15
17
 
16
18
from lazr.restful.declarations import (
28
30
    TextLine,
29
31
    )
30
32
 
31
 
from lp import _
 
33
from canonical.launchpad import _
32
34
from lp.code.interfaces.revision import IRevision
33
35
 
34
36
 
80
82
        IRevision, readonly=True, title=_('The new revision of the diff.'))
81
83
 
82
84
 
 
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
 
83
119
class IPreviewDiff(IDiff):
84
120
    """A diff generated to show actual diff between two branches.
85
121