/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/ignores.py

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2006-2010 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
 
 
90
30
# ~/.bazaar/ignore will be filled out using
91
31
# this ignore list, if it does not exist
92
32
# please keep these sorted (in C locale order) to aid merging
119
59
        # Otherwise go though line by line and pick out the 'good'
120
60
        # decodable lines
121
61
        lines = ignore_file.split('\n')
122
 
        unicode_lines = []    
 
62
        unicode_lines = []
123
63
        for line_number, line in enumerate(lines):
124
64
            try:
125
65
                unicode_lines.append(line.decode('utf-8'))
127
67
                # report error about line (idx+1)
128
68
                warning('.bzrignore: On Line #%d, malformed utf8 character. '
129
69
                        'Ignoring line.' % (line_number+1))
130
 
    
 
70
 
131
71
    # Append each line to ignore list if it's not a comment line
132
72
    for line in unicode_lines:
133
73
        line = line.rstrip('\r\n')
236
176
 
237
177
 
238
178
def tree_ignores_add_patterns(tree, name_pattern_list):
239
 
    """Retrieve a list of ignores from the ignore file in a tree.
 
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.
240
182
 
241
 
    :param tree: Tree to retrieve the ignore list from.
242
 
    :return:
 
183
    :param tree: Working tree to update the ignore list.
243
184
    """
244
185
    ifn = tree.abspath(bzrlib.IGNORE_FILENAME)
245
186
    if tree.has_filename(ifn):
266
207
    finally:
267
208
        f.close()
268
209
 
269
 
    if not tree.path2id('.bzrignore'):
270
 
        tree.add(['.bzrignore'])
 
210
    if not tree.path2id(bzrlib.IGNORE_FILENAME):
 
211
        tree.add([bzrlib.IGNORE_FILENAME])