~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

  • Committer: Robert Collins
  • Date: 2005-10-03 01:42:16 UTC
  • Revision ID: robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad
integrate in Gustavos x-bit patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    removed
27
27
        (path, id, kind)
28
28
    renamed
29
 
        (oldpath, newpath, id, kind, text_modified)
 
29
        (oldpath, newpath, id, kind, text_modified, meta_modified)
30
30
    modified
31
 
        (path, id, kind)
 
31
        (path, id, kind, text_modified, meta_modified)
32
32
    unchanged
33
33
        (path, id, kind)
34
34
 
89
89
 
90
90
    def show(self, to_file, show_ids=False, show_unchanged=False):
91
91
        def show_list(files):
92
 
            for path, fid, kind in files:
 
92
            for item in files:
 
93
                path, fid, kind = item[:3]
 
94
 
93
95
                if kind == 'directory':
94
96
                    path += '/'
95
97
                elif kind == 'symlink':
96
98
                    path += '@'
97
 
                    
 
99
 
 
100
                if len(item) == 5 and item[4]:
 
101
                    path += '*'
 
102
 
98
103
                if show_ids:
99
104
                    print >>to_file, '  %-30s %s' % (path, fid)
100
105
                else:
110
115
 
111
116
        if self.renamed:
112
117
            print >>to_file, 'renamed:'
113
 
            for oldpath, newpath, fid, kind, text_modified in self.renamed:
 
118
            for (oldpath, newpath, fid, kind,
 
119
                 text_modified, meta_modified) in self.renamed:
 
120
                if meta_modified:
 
121
                    newpath += '*'
114
122
                if show_ids:
115
123
                    print >>to_file, '  %s => %s %s' % (oldpath, newpath, fid)
116
124
                else:
178
186
                old_sha1 = old_tree.get_file_sha1(file_id)
179
187
                new_sha1 = new_tree.get_file_sha1(file_id)
180
188
                text_modified = (old_sha1 != new_sha1)
 
189
                old_exec = old_tree.is_executable(file_id)
 
190
                new_exec = new_tree.is_executable(file_id)
 
191
                meta_modified = (old_exec != new_exec)
181
192
            elif kind == 'symlink':
182
193
                t1 = old_tree.get_symlink_target(file_id)
183
194
                t2 = new_tree.get_symlink_target(file_id)
184
195
                if t1 != t2:
185
196
                    mutter("    symlink target changed")
 
197
                    # FIXME: which should we use ?
186
198
                    text_modified = True
 
199
                    meta_modified = False
187
200
                else:
188
201
                    text_modified = False
 
202
                    meta_modified = False
189
203
            else:
190
204
                ## mutter("no text to check for %r %r" % (file_id, kind))
191
205
                text_modified = False
 
206
                meta_modified = False
192
207
 
193
208
            # TODO: Can possibly avoid calculating path strings if the
194
209
            # two files are unchanged and their names and parents are
200
215
                delta.renamed.append((old_inv.id2path(file_id),
201
216
                                      new_inv.id2path(file_id),
202
217
                                      file_id, kind,
203
 
                                      text_modified))
204
 
            elif text_modified:
205
 
                delta.modified.append((new_inv.id2path(file_id), file_id, kind))
 
218
                                      text_modified, meta_modified))
 
219
            elif text_modified or meta_modified:
 
220
                delta.modified.append((new_inv.id2path(file_id), file_id, kind,
 
221
                                       text_modified, meta_modified))
206
222
            elif want_unchanged:
207
223
                delta.unchanged.append((new_inv.id2path(file_id), file_id, kind))
208
224
        else: