~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 00:52:53 UTC
  • Revision ID: robertc@robertcollins.net-20051006005253-415c38ad22094f13
define some expected behaviour for inventory_entry.snapshot

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
20
17
 
21
18
 
22
19
def show_status(branch, show_unchanged=False,
47
44
        If one revision show compared it with working tree.
48
45
        If two revisions show status between first and second.
49
46
    """
 
47
    import sys
 
48
    from bzrlib.osutils import is_inside_any
 
49
    from bzrlib.delta import compare_trees
 
50
 
50
51
    if to_file == None:
51
52
        to_file = sys.stdout
52
53
    
81
82
                   show_unchanged=show_unchanged)
82
83
 
83
84
        if new_is_working_tree:
84
 
            conflicts = new.iter_conflicts()
85
85
            unknowns = new.unknowns()
86
 
            list_paths('unknown', unknowns, specific_files, to_file)
87
 
            list_paths('conflicts', conflicts, specific_files, to_file)
 
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
88
94
            if show_pending and len(branch.pending_merges()) > 0:
89
95
                print >>to_file, 'pending merges:'
90
96
                for merge in branch.pending_merges():
92
98
    finally:
93
99
        branch.unlock()
94
100
        
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