~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shelf.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-13 03:16:26 UTC
  • mfrom: (4137.1.2 jamesw-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090313031626-cy59iwvd5csfcmez
(jamesw) Shelve now supports shelving changes to symlink targets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
           ('rename', file_id, target_path, work_path)
70
70
           ('change kind', file_id, target_kind, work_kind, target_path)
71
71
           ('modify text', file_id)
 
72
           ('modify target', file_id, target_target, work_target)
72
73
        """
73
74
        for (file_id, paths, changed, versioned, parents, names, kind,
74
75
             executable) in self.iter_changes:
87
88
 
88
89
                if kind[0] != kind [1]:
89
90
                    yield ('change kind', file_id, kind[0], kind[1], paths[0])
 
91
                elif kind[0] == 'symlink':
 
92
                    t_target = self.target_tree.get_symlink_target(file_id)
 
93
                    w_target = self.work_tree.get_symlink_target(file_id)
 
94
                    yield ('modify target', file_id, paths[0], t_target,
 
95
                            w_target)
90
96
                elif changed:
91
97
                    yield ('modify text', file_id)
92
98
 
104
110
        shelf_parent = self.shelf_transform.trans_id_file_id(parents[1])
105
111
        self.shelf_transform.adjust_path(names[1], shelf_parent, s_trans_id)
106
112
 
 
113
    def shelve_modify_target(self, file_id):
 
114
        """Shelve a change of symlink target.
 
115
 
 
116
        :param file_id: The file id of the symlink which changed target.
 
117
        :param new_target: The target that the symlink should have due
 
118
            to shelving.
 
119
        """
 
120
        new_target = self.target_tree.get_symlink_target(file_id)
 
121
        w_trans_id = self.work_transform.trans_id_file_id(file_id)
 
122
        self.work_transform.delete_contents(w_trans_id)
 
123
        self.work_transform.create_symlink(new_target, w_trans_id)
 
124
 
 
125
        old_target = self.work_tree.get_symlink_target(file_id)
 
126
        s_trans_id = self.shelf_transform.trans_id_file_id(file_id)
 
127
        self.shelf_transform.delete_contents(s_trans_id)
 
128
        self.shelf_transform.create_symlink(old_target, s_trans_id)
 
129
 
107
130
    def shelve_lines(self, file_id, new_lines):
108
131
        """Shelve text changes to a file, using provided lines.
109
132