~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_changeset.py

[merge] update from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
401
401
 
402
402
    def apply(self, filename, conflict_handler):
403
403
        import bzrlib.patch
404
 
        temp_dir = mkdtemp(prefix="bzr-")
 
404
        temp_dir = mkdtemp(prefix="bzr-", dir=os.path.dirname(filename))
405
405
        try:
406
 
            new_file = filename+".new"
 
406
            new_file = os.path.join(temp_dir, filename)
407
407
            base_file = self.dump_file(temp_dir, "base", self.base)
408
408
            other_file = self.dump_file(temp_dir, "other", self.other)
409
409
            base = base_file
647
647
 
648
648
        :rtype: bool
649
649
        """
650
 
 
651
650
        return (self.parent != self.new_parent or self.name != self.new_name)
652
651
 
653
652
    def is_deletion(self, reverse=False):
1178
1177
    return changed_inventory
1179
1178
 
1180
1179
 
1181
 
def apply_changeset_tree(cset, tree):
1182
 
    r_inventory = {}
1183
 
    for entry in tree.source_inventory().itervalues():
1184
 
        inventory[entry.id] = entry.path
1185
 
    new_inventory = apply_changeset(cset, r_inventory, tree.basedir)
1186
 
    new_entries, remove_entries = \
1187
 
        get_inventory_change(inventory, new_inventory, cset)
1188
 
    tree.update_source_inventory(new_entries, remove_entries)
1189
 
 
1190
 
 
1191
 
def get_inventory_change(inventory, new_inventory, cset):
1192
 
    new_entries = {}
1193
 
    remove_entries = []
1194
 
    for entry in cset.entries.itervalues():
1195
 
        if entry.needs_rename():
1196
 
            new_path = entry.get_new_path(inventory, cset)
1197
 
            if new_path is None:
1198
 
                remove_entries.append(entry.id)
1199
 
            else:
1200
 
                new_entries[new_path] = entry.id
1201
 
    return new_entries, remove_entries
1202
 
 
1203
 
 
1204
1180
def print_changeset(cset):
1205
1181
    """Print all non-boring changeset entries
1206
1182