~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: Aaron Bentley
  • Date: 2006-04-05 18:05:15 UTC
  • mto: (2027.1.2 revert-subpath-56549)
  • mto: This revision was merged to the branch mainline in revision 1647.
  • Revision ID: abentley@panoramicfeedback.com-20060405180515-4be2a622206de1f7
Got ConflictList implemented

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
from bzrlib.atomicfile import AtomicFile
51
51
from bzrlib.branch import (Branch,
52
52
                           quotefn)
53
 
from bzrlib.conflicts import (stanzas_to_conflicts, conflicts_to_stanzas, Conflict,
54
 
                              CONFLICT_SUFFIXES)
 
53
from bzrlib.conflicts import Conflict, ConflictList, CONFLICT_SUFFIXES
55
54
import bzrlib.bzrdir as bzrdir
56
55
from bzrlib.decorators import needs_read_lock, needs_write_lock
57
56
import bzrlib.errors as errors
870
869
    @deprecated_method(zero_eight)
871
870
    def iter_conflicts(self):
872
871
        """List all files in the tree that have text or content conflicts.
873
 
        DEPRECATED.  Use conflict_lines instead."""
 
872
        DEPRECATED.  Use conflicts instead."""
874
873
        return self._iter_conflicts()
875
874
 
876
875
    def _iter_conflicts(self):
1287
1286
        self._set_inventory(inv)
1288
1287
        mutter('wrote working inventory')
1289
1288
 
1290
 
    def set_conflict_lines(self, arg):
1291
 
        raise UnsupportedOperation(self.set_conflict_lines, self)
 
1289
    def set_conflicts(self, arg):
 
1290
        raise UnsupportedOperation(self.set_conflicts, self)
1292
1291
 
1293
1292
    @needs_read_lock
1294
 
    def conflict_lines(self):
 
1293
    def conflicts(self):
 
1294
        conflicts = ConflictList()
1295
1295
        for conflicted in self._iter_conflicts():
1296
1296
            text = True
1297
1297
            try:
1316
1316
                        text = False
1317
1317
                        break
1318
1318
            ctype = {True: 'text conflict', False: 'contents conflict'}[text]
1319
 
            yield Conflict.factory(ctype, path=conflicted, 
1320
 
                                   file_id=self.path2id(conflicted))
 
1319
            conflicts.append(Conflict.factory(ctype, path=conflicted,
 
1320
                             file_id=self.path2id(conflicted)))
 
1321
        return conflicts
 
1322
 
1321
1323
 
1322
1324
class WorkingTree3(WorkingTree):
1323
1325
    """This is the Format 3 working tree.
1354
1356
            return True
1355
1357
 
1356
1358
    @needs_write_lock
1357
 
    def set_conflict_lines(self, lines):
1358
 
        self._put_rio('conflicts', conflicts_to_stanzas(lines), 
 
1359
    def set_conflicts(self, conflicts):
 
1360
        self._put_rio('conflicts', conflicts.to_stanzas(), 
1359
1361
                      CONFLICT_HEADER_1)
1360
1362
 
1361
1363
    @needs_read_lock
1362
 
    def conflict_lines(self):
 
1364
    def conflicts(self):
1363
1365
        try:
1364
1366
            confile = self._control_files.get('conflicts')
1365
1367
        except NoSuchFile:
1366
 
            return []
 
1368
            return ConflictList()
1367
1369
        try:
1368
1370
            if confile.next() != CONFLICT_HEADER_1 + '\n':
1369
1371
                raise ConflictFormatError()
1370
1372
        except StopIteration:
1371
1373
            raise ConflictFormatError()
1372
 
        return stanzas_to_conflicts(RioReader(confile))
 
1374
        return ConflictList.from_stanzas(RioReader(confile))
1373
1375
 
1374
1376
 
1375
1377
def get_conflicted_stem(path):