~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-05-09 04:59:00 UTC
  • Revision ID: mbp@sourcefrog.net-20050509045900-7c01ab1bd6cfeb4a
- Fix ignore command and add tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
490
490
        import codecs
491
491
 
492
492
        b = Branch('.')
 
493
        ifn = b.abspath('.bzrignore')
493
494
 
494
495
        # FIXME: probably doesn't handle non-ascii patterns
495
496
 
496
 
        if os.path.exists(b.controlfilename('.bzrignore')):
497
 
            f = b.controlfile('.bzrignore', 'rt')
 
497
        if os.path.exists(ifn):
 
498
            f = b.controlfile(ifn, 'rt')
498
499
            igns = f.read()
499
500
            f.close()
500
501
        else:
504
505
            igns += '\n'
505
506
        igns += name_pattern + '\n'
506
507
 
507
 
        f = AtomicFile(b.controlfilename('.bzrignore'), 'wt')
 
508
        f = AtomicFile(ifn, 'wt')
508
509
        f.write(igns)
509
510
        f.commit()
510
511