~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to gen_changeset.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-13 22:24:36 UTC
  • mto: (0.5.85) (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050713222435-e4106b9c07341fb2
Cleaning up from pychecker.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
Just some work for generating a changeset.
4
4
"""
5
5
 
6
 
import bzrlib, bzrlib.errors
7
 
 
8
 
import common
 
6
import bzrlib
9
7
 
10
8
from bzrlib.inventory import ROOT_ID
11
9
from bzrlib.errors import BzrCommandError
97
95
        for parent in rev.parents:
98
96
            if parent.revision_id not in checked:
99
97
                to_check.append(parent.revision_id)
100
 
 
101
98
    return None
102
99
 
103
100
def _create_ancestry_to_rev(branch, ancestor_rev_id, this_rev_id):
271
268
 
272
269
    def _write_header(self):
273
270
        """Write the stuff that comes before the patches."""
274
 
        from bzrlib.osutils import username
275
 
        from common import format_highres_date
 
271
        from common import format_highres_date, get_header
276
272
        write = self._write
277
273
 
278
 
        for line in common.get_header():
 
274
        for line in get_header():
279
275
            write(line)
280
276
 
281
277
        # Print out the basic information about the 'target' revision
348
344
 
349
345
    def _write_diffs(self):
350
346
        """Write out the specific diffs"""
351
 
        from bzrlib.diff import internal_diff, external_diff
352
 
        from common import encode
 
347
        from bzrlib.diff import internal_diff
 
348
        from common import encode, guess_text_id
353
349
        DEVNULL = '/dev/null'
354
350
 
355
351
        diff_file = internal_diff
359
355
        tree = self.target_tree
360
356
 
361
357
 
362
 
        def get_text_id_str(file_id, modified=True):
 
358
        def get_text_id_str(file_id, kind, modified=True):
363
359
            """This returns an empty string if guess_text_id == real_text_id.
364
360
            Otherwise it returns a string suitable for printing, indicating
365
361
            the file's id.
366
362
            """
367
 
            guess_id = common.guess_text_id(tree, file_id, rev_id,
368
 
                    modified=modified)
 
363
            guess_id = guess_text_id(tree, file_id, rev_id,
 
364
                    kind, modified=modified)
369
365
            real_id = tree.inventory[file_id].text_id
370
366
            if guess_id != real_id:
371
367
                return '\ttext-id:' + encode(real_id)
388
384
            print >>self.to_file, '*** added %s %s\tfile-id:%s%s' % (kind,
389
385
                    encode(path),
390
386
                    encode(file_id),
391
 
                    get_text_id_str(file_id))
 
387
                    get_text_id_str(file_id, kind))
392
388
            if kind == 'file':
393
389
                diff_file(DEVNULL,
394
390
                          [],
399
395
        for old_path, new_path, file_id, kind, text_modified in self.delta.renamed:
400
396
            print >>self.to_file, '*** renamed %s %s\t=> %s%s' % (kind,
401
397
                    encode(old_path), encode(new_path),
402
 
                    get_text_id_str(file_id, text_modified))
 
398
                    get_text_id_str(file_id, kind, modified=text_modified))
403
399
            if self.full_rename and kind == 'file':
404
400
                diff_file(self.base_label + old_path,
405
401
                          self.base_tree.get_file(file_id).readlines(),
420
416
    
421
417
        for path, file_id, kind in self.delta.modified:
422
418
            print >>self.to_file, '*** modified %s %s%s' % (kind,
423
 
                    encode(path), get_text_id_str(file_id))
 
419
                    encode(path), get_text_id_str(file_id, kind))
424
420
            if kind == 'file':
425
421
                diff_file(self.base_label + path,
426
422
                          self.base_tree.get_file(file_id).readlines(),