~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/add.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-28 16:21:22 UTC
  • mfrom: (5929.1.3 787942-osx-normalizes)
  • Revision ID: pqm@pqm.ubuntu.com-20110528162122-01dpztbjm3u1u475
(vila) Fix spurious test failure on OSX for WorkingTreeFormat2 (Vincent
 Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import sys
20
20
 
21
 
from bzrlib import (
22
 
    osutils,
23
 
    )
 
21
import bzrlib.osutils
24
22
 
25
23
 
26
24
class AddAction(object):
40
38
        if should_print is not None:
41
39
            self.should_print = should_print
42
40
 
43
 
    def __call__(self, inv, parent_ie, path, kind, _quote=osutils.quotefn):
 
41
    def __call__(self, inv, parent_ie, path, kind, _quote=bzrlib.osutils.quotefn):
44
42
        """Add path to inventory.
45
43
 
46
44
        The default action does nothing.
50
48
        :param kind: The kind of the object being added.
51
49
        """
52
50
        if self.should_print:
53
 
            self._to_file.write('adding %s\n' % _quote(path))
 
51
            self._to_file.write('adding %s\n' % _quote(path.raw_path))
54
52
        return None
55
53
 
56
54
 
70
68
        if file_id is not None:
71
69
            if self.should_print:
72
70
                self._to_file.write('adding %s w/ file id from %s\n'
73
 
                                    % (path, base_path))
 
71
                                    % (path.raw_path, base_path))
74
72
        else:
75
73
            # we aren't doing anything special, so let the default
76
74
            # reporter happen
88
86
 
89
87
        if (parent_ie.file_id in self.base_tree):
90
88
            base_parent_ie = self.base_tree.inventory[parent_ie.file_id]
91
 
            base_child_ie = base_parent_ie.children.get(
92
 
                osutils.basename(path))
 
89
            base_child_ie = base_parent_ie.children.get(path.base_path)
93
90
            if base_child_ie is not None:
94
91
                return (base_child_ie.file_id,
95
92
                        self.base_tree.id2path(base_child_ie.file_id))
96
 
        full_base_path = osutils.pathjoin(self.base_path, path)
 
93
        full_base_path = bzrlib.osutils.pathjoin(self.base_path, path.raw_path)
97
94
        # This may return None, but it is our last attempt
98
95
        return self.base_tree.path2id(full_base_path), full_base_path