~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ignores.py

  • Committer: Vincent Ladeuil
  • Date: 2007-11-04 15:24:27 UTC
  • mto: (2961.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2962.
  • Revision ID: v.ladeuil+lp@free.fr-20071104152427-p9k7e4toywa87wfc
Review feedback.

* doc/en/user-guide/authentication_conf.txt: 
New file. Authentication configuration file documentation.

* doc/en/user-guide/configuration.txt: 
Slight modifications, add authentication.conf reference.

* doc/en/mini-tutorial/index.txt: 
Fix make docs warning.

* doc/developers/authentication-ring.txt: 
Small cleanups noticed during
doc/en/user-guide/authentication_conf.txt redaction.

* bzrlib/transport/http/_urllib.py:
(HttpTransport_urllib._perform): Use a dict() instead of {} syntax.

* bzrlib/tests/blackbox/test_whoami.py:
(TestWhoami.test_whoami_branch): Delete BZREMAIL related tests.

* bzrlib/config.py:
(Config.username): BZREMAIL deleted, has been obsolete for more
than a year.
(AuthenticationConfig.__init__): Review feedback, since keeping a
callback as an attribute is useless, call it now and keep the
filename itself as an attribute.
(AuthenticationConfig.get_credentials): Use a dict() instead of {}
syntax.

* NEWS: 
Updated as per Martin's suggestion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import errno
20
20
 
21
 
import bzrlib
22
21
from bzrlib import (
23
 
    atomicfile,
24
22
    config,
25
23
    globbing,
26
24
    )
207
205
def get_runtime_ignores():
208
206
    """Get the current set of runtime ignores."""
209
207
    return _runtime_ignores
210
 
 
211
 
 
212
 
def tree_ignores_add_patterns(tree, name_pattern_list):
213
 
    """Retrieve a list of ignores from the ignore file in a tree.
214
 
 
215
 
    :param tree: Tree to retrieve the ignore list from.
216
 
    :return: 
217
 
    """
218
 
    ifn = tree.abspath(bzrlib.IGNORE_FILENAME)
219
 
    if tree.has_filename(ifn):
220
 
        f = open(ifn, 'rt')
221
 
        try:
222
 
            igns = f.read().decode('utf-8')
223
 
        finally:
224
 
            f.close()
225
 
    else:
226
 
        igns = ""
227
 
 
228
 
    # TODO: If the file already uses crlf-style termination, maybe
229
 
    # we should use that for the newly added lines?
230
 
 
231
 
    if igns and igns[-1] != '\n':
232
 
        igns += '\n'
233
 
    for name_pattern in name_pattern_list:
234
 
        igns += name_pattern + '\n'
235
 
 
236
 
    f = atomicfile.AtomicFile(ifn, 'wb')
237
 
    try:
238
 
        f.write(igns.encode('utf-8'))
239
 
        f.commit()
240
 
    finally:
241
 
        f.close()
242
 
 
243
 
    if not tree.path2id('.bzrignore'):
244
 
        tree.add(['.bzrignore'])