~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset.py

  • Committer: Martin Pool
  • Date: 2005-05-17 06:56:16 UTC
  • Revision ID: mbp@sourcefrog.net-20050517065616-6f23381d6184a8aa
- add space for un-merged patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    return newdict
33
33
 
34
34
 
35
 
class PatchApply(object):
 
35
class PatchApply:
36
36
    """Patch application as a kind of content change"""
37
37
    def __init__(self, contents):
38
38
        """Constructor.
81
81
            conflict_handler.failed_hunks(filename)
82
82
 
83
83
        
84
 
class ChangeUnixPermissions(object):
 
84
class ChangeUnixPermissions:
85
85
    """This is two-way change, suitable for file modification, creation,
86
86
    deletion"""
87
87
    def __init__(self, old_mode, new_mode):
163
163
                
164
164
            
165
165
 
166
 
class SymlinkCreate(object):
 
166
class SymlinkCreate:
167
167
    """Creates or deletes a symlink (for use with ReplaceContents)"""
168
168
    def __init__(self, contents):
169
169
        """Constructor.
202
202
    def __ne__(self, other):
203
203
        return not (self == other)
204
204
 
205
 
class FileCreate(object):
 
205
class FileCreate:
206
206
    """Create or delete a file (for use with ReplaceContents)"""
207
207
    def __init__(self, contents):
208
208
        """Constructor
265
265
    for i in range(len(sequence)):
266
266
        yield sequence[max - i]
267
267
 
268
 
class ReplaceContents(object):
 
268
class ReplaceContents:
269
269
    """A contents-replacement framework.  It allows a file/directory/symlink to
270
270
    be created, deleted, or replaced with another file/directory/symlink.
271
271
    Arguments must be callable with (filename, reverse).
332
332
            if mode is not None:
333
333
                os.chmod(filename, mode)
334
334
 
335
 
class ApplySequence(object):
 
335
class ApplySequence:
336
336
    def __init__(self, changes=None):
337
337
        self.changes = []
338
338
        if changes is not None:
362
362
            change.apply(filename, conflict_handler, reverse)
363
363
 
364
364
 
365
 
class Diff3Merge(object):
 
365
class Diff3Merge:
366
366
    def __init__(self, base_file, other_file):
367
367
        self.base_file = base_file
368
368
        self.other_file = other_file
762
762
        Exception.__init__(self, msg)
763
763
        self.id = id
764
764
 
765
 
class Changeset(object):
 
765
class Changeset:
766
766
    """A set of changes to apply"""
767
767
    def __init__(self):
768
768
        self.entries = {}
1006
1006
        Exception.__init__(self, msg)
1007
1007
        self.filename = filename
1008
1008
 
1009
 
class ExceptionConflictHandler(object):
 
1009
class ExceptionConflictHandler:
1010
1010
    def __init__(self, dir):
1011
1011
        self.dir = dir
1012
1012
    
1066
1066
    def missing_for_rename(self, filename):
1067
1067
        raise MissingForRename(filename)
1068
1068
 
1069
 
    def finalize():
1070
 
        pass
1071
 
 
1072
1069
def apply_changeset(changeset, inventory, dir, conflict_handler=None, 
1073
1070
                    reverse=False):
1074
1071
    """Apply a changeset to a directory.
1503
1500
 
1504
1501
        
1505
1502
    
1506
 
class Inventory(object):
 
1503
class Inventory:
1507
1504
    def __init__(self, inventory):
1508
1505
        self.inventory = inventory
1509
1506
        self.rinventory = None