/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

  • Committer: Carl Friedrich Bolz
  • Date: 2006-09-06 21:17:22 UTC
  • mfrom: (1977 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2026.
  • Revision ID: cfbolz@gmx.de-20060906211722-b04f9c3ad1f53ef1
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
from bzrlib import symbol_versioning
86
86
from bzrlib.symbol_versioning import (deprecated_passed,
87
87
        deprecated_function,
88
 
        zero_seven,
89
88
        DEPRECATED_PARAMETER)
90
89
from bzrlib.workingtree import WorkingTree
91
90
 
92
91
 
93
 
@deprecated_function(zero_seven)
94
 
def commit(*args, **kwargs):
95
 
    """Commit a new revision to a branch.
96
 
 
97
 
    Function-style interface for convenience of old callers.
98
 
 
99
 
    New code should use the Commit class instead.
100
 
    """
101
 
    ## XXX: Remove this in favor of WorkingTree.commit?
102
 
    Commit().commit(*args, **kwargs)
103
 
 
104
 
 
105
92
class NullCommitReporter(object):
106
93
    """I report on progress of a commit."""
107
94
 
260
247
            # check for out of date working trees
261
248
            # if we are bound, then self.branch is the master branch and this
262
249
            # test is thus all we need.
263
 
            if self.work_tree.last_revision() != self.master_branch.last_revision():
 
250
            master_last = self.master_branch.last_revision()
 
251
            if (master_last is not None and 
 
252
                master_last != self.work_tree.last_revision()):
264
253
                raise errors.OutOfDateTree(self.work_tree)
265
254
    
266
255
            if strict:
292
281
            if len(self.parents) > 1 and self.specific_files:
293
282
                raise NotImplementedError('selected-file commit of merges is not supported yet: files %r',
294
283
                        self.specific_files)
295
 
            self._check_parents_present()
 
284
            
296
285
            self.builder = self.branch.get_commit_builder(self.parents, 
297
286
                self.config, timestamp, timezone, committer, revprops, rev_id)
298
287
            
330
319
            # and now do the commit locally.
331
320
            self.branch.append_revision(self.rev_id)
332
321
 
333
 
            self.work_tree.set_pending_merges([])
334
 
            self.work_tree.set_last_revision(self.rev_id)
 
322
            # if the builder gave us the revisiontree it created back, we
 
323
            # could use it straight away here.
 
324
            # TODO: implement this.
 
325
            self.work_tree.set_parent_trees([(self.rev_id,
 
326
                self.branch.repository.revision_tree(self.rev_id))])
335
327
            # now the work tree is up to date with the branch
336
328
            
337
329
            self.reporter.completed(self.branch.revno(), self.rev_id)
451
443
        self.parent_invs = []
452
444
        for revision in self.parents:
453
445
            if self.branch.repository.has_revision(revision):
 
446
                mutter('commit parent revision {%s}', revision)
454
447
                inventory = self.branch.repository.get_inventory(revision)
455
448
                self.parent_invs.append(inventory)
 
449
            else:
 
450
                mutter('commit parent ghost revision {%s}', revision)
456
451
 
457
 
    def _check_parents_present(self):
458
 
        for parent_id in self.parents:
459
 
            mutter('commit parent revision {%s}', parent_id)
460
 
            if not self.branch.repository.has_revision(parent_id):
461
 
                if parent_id == self.branch.last_revision():
462
 
                    warning("parent is missing %r", parent_id)
463
 
                    raise BzrCheckError("branch %s is missing revision {%s}"
464
 
                            % (self.branch, parent_id))
465
 
            
466
452
    def _remove_deleted(self):
467
453
        """Remove deleted files from the working inventories.
468
454