~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/testament.py

NEWS section template into a separate file

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Testament - a summary of a revision for signing.
18
18
 
19
 
A testament can be defined as "something that serves as tangible 
 
19
A testament can be defined as "something that serves as tangible
20
20
proof or evidence."  In bzr we use them to allow people to certify
21
 
particular revisions as authentic.  
 
21
particular revisions as authentic.
22
22
 
23
23
The goal is that if two revisions are semantically equal, then they will
24
24
have a byte-for-byte equal testament.  We can define different versions of
61
61
 
62
62
# XXX: At the moment, clients trust that the graph described in a weave
63
63
# is accurate, but that's not covered by the testament.  Perhaps the best
64
 
# fix is when verifying a revision to make sure that every file mentioned 
 
64
# fix is when verifying a revision to make sure that every file mentioned
65
65
# in the revision has compatible ancestry links.
66
66
 
67
67
# TODO: perhaps write timestamp in a more readable form
70
70
# revisions can be serialized.
71
71
 
72
72
from copy import copy
73
 
from sha import sha
74
73
 
75
 
from bzrlib.osutils import contains_whitespace, contains_linebreaks
 
74
from bzrlib.osutils import (
 
75
    contains_whitespace,
 
76
    contains_linebreaks,
 
77
    sha,
 
78
    )
76
79
 
77
80
 
78
81
class Testament(object):
79
82
    """Reduced summary of a revision.
80
83
 
81
 
    Testaments can be 
 
84
    Testaments can be
82
85
 
83
86
      - produced from a revision
84
87
      - written to a stream
177
180
 
178
181
    def as_short_text(self):
179
182
        """Return short digest-based testament."""
180
 
        return (self.short_header + 
 
183
        return (self.short_header +
181
184
                'revision-id: %s\n'
182
185
                'sha1: %s\n'
183
186
                % (self.revision_id, self.as_sha1()))
215
218
 
216
219
class StrictTestament3(StrictTestament):
217
220
    """This testament format is for use as a checksum in bundle format 0.9+
218
 
    
 
221
 
219
222
    It differs from StrictTestament by including data about the tree root.
220
223
    """
221
224