/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 bzrlib/diff.py

  • Committer: Ian Clatworthy
  • Date: 2007-12-12 07:05:52 UTC
  • mto: (3118.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3119.
  • Revision ID: ian.clatworthy@internode.on.net-20071212070552-ru9mosc8f6g7elay
more good ideas from abentley

Show diffs side-by-side

added added

removed removed

Lines of Context:
375
375
    if revision_specs is not None:
376
376
        if len(revision_specs) > 0:
377
377
            old_revision_spec = revision_specs[0]
 
378
            if old_url is None:
 
379
                old_url = old_revision_spec.get_branch()
378
380
        if len(revision_specs) > 1:
379
381
            new_revision_spec = revision_specs[1]
380
 
        # If both revision specs include a branch, we can diff them
381
 
        # without needing to look further for the details
382
 
        if (old_revision_spec is not None and
383
 
            new_revision_spec is not None and
384
 
            not old_revision_spec.needs_branch() and
385
 
            not new_revision_spec.needs_branch()):
386
 
            old_tree = _get_tree_to_diff(old_revision_spec)
387
 
            new_tree = _get_tree_to_diff(new_revision_spec)
388
 
            specific_files = path_list or None
389
 
            return old_tree, new_tree, specific_files, None
 
382
            if new_url is None:
 
383
                new_url = new_revision_spec.get_branch()
390
384
 
 
385
    other_paths = []
 
386
    make_paths_wt_relative = True
391
387
    if path_list is None or len(path_list) == 0:
392
388
        # If no path is given, assume the current directory
393
389
        default_location = u'.'
394
 
        other_paths = []
395
 
        check_paths = True
396
390
    elif old_url is not None and new_url is not None:
397
 
        default_location = None  # don't care - not required
398
391
        other_paths = path_list
399
 
        check_paths = False
 
392
        make_paths_wt_relative = False
400
393
    else:
401
394
        default_location = path_list[0]
402
395
        other_paths = path_list[1:]
403
 
        check_paths = True
404
396
 
405
397
    # Get the old location
406
398
    specific_files = []
424
416
        basis_is_default=working_tree is None)
425
417
 
426
418
    # Get the specific files (all files is None, no files is [])
427
 
    if check_paths and working_tree is not None:
 
419
    if make_paths_wt_relative and working_tree is not None:
428
420
        other_paths = _relative_paths_in_tree(working_tree, other_paths)
429
421
    specific_files.extend(other_paths)
430
422
    if len(specific_files) == 0:
432
424
 
433
425
    # Get extra trees that ought to be searched for file-ids
434
426
    extra_trees = None
435
 
    if new_tree != working_tree and working_tree is not None:
 
427
    if working_tree is not None and working_tree not in (old_tree, new_tree):
436
428
        extra_trees = (working_tree,)
437
429
    return old_tree, new_tree, specific_files, extra_trees
438
430
 
442
434
        branch = tree.branch
443
435
    if spec is None or spec.spec is None:
444
436
        if basis_is_default:
445
 
            return branch.basis_tree()
 
437
            if tree is not None:
 
438
                return tree.basis_tree()
 
439
            else:
 
440
                return branch.basis_tree()
446
441
        else:
447
442
            return tree
448
443
    revision = spec.in_store(branch)