/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/shelf.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-20 08:56:45 UTC
  • mfrom: (4526.9.23 apply-inventory-delta)
  • Revision ID: pqm@pqm.ubuntu.com-20090720085645-54mtgybxua0yx6hw
(robertc) Add checks for inventory deltas which try to ensure that
        deltas that are not an exact fit are not applied. (Robert
        Collins, bug 397705, bug 367633)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    errors,
24
24
    merge,
25
25
    merge3,
 
26
    osutils,
26
27
    pack,
27
28
    transform,
 
29
    ui,
 
30
    workingtree,
28
31
)
29
32
 
30
33
 
34
37
    def __init__(self, work_tree, target_tree, file_list=None):
35
38
        """Constructor.
36
39
 
37
 
        :param work_tree: The working tree to apply changes to. This is not
38
 
            required to be locked - a tree_write lock will be taken out.
 
40
        :param work_tree: The working tree to apply changes to
39
41
        :param target_tree: The tree to make the working tree more similar to.
40
 
            This is not required to be locked - a read_lock will be taken out.
41
42
        :param file_list: The files to make more similar to the target.
42
43
        """
43
44
        self.work_tree = work_tree
72
73
        """
73
74
        for (file_id, paths, changed, versioned, parents, names, kind,
74
75
             executable) in self.iter_changes:
75
 
            # don't shelve add of tree root.  Working tree should never
76
 
            # lack roots, and bzr misbehaves when they do.
77
 
            # FIXME ADHB (2009-08-09): should still shelve adds of tree roots
78
 
            # when a tree root was deleted / renamed.
79
 
            if kind[0] is None and names[1] == '':
80
 
                continue
81
76
            if kind[0] is None or versioned[0] == False:
82
77
                self.creation[file_id] = (kind[1], names[1], parents[1],
83
78
                                          versioned)
109
104
            self.shelve_deletion(change[1])
110
105
        elif change[0] == 'add file':
111
106
            self.shelve_creation(change[1])
112
 
        elif change[0] in ('change kind', 'modify text'):
 
107
        elif change[0] == 'change kind':
113
108
            self.shelve_content_change(change[1])
114
109
        elif change[0] == 'modify target':
115
110
            self.shelve_modify_target(change[1])
116
111
        else:
117
112
            raise ValueError('Unknown change kind: "%s"' % change[0])
118
113
 
119
 
    def shelve_all(self):
120
 
        """Shelve all changes."""
121
 
        for change in self.iter_shelvable():
122
 
            self.shelve_change(change)
123
 
 
124
114
    def shelve_rename(self, file_id):
125
115
        """Shelve a file rename.
126
116