~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset.py

Give a warning, not exception, when trying to merge
x-bit against deletion.

Workaround for #4558

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
import os.path
26
26
import errno
27
 
import patch
28
27
import stat
29
28
from tempfile import mkdtemp
30
29
from shutil import rmtree
31
 
from bzrlib.trace import mutter
 
30
from itertools import izip
 
31
 
 
32
from bzrlib.trace import mutter, warning
32
33
from bzrlib.osutils import rename, sha_file
33
34
import bzrlib
34
 
from itertools import izip
35
35
 
36
36
__docformat__ = "restructuredtext"
37
37
 
441
441
        return out_path
442
442
 
443
443
    def apply(self, filename, conflict_handler, reverse=False):
 
444
        import bzrlib.patch
444
445
        temp_dir = mkdtemp(prefix="bzr-")
445
446
        try:
446
447
            new_file = filename+".new"
452
453
            else:
453
454
                base = other_file
454
455
                other = base_file
455
 
            status = patch.diff3(new_file, filename, base, other)
 
456
            status = bzrlib.patch.diff3(new_file, filename, base, other)
456
457
            if status == 0:
457
458
                os.chmod(new_file, os.stat(filename).st_mode)
458
459
                rename(new_file, filename)
1208
1209
    #apply changes that don't affect filenames
1209
1210
    for entry in changeset.entries.itervalues():
1210
1211
        if not entry.is_creation_or_deletion() and not entry.is_boring():
 
1212
            if entry.id not in inventory:
 
1213
                warning("entry {%s} no longer present, can't be updated",
 
1214
                        entry.id)
 
1215
                continue
1211
1216
            path = os.path.join(dir, inventory[entry.id])
1212
1217
            entry.apply(path, conflict_handler, reverse)
1213
1218