~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-16 22:00:19 UTC
  • mto: This revision was merged to the branch mainline in revision 1942.
  • Revision ID: john@arbash-meinel.com-20060816220019-541cb90093258ac3
Using real utf8 and cache_utf8 has similar performance, 272ms, and 363ms

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
 
 
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
16
16
 
17
17
 
18
18
# XXX: Can we do any better about making interrupted commits change
19
 
# nothing?  Perhaps the best approach is to integrate commit of
20
 
# AtomicFiles with releasing the lock on the Branch.
 
19
# nothing?  
21
20
 
22
21
# TODO: Separate 'prepare' phase where we find a list of potentially
23
22
# committed files.  We then can then pause the commit to prompt for a
71
70
 
72
71
from cStringIO import StringIO
73
72
 
74
 
from bzrlib.atomicfile import AtomicFile
75
73
import bzrlib.config
76
74
import bzrlib.errors as errors
77
75
from bzrlib.errors import (BzrError, PointlessCommit,
308
306
                raise PointlessCommit()
309
307
 
310
308
            self._emit_progress_update()
311
 
            # TODO: Now the new inventory is known, check for conflicts and prompt the 
312
 
            # user for a commit message.
 
309
            # TODO: Now the new inventory is known, check for conflicts and
 
310
            # prompt the user for a commit message.
 
311
            # ADHB 2006-08-08: If this is done, populate_new_inv should not add
 
312
            # weave lines, because nothing should be recorded until it is known
 
313
            # that commit will succeed.
313
314
            self.builder.finish_inventory()
314
315
            self._emit_progress_update()
315
316
            self.rev_id = self.builder.commit(self.message)
499
500
        """
500
501
        # ESEPARATIONOFCONCERNS: this function is diffing and using the diff
501
502
        # results to create a new inventory at the same time, which results
502
 
        # in bugs like #46635.  Any reason not to use/enhance compare_trees?
 
503
        # in bugs like #46635.  Any reason not to use/enhance Tree.changes_from?
503
504
        # ADHB 11-07-2006
504
505
        mutter("Selecting files for commit with filter %s", self.specific_files)
505
 
        # iter_entries does not visit the ROOT_ID node so we need to call
506
 
        # self._emit_progress_update once by hand.
507
 
        self._emit_progress_update()
508
 
        for path, new_ie in self.work_inv.iter_entries():
 
506
        entries = self.work_inv.iter_entries()
 
507
        if not self.builder.record_root_entry:
 
508
            warnings.warn('CommitBuilders should support recording the root'
 
509
                ' entry as of bzr 0.10.', DeprecationWarning, stacklevel=1)
 
510
            self.builder.new_inventory.add(self.basis_inv.root.copy())
 
511
            entries.next()
 
512
            self._emit_progress_update()
 
513
        for path, new_ie in entries:
509
514
            self._emit_progress_update()
510
515
            file_id = new_ie.file_id
511
 
            mutter('check %s {%s}', path, file_id)
 
516
            # mutter('check %s {%s}', path, file_id)
512
517
            if (not self.specific_files or 
513
518
                is_inside_or_parent_of_any(self.specific_files, path)):
514
 
                    mutter('%s selected for commit', path)
 
519
                    # mutter('%s selected for commit', path)
515
520
                    ie = new_ie.copy()
516
521
                    ie.revision = None
517
522
            else:
518
 
                mutter('%s not selected for commit', path)
 
523
                # mutter('%s not selected for commit', path)
519
524
                if self.basis_inv.has_id(file_id):
520
525
                    ie = self.basis_inv[file_id].copy()
521
526
                else: