~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/changeset.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-01 17:11:25 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051201171125-5e1f0970246c4925
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \

Show diffs side-by-side

added added

removed removed

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