~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Martin Pool
  • Date: 2005-06-27 06:25:30 UTC
  • Revision ID: mbp@sourcefrog.net-20050627062530-0002d5c96b0ed3c1
- note bzr log changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
 
19
19
def show_status(branch, show_unchanged=False,
20
 
                file_list=None,
 
20
                specific_files=None,
21
21
                show_ids=False):
22
22
    """Display single-line status for non-ignored working files.
23
23
 
24
24
    show_all
25
25
        If true, show unmodified files too.
26
26
 
27
 
    file_list
 
27
    specific_files
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
 
    if file_list:
39
 
        raise NotImplementedError("sorry, status on selected files is not implemented "
40
 
                                  "at the moment")
41
 
 
42
 
    delta = diff.compare_trees(old, new, want_unchanged=show_unchanged)
43
 
 
44
 
    delta.show(sys.stdout, show_ids=show_ids,
45
 
               show_unchanged=show_unchanged)
46
 
 
47
 
    unknowns = new.unknowns()
48
 
    done_header = False
49
 
    for path in unknowns:
50
 
        if not done_header:
51
 
            print 'unknown files:'
52
 
            done_header = True
53
 
        print ' ', path
 
31
    from bzrlib.diff import compare_trees
 
32
    
 
33
    branch.lock_read()
 
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