~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/status.py

  • Committer: Robert Collins
  • Date: 2005-10-06 22:15:52 UTC
  • mfrom: (1185.13.2)
  • mto: This revision was merged to the branch mainline in revision 1420.
  • Revision ID: robertc@robertcollins.net-20051006221552-9b15c96fa504e0ad
mergeĀ fromĀ upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# (C) 2005 Canonical Ltd
2
 
 
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
import sys
 
18
from bzrlib.osutils import is_inside_any
 
19
from bzrlib.delta import compare_trees
17
20
 
18
21
 
19
22
def show_status(branch, show_unchanged=False,
44
47
        If one revision show compared it with working tree.
45
48
        If two revisions show status between first and second.
46
49
    """
47
 
    import sys
48
 
    from bzrlib.osutils import is_inside_any
49
 
    from bzrlib.delta import compare_trees
50
 
 
51
50
    if to_file == None:
52
51
        to_file = sys.stdout
53
52
    
82
81
                   show_unchanged=show_unchanged)
83
82
 
84
83
        if new_is_working_tree:
 
84
            conflicts = new.iter_conflicts()
85
85
            unknowns = new.unknowns()
86
 
            done_header = False
87
 
            for path in unknowns:
88
 
                if specific_files and not is_inside_any(specific_files, path):
89
 
                    continue
90
 
                if not done_header:
91
 
                    print >>to_file, 'unknown:'
92
 
                    done_header = True
93
 
                print >>to_file, ' ', path
 
86
            list_paths('unknown', unknowns, specific_files, to_file)
 
87
            list_paths('conflicts', conflicts, specific_files, to_file)
94
88
            if show_pending and len(branch.pending_merges()) > 0:
95
89
                print >>to_file, 'pending merges:'
96
90
                for merge in branch.pending_merges():
98
92
    finally:
99
93
        branch.unlock()
100
94
        
 
95
def list_paths(header, paths, specific_files, to_file):
 
96
    done_header = False
 
97
    for path in paths:
 
98
        if specific_files and not is_inside_any(specific_files, path):
 
99
            continue
 
100
        if not done_header:
 
101
            print >>to_file, '%s:' % header
 
102
            done_header = True
 
103
        print >>to_file, ' ', path