~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commit.py

[merge] refactoring of branch vs working tree, etc (robertc)

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
from binascii import hexlify
73
73
from cStringIO import StringIO
74
74
 
 
75
from bzrlib.atomicfile import AtomicFile
75
76
from bzrlib.osutils import (local_time_offset,
76
77
                            rand_bytes, compact_date,
77
78
                            kind_marker, is_inside_any, quotefn,
78
79
                            sha_string, sha_strings, sha_file, isdir, isfile,
79
80
                            split_lines)
80
 
from bzrlib.branch import gen_file_id
81
81
import bzrlib.config
82
82
from bzrlib.errors import (BzrError, PointlessCommit,
83
83
                           HistoryMissing,
92
92
from bzrlib.inventory import Inventory, ROOT_ID
93
93
from bzrlib.weave import Weave
94
94
from bzrlib.weavefile import read_weave, write_weave_v5
95
 
from bzrlib.atomicfile import AtomicFile
 
95
from bzrlib.workingtree import WorkingTree
96
96
 
97
97
 
98
98
def commit(*args, **kwargs):
124
124
    def missing(self, path):
125
125
        pass
126
126
 
 
127
 
127
128
class ReportCommitToLog(NullCommitReporter):
128
129
 
129
130
    def snapshot_change(self, change, path):
141
142
    def missing(self, path):
142
143
        note('missing %s', path)
143
144
 
 
145
 
144
146
class Commit(object):
145
147
    """Task of committing a new revision.
146
148
 
207
209
        self.revprops = {'branch-nick': branch.nick}
208
210
        if revprops:
209
211
            self.revprops.update(revprops)
 
212
        self.work_tree = WorkingTree(branch.base, branch)
210
213
 
211
214
        if strict:
212
215
            # raise an exception as soon as we find a single unknown.
213
 
            for unknown in branch.unknowns():
 
216
            for unknown in self.work_tree.unknowns():
214
217
                raise StrictCommitFailed()
215
218
 
216
219
        if timestamp is None:
245
248
 
246
249
        self.branch.lock_write()
247
250
        try:
248
 
            self.work_tree = self.branch.working_tree()
249
251
            self.work_inv = self.work_tree.inventory
250
252
            self.basis_tree = self.branch.basis_tree()
251
253
            self.basis_inv = self.basis_tree.inventory