~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-15 21:35:53 UTC
  • mfrom: (907.1.57)
  • mto: (1393.2.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050915213552-a6c83a5ef1e20897
(broken) Transport work is merged in. Tests do not pass yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
def show_status(branch, show_unchanged=False,
20
20
                specific_files=None,
21
 
                show_ids=False):
22
 
    """Display single-line status for non-ignored working files.
 
21
                show_ids=False,
 
22
                to_file=None,
 
23
                show_pending=True):
 
24
    """Display status for non-ignored working files.
23
25
 
24
 
    show_all
25
 
        If true, show unmodified files too.
 
26
    show_unchanged
 
27
        If set, includes unchanged files.
26
28
 
27
29
    specific_files
28
30
        If set, only show the status of files in this list.
 
31
 
 
32
    show_ids
 
33
        If set, includes each file's id.
 
34
 
 
35
    to_file
 
36
        If set, write to this file (default stdout.)
 
37
 
 
38
    show_pending
 
39
        If set, write pending merges.
29
40
    """
30
41
    import sys
31
 
    from bzrlib.diff import compare_trees
 
42
    from bzrlib.delta import compare_trees
 
43
 
 
44
    if to_file == None:
 
45
        to_file = sys.stdout
32
46
    
33
47
    branch.lock_read()
34
48
    try:
39
53
        delta = compare_trees(old, new, want_unchanged=show_unchanged,
40
54
                              specific_files=specific_files)
41
55
 
42
 
        delta.show(sys.stdout, show_ids=show_ids,
 
56
        delta.show(to_file,
 
57
                   show_ids=show_ids,
43
58
                   show_unchanged=show_unchanged)
44
59
 
45
60
        unknowns = new.unknowns()
51
66
                if path not in specific_files:
52
67
                    continue
53
68
            if not done_header:
54
 
                print 'unknown:'
 
69
                print >>to_file, 'unknown:'
55
70
                done_header = True
56
 
            print ' ', path
 
71
            print >>to_file, ' ', path
 
72
        if show_pending and len(branch.pending_merges()) > 0:
 
73
            print >>to_file, 'pending merges:'
 
74
            for merge in branch.pending_merges():
 
75
                print >> to_file, ' ', merge
57
76
    finally:
58
77
        branch.unlock()
59
78