/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

Update with new parent-ids patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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,
262
260
            # check for out of date working trees
263
261
            # if we are bound, then self.branch is the master branch and this
264
262
            # test is thus all we need.
265
 
            if self.work_tree.last_revision() != self.master_branch.last_revision():
 
263
            master_last = self.master_branch.last_revision()
 
264
            if (master_last is not None and 
 
265
                master_last != self.work_tree.last_revision()):
266
266
                raise errors.OutOfDateTree(self.work_tree)
267
267
    
268
268
            if strict:
294
294
            if len(self.parents) > 1 and self.specific_files:
295
295
                raise NotImplementedError('selected-file commit of merges is not supported yet: files %r',
296
296
                        self.specific_files)
297
 
            self._check_parents_present()
 
297
            
298
298
            self.builder = self.branch.get_commit_builder(self.parents, 
299
299
                self.config, timestamp, timezone, committer, revprops, rev_id)
300
300
            
308
308
                raise PointlessCommit()
309
309
 
310
310
            self._emit_progress_update()
311
 
            # TODO: Now the new inventory is known, check for conflicts and prompt the 
312
 
            # user for a commit message.
 
311
            # TODO: Now the new inventory is known, check for conflicts and
 
312
            # prompt the user for a commit message.
 
313
            # ADHB 2006-08-08: If this is done, populate_new_inv should not add
 
314
            # weave lines, because nothing should be recorded until it is known
 
315
            # that commit will succeed.
313
316
            self.builder.finish_inventory()
314
317
            self._emit_progress_update()
315
318
            self.rev_id = self.builder.commit(self.message)
453
456
        self.parent_invs = []
454
457
        for revision in self.parents:
455
458
            if self.branch.repository.has_revision(revision):
 
459
                mutter('commit parent revision {%s}', revision)
456
460
                inventory = self.branch.repository.get_inventory(revision)
457
461
                self.parent_invs.append(inventory)
 
462
            else:
 
463
                mutter('commit parent ghost revision {%s}', revision)
458
464
 
459
 
    def _check_parents_present(self):
460
 
        for parent_id in self.parents:
461
 
            mutter('commit parent revision {%s}', parent_id)
462
 
            if not self.branch.repository.has_revision(parent_id):
463
 
                if parent_id == self.branch.last_revision():
464
 
                    warning("parent is missing %r", parent_id)
465
 
                    raise BzrCheckError("branch %s is missing revision {%s}"
466
 
                            % (self.branch, parent_id))
467
 
            
468
465
    def _remove_deleted(self):
469
466
        """Remove deleted files from the working inventories.
470
467
 
505
502
        # in bugs like #46635.  Any reason not to use/enhance Tree.changes_from?
506
503
        # ADHB 11-07-2006
507
504
        mutter("Selecting files for commit with filter %s", self.specific_files)
508
 
        # at this point we dont copy the root entry:
509
505
        entries = self.work_inv.iter_entries()
510
 
        entries.next()
511
 
        self._emit_progress_update()
 
506
        if not self.builder.record_root_entry:
 
507
            warnings.warn('CommitBuilders should support recording the root'
 
508
                ' entry as of bzr 0.10.', DeprecationWarning, stacklevel=1)
 
509
            self.builder.new_inventory.add(self.basis_inv.root.copy())
 
510
            entries.next()
 
511
            self._emit_progress_update()
512
512
        for path, new_ie in entries:
513
513
            self._emit_progress_update()
514
514
            file_id = new_ie.file_id