~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/delta.py

  • Committer: John Arbash Meinel
  • Date: 2007-07-02 15:01:18 UTC
  • mfrom: (2466.11.2 merge_deltas)
  • mto: This revision was merged to the branch mainline in revision 2570.
  • Revision ID: john@arbash-meinel.com-20070702150118-ypa1als5c0dx61ll
(Kent Gibson) 'bzr log --verbose' shows deltas for merged revisions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
            
108
108
 
109
109
    def show(self, to_file, show_ids=False, show_unchanged=False,
110
 
             short_status=False):
 
110
             short_status=False, indent=''):
111
111
        """output this delta in status-like form to to_file."""
112
112
        def show_list(files, short_status_letter=''):
113
113
            for item in files:
122
122
                    path += '*'
123
123
 
124
124
                if show_ids:
125
 
                    print >>to_file, '%s  %-30s %s' % (short_status_letter,
 
125
                    print >>to_file, indent + '%s  %-30s %s' % (short_status_letter,
126
126
                        path, fid)
127
127
                else:
128
 
                    print >>to_file, '%s  %s' % (short_status_letter, path)
 
128
                    print >>to_file, indent + '%s  %s' % (short_status_letter, path)
129
129
            
130
130
        if self.removed:
131
131
            if not short_status:
132
 
                print >>to_file, 'removed:'
 
132
                print >>to_file, indent + 'removed:'
133
133
                show_list(self.removed)
134
134
            else:
135
135
                show_list(self.removed, 'D')
136
136
                
137
137
        if self.added:
138
138
            if not short_status:
139
 
                print >>to_file, 'added:'
 
139
                print >>to_file, indent + 'added:'
140
140
                show_list(self.added)
141
141
            else:
142
142
                show_list(self.added, 'A')
146
146
        if self.renamed:
147
147
            short_status_letter = 'R'
148
148
            if not short_status:
149
 
                print >>to_file, 'renamed:'
 
149
                print >>to_file, indent + 'renamed:'
150
150
                short_status_letter = ''
151
151
            for (oldpath, newpath, fid, kind,
152
152
                 text_modified, meta_modified) in self.renamed:
156
156
                if meta_modified:
157
157
                    newpath += '*'
158
158
                if show_ids:
159
 
                    print >>to_file, '%s  %s => %s %s' % (
 
159
                    print >>to_file, indent + '%s  %s => %s %s' % (
160
160
                        short_status_letter, oldpath, newpath, fid)
161
161
                else:
162
 
                    print >>to_file, '%s  %s => %s' % (
 
162
                    print >>to_file, indent + '%s  %s => %s' % (
163
163
                        short_status_letter, oldpath, newpath)
164
164
 
165
165
        if self.kind_changed:
166
166
            if short_status:
167
167
                short_status_letter = 'K'
168
168
            else:
169
 
                print >>to_file, 'kind changed:'
 
169
                print >>to_file, indent + 'kind changed:'
170
170
                short_status_letter = ''
171
171
            for (path, fid, old_kind, new_kind) in self.kind_changed:
172
172
                if show_ids:
173
173
                    suffix = ' '+fid
174
174
                else:
175
175
                    suffix = ''
176
 
                print >>to_file, '%s  %s (%s => %s)%s' % (
 
176
                print >>to_file, indent + '%s  %s (%s => %s)%s' % (
177
177
                    short_status_letter, path, old_kind, new_kind, suffix)
178
178
 
179
179
        if self.modified or extra_modified:
180
180
            short_status_letter = 'M'
181
181
            if not short_status:
182
 
                print >>to_file, 'modified:'
 
182
                print >>to_file, indent + 'modified:'
183
183
                short_status_letter = ''
184
184
            show_list(self.modified, short_status_letter)
185
185
            show_list(extra_modified, short_status_letter)
186
186
            
187
187
        if show_unchanged and self.unchanged:
188
188
            if not short_status:
189
 
                print >>to_file, 'unchanged:'
 
189
                print >>to_file, indent + 'unchanged:'
190
190
                show_list(self.unchanged)
191
191
            else:
192
192
                show_list(self.unchanged, 'S')
193
193
 
194
194
        if self.unversioned:
195
 
            print >>to_file, 'unknown:'
 
195
            print >>to_file, indent + 'unknown:'
196
196
            show_list(self.unversioned)
197
197
 
198
198
    def get_changes_as_text(self, show_ids=False, show_unchanged=False,