/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 breezy/ignores.py

  • Committer: Jelmer Vernooij
  • Date: 2019-05-20 03:57:29 UTC
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190520035729-9rxvefxkvbbivygy
use default_user_agent function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
lazy_import(globals(), """
28
28
from breezy import (
29
29
    atomicfile,
 
30
    config,
30
31
    globbing,
31
32
    trace,
32
33
    )
33
34
""")
34
 
from . import (
35
 
    bedding,
36
 
    )
37
35
 
38
36
# ~/.config/breezy/ignore will be filled out using
39
37
# this ignore list, if it does not exist
89
87
 
90
88
def get_user_ignores():
91
89
    """Get the list of user ignored files, possibly creating it."""
92
 
    path = bedding.user_ignore_config_path()
 
90
    path = config.user_ignore_config_filename()
93
91
    patterns = set(USER_DEFAULTS)
94
92
    try:
95
93
        f = open(path, 'rb')
103
101
        # since get_* should be a safe operation
104
102
        try:
105
103
            _set_user_ignores(USER_DEFAULTS)
106
 
        except EnvironmentError as e:
107
 
            if e.errno not in (errno.EPERM, errno.ENOENT):
 
104
        except (IOError, OSError) as e:
 
105
            if e.errno not in (errno.EPERM,):
108
106
                raise
109
107
        return patterns
110
108
 
123
121
    bad form to rewrite a user's ignore list.
124
122
    breezy only writes this file if it does not exist.
125
123
    """
126
 
    ignore_path = bedding.user_ignore_config_path()
127
 
    bedding.ensure_config_dir_exists()
 
124
    ignore_path = config.user_ignore_config_filename()
 
125
    config.ensure_config_dir_exists()
128
126
 
129
127
    # Create an empty file
130
128
    with open(ignore_path, 'wb') as f:
149
147
    if not to_add:
150
148
        return []
151
149
 
152
 
    with open(bedding.user_ignore_config_path(), 'ab') as f:
 
150
    with open(config.user_ignore_config_filename(), 'ab') as f:
153
151
        for pattern in to_add:
154
152
            f.write(pattern.encode('utf8') + b'\n')
155
153