~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ignores.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-22 14:18:17 UTC
  • mto: (5190.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5191.
  • Revision ID: v.ladeuil+lp@free.fr-20100422141817-izoao20264ivkauo
Explain that the uncommitted changes are not processed when
issuing the warning.

* bzrlib/mutabletree.py:
(MutableTree.check_changed_or_out_of_date): Use diferent 'more'
arguments depending on whether we issue a warning or an error.

* bzrlib/send.py:
(send): Add the more_warnings argument when calling
check_changed_or_out_of_date.

* bzrlib/foreign.py:
(cmd_dpush.run): Add the more_warnings argument when calling
check_changed_or_out_of_date.

* bzrlib/builtins.py:
(cmd_push.run): Add the more_warnings argument when calling
check_changed_or_out_of_date.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 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
27
27
 
28
28
from trace import warning
29
29
 
 
30
# This was the full ignore list for bzr 0.8
 
31
# please keep these sorted (in C locale order) to aid merging
 
32
OLD_DEFAULTS = [
 
33
    '#*#',
 
34
    '*$',
 
35
    '*,v',
 
36
    '*.BAK',
 
37
    '*.a',
 
38
    '*.bak',
 
39
    '*.elc',
 
40
    '*.exe',
 
41
    '*.la',
 
42
    '*.lo',
 
43
    '*.o',
 
44
    '*.obj',
 
45
    '*.orig',
 
46
    '*.py[oc]',
 
47
    '*.so',
 
48
    '*.tmp',
 
49
    '*~',
 
50
    '.#*',
 
51
    '.*.sw[nop]',
 
52
    '.*.tmp',
 
53
    # Our setup tests dump .python-eggs in the bzr source tree root
 
54
    './.python-eggs',
 
55
    '.DS_Store',
 
56
    '.arch-ids',
 
57
    '.arch-inventory',
 
58
    '.bzr.log',
 
59
    '.del-*',
 
60
    '.git',
 
61
    '.hg',
 
62
    '.jamdeps'
 
63
    '.libs',
 
64
    '.make.state',
 
65
    '.sconsign*',
 
66
    '.svn',
 
67
    '.sw[nop]',    # vim editing nameless file
 
68
    '.tmp*',
 
69
    'BitKeeper',
 
70
    'CVS',
 
71
    'CVS.adm',
 
72
    'RCS',
 
73
    'SCCS',
 
74
    'TAGS',
 
75
    '_darcs',
 
76
    'aclocal.m4',
 
77
    'autom4te*',
 
78
    'config.h',
 
79
    'config.h.in',
 
80
    'config.log',
 
81
    'config.status',
 
82
    'config.sub',
 
83
    'stamp-h',
 
84
    'stamp-h.in',
 
85
    'stamp-h1',
 
86
    '{arch}',
 
87
]
 
88
 
 
89
 
30
90
# ~/.bazaar/ignore will be filled out using
31
91
# this ignore list, if it does not exist
32
92
# please keep these sorted (in C locale order) to aid merging
59
119
        # Otherwise go though line by line and pick out the 'good'
60
120
        # decodable lines
61
121
        lines = ignore_file.split('\n')
62
 
        unicode_lines = []
 
122
        unicode_lines = []    
63
123
        for line_number, line in enumerate(lines):
64
124
            try:
65
125
                unicode_lines.append(line.decode('utf-8'))
67
127
                # report error about line (idx+1)
68
128
                warning('.bzrignore: On Line #%d, malformed utf8 character. '
69
129
                        'Ignoring line.' % (line_number+1))
70
 
 
 
130
    
71
131
    # Append each line to ignore list if it's not a comment line
72
132
    for line in unicode_lines:
73
133
        line = line.rstrip('\r\n')
176
236
 
177
237
 
178
238
def tree_ignores_add_patterns(tree, name_pattern_list):
179
 
    """Add more ignore patterns to the ignore file in a tree.
180
 
    If ignore file does not exist then it will be created.
181
 
    The ignore file will be automatically added under version control.
 
239
    """Retrieve a list of ignores from the ignore file in a tree.
182
240
 
183
 
    :param tree: Working tree to update the ignore list.
 
241
    :param tree: Tree to retrieve the ignore list from.
 
242
    :return:
184
243
    """
185
244
    ifn = tree.abspath(bzrlib.IGNORE_FILENAME)
186
245
    if tree.has_filename(ifn):
207
266
    finally:
208
267
        f.close()
209
268
 
210
 
    if not tree.path2id(bzrlib.IGNORE_FILENAME):
211
 
        tree.add([bzrlib.IGNORE_FILENAME])
 
269
    if not tree.path2id('.bzrignore'):
 
270
        tree.add(['.bzrignore'])