/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

Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
import re
68
68
import sys
69
69
import time
70
 
import pdb
 
70
import warnings
71
71
 
72
72
from cStringIO import StringIO
73
73
 
75
75
import bzrlib.config
76
76
import bzrlib.errors as errors
77
77
from bzrlib.errors import (BzrError, PointlessCommit,
78
 
                           HistoryMissing,
79
78
                           ConflictsInTree,
80
79
                           StrictCommitFailed
81
80
                           )
86
85
from bzrlib.trace import mutter, note, warning
87
86
from bzrlib.xml5 import serializer_v5
88
87
from bzrlib.inventory import Inventory, ROOT_ID, InventoryEntry
89
 
from bzrlib.symbol_versioning import *
 
88
from bzrlib.symbol_versioning import (deprecated_passed,
 
89
        deprecated_function,
 
90
        zero_seven,
 
91
        DEPRECATED_PARAMETER)
90
92
from bzrlib.workingtree import WorkingTree
91
93
 
92
94
 
98
100
 
99
101
    New code should use the Commit class instead.
100
102
    """
101
 
    ## XXX: Remove this in favor of Branch.commit?
 
103
    ## XXX: Remove this in favor of WorkingTree.commit?
102
104
    Commit().commit(*args, **kwargs)
103
105
 
104
106
 
221
223
        mutter('preparing to commit')
222
224
 
223
225
        if deprecated_passed(branch):
224
 
            warn("Commit.commit (branch, ...): The branch parameter is "
 
226
            warnings.warn("Commit.commit (branch, ...): The branch parameter is "
225
227
                 "deprecated as of bzr 0.8. Please use working_tree= instead.",
226
228
                 DeprecationWarning, stacklevel=2)
227
229
            self.branch = branch
343
345
            self._emit_progress_update()
344
346
        finally:
345
347
            self._cleanup()
 
348
        return self.rev_id
346
349
 
347
350
    def _check_bound_branch(self):
348
351
        """Check to see if the local branch is bound.
385
388
        self.bound_branch = self.branch
386
389
        self.master_branch.lock_write()
387
390
        self.master_locked = True
388
 
####        
389
 
####        # Check to see if we have any pending merges. If we do
390
 
####        # those need to be pushed into the master branch
391
 
####        pending_merges = self.work_tree.pending_merges()
392
 
####        if pending_merges:
393
 
####            for revision_id in pending_merges:
394
 
####                self.master_branch.repository.fetch(self.bound_branch.repository,
395
 
####                                                    revision_id=revision_id)
396
391
 
397
392
    def _cleanup(self):
398
393
        """Cleanup any open locks, progress bars etc."""
451
446
        """Record the parents of a merge for merge detection."""
452
447
        # TODO: Make sure that this list doesn't contain duplicate 
453
448
        # entries and the order is preserved when doing this.
454
 
        pending_merges = self.work_tree.pending_merges()
455
 
        self.parents = []
 
449
        self.parents = self.work_tree.get_parent_ids()
456
450
        self.parent_invs = []
457
 
        precursor_id = self.branch.last_revision()
458
 
        if precursor_id:
459
 
            self.parents.append(precursor_id)
460
 
        self.parents += pending_merges
461
451
        for revision in self.parents:
462
452
            if self.branch.repository.has_revision(revision):
463
453
                inventory = self.branch.repository.get_inventory(revision)
469
459
            if not self.branch.repository.has_revision(parent_id):
470
460
                if parent_id == self.branch.last_revision():
471
461
                    warning("parent is missing %r", parent_id)
472
 
                    raise HistoryMissing(self.branch, 'revision', parent_id)
473
 
                else:
474
 
                    mutter("commit will ghost revision %r", parent_id)
 
462
                    raise BzrCheckError("branch %s is missing revision {%s}"
 
463
                            % (self.branch, parent_id))
475
464
            
476
465
    def _remove_deleted(self):
477
466
        """Remove deleted files from the working inventories.