/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 breezy/shelf.py

  • Committer: Jelmer Vernooij
  • Date: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
        :param file_list: The files to make more similar to the target.
69
69
        """
70
70
        self.work_tree = work_tree
71
 
        self.work_transform = transform.TreeTransform(work_tree)
 
71
        self.work_transform = work_tree.get_transform()
72
72
        try:
73
73
            self.target_tree = target_tree
74
74
            self.shelf_transform = transform.TransformPreview(self.target_tree)
98
98
           ('modify text', file_id)
99
99
           ('modify target', file_id, target_target, work_target)
100
100
        """
101
 
        for (file_id, paths, changed, versioned, parents, names, kind,
102
 
             executable) in self.iter_changes:
 
101
        for change in self.iter_changes:
103
102
            # don't shelve add of tree root.  Working tree should never
104
103
            # lack roots, and bzr misbehaves when they do.
105
104
            # FIXME ADHB (2009-08-09): should still shelve adds of tree roots
106
105
            # when a tree root was deleted / renamed.
107
 
            if kind[0] is None and names[1] == '':
 
106
            if change.kind[0] is None and change.name[1] == '':
108
107
                continue
109
108
            # Also don't shelve deletion of tree root.
110
 
            if kind[1] is None and names[0] == '':
 
109
            if change.kind[1] is None and change.name[0] == '':
111
110
                continue
112
 
            if kind[0] is None or versioned[0] is False:
113
 
                self.creation[file_id] = (kind[1], names[1], parents[1],
114
 
                                          versioned)
115
 
                yield ('add file', file_id, kind[1], paths[1])
116
 
            elif kind[1] is None or versioned[0] is False:
117
 
                self.deletion[file_id] = (kind[0], names[0], parents[0],
118
 
                                          versioned)
119
 
                yield ('delete file', file_id, kind[0], paths[0])
 
111
            if change.kind[0] is None or change.versioned[0] is False:
 
112
                self.creation[change.file_id] = (
 
113
                    change.kind[1], change.name[1], change.parent_id[1], change.versioned)
 
114
                yield ('add file', change.file_id, change.kind[1], change.path[1])
 
115
            elif change.kind[1] is None or change.versioned[0] is False:
 
116
                self.deletion[change.file_id] = (
 
117
                    change.kind[0], change.name[0], change.parent_id[0], change.versioned)
 
118
                yield ('delete file', change.file_id, change.kind[0], change.path[0])
120
119
            else:
121
 
                if names[0] != names[1] or parents[0] != parents[1]:
122
 
                    self.renames[file_id] = (names, parents)
123
 
                    yield ('rename', file_id) + paths
 
120
                if change.name[0] != change.name[1] or change.parent_id[0] != change.parent_id[1]:
 
121
                    self.renames[change.file_id] = (change.name, change.parent_id)
 
122
                    yield ('rename', change.file_id) + change.path
124
123
 
125
 
                if kind[0] != kind[1]:
126
 
                    yield ('change kind', file_id, kind[0], kind[1], paths[0])
127
 
                elif kind[0] == 'symlink':
128
 
                    t_target = self.target_tree.get_symlink_target(paths[0])
129
 
                    w_target = self.work_tree.get_symlink_target(paths[1])
130
 
                    yield ('modify target', file_id, paths[0], t_target,
 
124
                if change.kind[0] != change.kind[1]:
 
125
                    yield ('change kind', change.file_id, change.kind[0], change.kind[1], change.path[0])
 
126
                elif change.kind[0] == 'symlink':
 
127
                    t_target = self.target_tree.get_symlink_target(change.path[0])
 
128
                    w_target = self.work_tree.get_symlink_target(change.path[1])
 
129
                    yield ('modify target', change.file_id, change.path[0], t_target,
131
130
                           w_target)
132
 
                elif changed:
133
 
                    yield ('modify text', file_id)
 
131
                elif change.changed_content:
 
132
                    yield ('modify text', change.file_id)
134
133
 
135
134
    def shelve_change(self, change):
136
135
        """Shelve a change in the iter_shelvable format."""
209
208
    def _content_from_tree(tt, tree, file_id):
210
209
        trans_id = tt.trans_id_file_id(file_id)
211
210
        tt.delete_contents(trans_id)
212
 
        transform.create_from_tree(tt, trans_id, tree, tree.id2path(file_id),
213
 
                                   file_id)
 
211
        transform.create_from_tree(tt, trans_id, tree, tree.id2path(file_id))
214
212
 
215
213
    def shelve_content_change(self, file_id):
216
214
        """Shelve a kind change or binary file content change.
268
266
                else:
269
267
                    transform.create_from_tree(
270
268
                        to_transform, s_trans_id, tree,
271
 
                        tree.id2path(file_id), file_id)
 
269
                        tree.id2path(file_id))
272
270
        if version:
273
271
            to_transform.version_file(file_id, s_trans_id)
274
272