~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Ian Clatworthy
  • Date: 2010-03-26 07:58:58 UTC
  • mto: (5120.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5121.
  • Revision ID: ian.clatworthy@canonical.com-20100326075858-umm5rlmaxkf9it9c
it's sqlite3, not just sqlite

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
# if known, but only if really going to the terminal (not into a file)
35
35
 
36
36
 
37
 
def report_changes(to_file, old, new, specific_files, 
38
 
                   show_short_reporter, show_long_callback, 
39
 
                   short=False, want_unchanged=False, 
40
 
                   want_unversioned=False, show_ids=False):
41
 
    """Display summary of changes.
42
 
 
43
 
    This compares two trees with regards to a list of files, and delegates 
44
 
    the display to underlying elements.
45
 
 
46
 
    For short output, it creates an iterator on all changes, and lets a given
47
 
    reporter display these changes.
48
 
 
49
 
    For stantard output, it creates a delta of the changes, and forwards it
50
 
    to a callback
51
 
 
52
 
    :param to_file: If set, write to this file (default stdout.)
53
 
    :param old: Start tree for the comparison
54
 
    :param end: End tree for the comparison
55
 
    :param specific_files: If set, a list of filenames whose status should be
56
 
        shown.  It is an error to give a filename that is not in the working
57
 
        tree, or in the working inventory or in the basis inventory.
58
 
    :param show_short_reporter: Reporter in charge of display for short output
59
 
    :param show_long_callback: Callback in charge of display for normal output
60
 
    :param short: If True, gives short SVN-style status lines.
61
 
    :param want_unchanged: Deprecated parameter. If set, includes unchanged
62
 
        files.
63
 
    :param show_ids: If set, includes each file's id.
64
 
    :param want_unversioned: If False, only shows versioned files.
65
 
    """
66
 
 
67
 
    if short:
68
 
        changes = new.iter_changes(old, want_unchanged, specific_files,
69
 
            require_versioned=False, want_unversioned=want_unversioned)
70
 
        _mod_delta.report_changes(changes, show_short_reporter)
71
 
        
72
 
    else:
73
 
        delta = new.changes_from(old, want_unchanged=want_unchanged,
74
 
                              specific_files=specific_files,
75
 
                              want_unversioned=want_unversioned)
76
 
        # filter out unknown files. We may want a tree method for
77
 
        # this
78
 
        delta.unversioned = [unversioned for unversioned in
79
 
            delta.unversioned if not new.is_ignored(unversioned[0])]
80
 
        show_long_callback(to_file, delta, 
81
 
                           show_ids=show_ids,
82
 
                           show_unchanged=want_unchanged)
83
 
 
84
 
 
85
37
def show_tree_status(wt, show_unchanged=None,
86
38
                     specific_files=None,
87
39
                     show_ids=False,
90
42
                     revision=None,
91
43
                     short=False,
92
44
                     verbose=False,
93
 
                     versioned=False,
94
 
                     show_long_callback=_mod_delta.report_delta):
 
45
                     versioned=False):
95
46
    """Display summary of changes.
96
47
 
97
48
    By default this compares the working tree to a previous revision.
120
71
    :param verbose: If True, show all merged revisions, not just
121
72
        the merge tips
122
73
    :param versioned: If True, only shows versioned files.
123
 
    :param show_long_callback: A callback: message = show_long_callback(to_file, delta, 
124
 
        show_ids, show_unchanged, indent, filter), only used with the long output
125
74
    """
126
75
    if show_unchanged is not None:
127
76
        warn("show_tree_status with show_unchanged has been deprecated "
157
106
            specific_files, nonexistents \
158
107
                = _filter_nonexistent(specific_files, old, new)
159
108
            want_unversioned = not versioned
160
 
 
161
 
            # Reporter used for short outputs
162
 
            reporter = _mod_delta._ChangeReporter(output_file=to_file,
163
 
                unversioned_filter=new.is_ignored)
164
 
            report_changes(to_file, old, new, specific_files, 
165
 
                           reporter, show_long_callback, 
166
 
                           short=short, want_unchanged=show_unchanged, 
167
 
                           want_unversioned=want_unversioned, show_ids=show_ids)
168
 
 
 
109
            if short:
 
110
                changes = new.iter_changes(old, show_unchanged, specific_files,
 
111
                    require_versioned=False, want_unversioned=want_unversioned)
 
112
                reporter = _mod_delta._ChangeReporter(output_file=to_file,
 
113
                    unversioned_filter=new.is_ignored)
 
114
                _mod_delta.report_changes(changes, reporter)
 
115
            else:
 
116
                delta = new.changes_from(old, want_unchanged=show_unchanged,
 
117
                                      specific_files=specific_files,
 
118
                                      want_unversioned=want_unversioned)
 
119
                # filter out unknown files. We may want a tree method for
 
120
                # this
 
121
                delta.unversioned = [unversioned for unversioned in
 
122
                    delta.unversioned if not new.is_ignored(unversioned[0])]
 
123
                delta.show(to_file,
 
124
                           show_ids=show_ids,
 
125
                           show_unchanged=show_unchanged,
 
126
                           short_status=False)
169
127
            # show the new conflicts only for now. XXX: get them from the
170
128
            # delta.
171
129
            conflicts = new.conflicts()