[Pkg-bazaar-commits] ./bzr/unstable r498: bugfix for bzr ignore reported by ddaa:
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:19:37 UTC 2009
------------------------------------------------------------
revno: 498
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-05-16 12:39:42 +1000
message:
bugfix for bzr ignore reported by ddaa:
- read in old .bzrignore file correctly
- make sure files get closed properly
modified:
bzrlib/commands.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2005-05-15 02:36:04 +0000
+++ b/bzrlib/commands.py 2005-05-16 02:39:42 +0000
@@ -677,12 +677,12 @@
b = Branch('.')
ifn = b.abspath('.bzrignore')
- # FIXME: probably doesn't handle non-ascii patterns
-
if os.path.exists(ifn):
- f = b.controlfile(ifn, 'rt')
- igns = f.read()
- f.close()
+ f = open(ifn, 'rt')
+ try:
+ igns = f.read().decode('utf-8')
+ finally:
+ f.close()
else:
igns = ''
@@ -690,9 +690,12 @@
igns += '\n'
igns += name_pattern + '\n'
- f = AtomicFile(ifn, 'wt')
- f.write(igns)
- f.commit()
+ try:
+ f = AtomicFile(ifn, 'wt')
+ f.write(igns.encode('utf-8'))
+ f.commit()
+ finally:
+ f.close()
inv = b.working_tree().inventory
if inv.path2id('.bzrignore'):
More information about the Pkg-bazaar-commits
mailing list