~bzr/bzr/bzr.1.9

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-28 09:48:31 UTC
  • mfrom: (3774.1.4 tree-api-updates)
  • Revision ID: pqm@pqm.ubuntu.com-20081028094831-81he4yysmaobxb41
Make get_file_text and get_file_lines official (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
264
264
        """
265
265
        raise NotImplementedError(self.get_file)
266
266
 
 
267
    def get_file_text(self, file_id, path=None):
 
268
        """Return the byte content of a file.
 
269
 
 
270
        :param file_id: The file_id of the file.
 
271
        :param path: The path of the file.
 
272
        If both file_id and path are supplied, an implementation may use
 
273
        either one.
 
274
        """
 
275
        my_file = self.get_file(file_id, path)
 
276
        try:
 
277
            return my_file.read()
 
278
        finally:
 
279
            my_file.close()
 
280
 
 
281
    def get_file_lines(self, file_id, path=None):
 
282
        """Return the content of a file, as lines.
 
283
 
 
284
        :param file_id: The file_id of the file.
 
285
        :param path: The path of the file.
 
286
        If both file_id and path are supplied, an implementation may use
 
287
        either one.
 
288
        """
 
289
        return osutils.split_lines(self.get_file_text(file_id, path))
 
290
 
267
291
    def get_file_mtime(self, file_id, path=None):
268
292
        """Return the modification time for a file.
269
293