~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Martin Pool
  • Date: 2005-05-30 01:37:52 UTC
  • Revision ID: mbp@sourcefrog.net-20050530013751-650874ded00ae1a1
- Use explicit lock methods on a branch, rather than doing it
  implicitly from the Branch constructor and relying on destroying the
  branch to release the lock.

- New with_readlock, _with_writelock decorators for branch methods.

- Branch locks can now be taken several times by a single caller, but
  they forbid upgrading or downgrading.

- Don't need assertions about whether the branch is locked anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
        If set, only show the status of files in this list.
29
29
    """
30
30
    import sys
31
 
    import diff
32
 
    
33
 
    branch._need_readlock()
34
 
    
35
 
    old = branch.basis_tree()
36
 
    new = branch.working_tree()
37
 
 
38
 
    delta = diff.compare_trees(old, new, want_unchanged=show_unchanged,
39
 
                               specific_files=specific_files)
40
 
 
41
 
    delta.show(sys.stdout, show_ids=show_ids,
42
 
               show_unchanged=show_unchanged)
43
 
 
44
 
    unknowns = new.unknowns()
45
 
    done_header = False
46
 
    for path in unknowns:
47
 
        # FIXME: Should also match if the unknown file is within a
48
 
        # specified directory.
49
 
        if specific_files:
50
 
            if path not in specific_files:
51
 
                continue
52
 
        if not done_header:
53
 
            print 'unknown:'
54
 
            done_header = True
55
 
        print ' ', path
 
31
    from bzrlib.diff import compare_trees
 
32
    
 
33
    branch.lock('r')
 
34
    try:
 
35
 
 
36
        old = branch.basis_tree()
 
37
        new = branch.working_tree()
 
38
 
 
39
        delta = compare_trees(old, new, want_unchanged=show_unchanged,
 
40
                              specific_files=specific_files)
 
41
 
 
42
        delta.show(sys.stdout, show_ids=show_ids,
 
43
                   show_unchanged=show_unchanged)
 
44
 
 
45
        unknowns = new.unknowns()
 
46
        done_header = False
 
47
        for path in unknowns:
 
48
            # FIXME: Should also match if the unknown file is within a
 
49
            # specified directory.
 
50
            if specific_files:
 
51
                if path not in specific_files:
 
52
                    continue
 
53
            if not done_header:
 
54
                print 'unknown:'
 
55
                done_header = True
 
56
            print ' ', path
 
57
    finally:
 
58
        branch.unlock()
 
59