~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/diff.py

  • Committer: Robert Collins
  • Date: 2005-10-29 23:48:45 UTC
  • Revision ID: robertc@robertcollins.net-20051029234845-7ae4e7d118bdd3ed
Implement a 'bzr push' command, with saved locations; update diff to return 1.

    * 'bzr diff' now returns 1 when there are changes in the working 
      tree.

    * 'bzr push' now exists and can push changes to a remote location. 
      This uses the transport infrastructure, and can store the remote
      location in the ~/.bazaar/branches.conf configuration file.

    * WorkingTree.pull has been split across Branch and WorkingTree,
      to allow Branch only pulls.

    * commands.display_command now returns the result of the decorated 
      function.

    * LocationConfig now has a set_user_option(key, value) call to save
      a setting in its matching location section (a new one is created
      if needed).

    * Branch has two new methods, get_push_location and set_push_location
      to respectively, get and set the push location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
167
167
    else:
168
168
        new_tree = b.revision_tree(revision2.in_history(b).rev_id)
169
169
 
170
 
    show_diff_trees(old_tree, new_tree, output, specific_files,
171
 
                    external_diff_options)
 
170
    return show_diff_trees(old_tree, new_tree, output, specific_files,
 
171
                           external_diff_options)
172
172
 
173
173
 
174
174
 
207
207
    delta = compare_trees(old_tree, new_tree, want_unchanged=False,
208
208
                          specific_files=specific_files)
209
209
 
 
210
    has_changes = 0
210
211
    for path, file_id, kind in delta.removed:
 
212
        has_changes = 1
211
213
        print >>to_file, '=== removed %s %r' % (kind, path)
212
214
        old_tree.inventory[file_id].diff(diff_file, old_label + path, old_tree,
213
215
                                         DEVNULL, None, None, to_file)
214
216
    for path, file_id, kind in delta.added:
 
217
        has_changes = 1
215
218
        print >>to_file, '=== added %s %r' % (kind, path)
216
219
        new_tree.inventory[file_id].diff(diff_file, new_label + path, new_tree,
217
220
                                         DEVNULL, None, None, to_file, 
218
221
                                         reverse=True)
219
222
    for (old_path, new_path, file_id, kind,
220
223
         text_modified, meta_modified) in delta.renamed:
 
224
        has_changes = 1
221
225
        prop_str = get_prop_change(meta_modified)
222
226
        print >>to_file, '=== renamed %s %r => %r%s' % (
223
227
                          kind, old_path, new_path, prop_str)
225
229
                                    new_label, new_path, new_tree,
226
230
                                    text_modified, kind, to_file, diff_file)
227
231
    for path, file_id, kind, text_modified, meta_modified in delta.modified:
 
232
        has_changes = 1
228
233
        prop_str = get_prop_change(meta_modified)
229
234
        print >>to_file, '=== modified %s %r%s' % (kind, path, prop_str)
230
235
        if text_modified:
231
236
            _maybe_diff_file_or_symlink(old_label, path, old_tree, file_id,
232
237
                                        new_label, path, new_tree,
233
238
                                        True, kind, to_file, diff_file)
 
239
    return has_changes
234
240
    
235
241
 
236
242
def get_prop_change(meta_modified):