~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset.py

[merge] win32

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import os.path
26
26
import errno
27
27
import stat
28
 
from tempfile import mkdtemp
29
28
from shutil import rmtree
30
29
from itertools import izip
31
30
 
32
31
from bzrlib.trace import mutter, warning
33
 
from bzrlib.osutils import rename, sha_file
 
32
from bzrlib.osutils import rename, sha_file, pathjoin, mkdtemp
34
33
import bzrlib
35
34
from bzrlib.errors import BzrCheckError
36
35
 
434
433
        return not (self == other)
435
434
 
436
435
    def dump_file(self, temp_dir, name, tree):
437
 
        out_path = os.path.join(temp_dir, name)
 
436
        out_path = pathjoin(temp_dir, name)
438
437
        out_file = file(out_path, "wb")
439
438
        in_file = tree.get_file(self.file_id)
440
439
        for line in in_file:
644
643
        return os.path.dirname(self.path)
645
644
 
646
645
    def __set_dir(self, dir):
647
 
        self.path = os.path.join(dir, os.path.basename(self.path))
 
646
        self.path = pathjoin(dir, os.path.basename(self.path))
648
647
 
649
648
    dir = property(__get_dir, __set_dir)
650
649
    
654
653
        return os.path.basename(self.path)
655
654
 
656
655
    def __set_name(self, name):
657
 
        self.path = os.path.join(os.path.dirname(self.path), name)
 
656
        self.path = pathjoin(os.path.dirname(self.path), name)
658
657
 
659
658
    name = property(__get_name, __set_name)
660
659
 
664
663
        return os.path.dirname(self.new_path)
665
664
 
666
665
    def __set_new_dir(self, dir):
667
 
        self.new_path = os.path.join(dir, os.path.basename(self.new_path))
 
666
        self.new_path = pathjoin(dir, os.path.basename(self.new_path))
668
667
 
669
668
    new_dir = property(__get_new_dir, __set_new_dir)
670
669
 
674
673
        return os.path.basename(self.new_path)
675
674
 
676
675
    def __set_new_name(self, name):
677
 
        self.new_path = os.path.join(os.path.dirname(self.new_path), name)
 
676
        self.new_path = pathjoin(os.path.dirname(self.new_path), name)
678
677
 
679
678
    new_name = property(__get_new_name, __set_new_name)
680
679
 
809
808
        else:
810
809
            name = to_name
811
810
            assert(from_name is None or from_name == os.path.basename(id_map[self.id]))
812
 
        return os.path.join(dir, name)
 
811
        return pathjoin(dir, name)
813
812
 
814
813
    def is_boring(self):
815
814
        """Determines whether the entry does nothing
934
933
    for i in range(len(source_entries)):
935
934
        entry = source_entries[i]
936
935
        if entry.is_deletion(reverse):
937
 
            path = os.path.join(dir, inventory[entry.id])
 
936
            path = pathjoin(dir, inventory[entry.id])
938
937
            entry.apply(path, conflict_handler, reverse)
939
938
            temp_name[entry.id] = None
940
939
 
941
940
        elif entry.needs_rename():
942
941
            if entry.is_creation(reverse):
943
942
                continue
944
 
            to_name = os.path.join(temp_dir, str(i))
 
943
            to_name = pathjoin(temp_dir, str(i))
945
944
            src_path = inventory.get(entry.id)
946
945
            if src_path is not None:
947
 
                src_path = os.path.join(dir, src_path)
 
946
                src_path = pathjoin(dir, src_path)
948
947
                try:
949
948
                    rename(src_path, to_name)
950
949
                    temp_name[entry.id] = to_name
977
976
        new_tree_path = entry.get_new_path(inventory, changeset, reverse)
978
977
        if new_tree_path is None:
979
978
            continue
980
 
        new_path = os.path.join(dir, new_tree_path)
 
979
        new_path = pathjoin(dir, new_tree_path)
981
980
        old_path = changed_inventory.get(entry.id)
982
981
        if bzrlib.osutils.lexists(new_path):
983
982
            if conflict_handler.target_exists(entry, new_path, old_path) == \
1201
1200
    """
1202
1201
    if conflict_handler is None:
1203
1202
        conflict_handler = ExceptionConflictHandler()
1204
 
    temp_dir = os.path.join(dir, "bzr-tree-change")
 
1203
    temp_dir = pathjoin(dir, "bzr-tree-change")
1205
1204
    try:
1206
1205
        os.mkdir(temp_dir)
1207
1206
    except OSError, e:
1222
1221
                warning("entry {%s} no longer present, can't be updated",
1223
1222
                        entry.id)
1224
1223
                continue
1225
 
            path = os.path.join(dir, inventory[entry.id])
 
1224
            path = pathjoin(dir, inventory[entry.id])
1226
1225
            entry.apply(path, conflict_handler, reverse)
1227
1226
 
1228
1227
    # Apply renames in stages, to minimize conflicts:
1557
1556
 
1558
1557
 
1559
1558
def full_path(entry, tree):
1560
 
    return os.path.join(tree.basedir, entry.path)
 
1559
    return pathjoin(tree.basedir, entry.path)
1561
1560
 
1562
1561
def new_delete_entry(entry, tree, inventory, delete):
1563
1562
    if entry.path == "":