[Pkg-bazaar-commits] ./bzr/unstable r163: merge win32 portability fixes
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:51:16 UTC 2009
------------------------------------------------------------
revno: 163
committer: mbp at sourcefrog.net
timestamp: Mon 2005-04-04 20:35:13 +1000
message:
merge win32 portability fixes
modified:
NEWS
bzrlib/branch.py
bzrlib/store.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2005-04-04 09:50:24 +0000
+++ b/NEWS 2005-04-04 10:35:13 +0000
@@ -20,7 +20,15 @@
* Workaround for difflib bug in Python 2.3 that causes an
exception when comparing empty files. Reported by Erik Toubro
Nielsen.
-
+
+
+bzr-0.0.2.1
+
+ PORTABILITY:
+
+ * Win32 fixes from Steve Brown.
+
+
bzr-0.0.2 "black cube" 2003-03-31
ENHANCEMENTS:
@@ -45,7 +53,9 @@
* New global --profile option.
* Ignore patterns like './config.h' now correctly match files in
- the root directory only.
+ the root directory only.
+
+
bzr-0.0.1 2005-03-26
ENHANCEMENTS:
@@ -72,7 +82,6 @@
supported).
-
bzr-0.0.0.69 2005-03-22
ENHANCEMENTS:
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2005-04-01 08:22:11 +0000
+++ b/bzrlib/branch.py 2005-04-04 10:35:13 +0000
@@ -162,7 +162,7 @@
self.controlfile('README', 'w').write(
"This is a Bazaar-NG control directory.\n"
"Do not change any files in this directory.")
- self.controlfile('branch-format', 'w').write(BZR_BRANCH_FORMAT)
+ self.controlfile('branch-format', 'wb').write(BZR_BRANCH_FORMAT)
for d in ('text-store', 'inventory-store', 'revision-store'):
os.mkdir(self.controlfilename(d))
for f in ('revision-history', 'merged-patches',
@@ -179,9 +179,12 @@
In the future, we might need different in-memory Branch
classes to support downlevel branches. But not yet.
- """
- # read in binary mode to detect newline wierdness.
+ """
+ # This ignores newlines so that we can open branches created
+ # on Windows from Linux and so on. I think it might be better
+ # to always make all internal files in unix format.
fmt = self.controlfile('branch-format', 'rb').read()
+ fmt.replace('\r\n', '')
if fmt != BZR_BRANCH_FORMAT:
bailout('sorry, branch format %r not supported' % fmt,
['use a different bzr version',
@@ -209,7 +212,10 @@
tmpf = file(tmpfname, 'w')
inv.write_xml(tmpf)
tmpf.close()
- os.rename(tmpfname, self.controlfilename('inventory'))
+ inv_fname = self.controlfilename('inventory')
+ if sys.platform == 'win32':
+ os.remove(inv_fname)
+ os.rename(tmpfname, inv_fname)
mutter('wrote working inventory')
@@ -817,7 +823,15 @@
def __del__(self):
"""Destroy the test branch, removing the scratch directory."""
- shutil.rmtree(self.base)
+ try:
+ shutil.rmtree(self.base)
+ except OSError:
+ # Work around for shutil.rmtree failing on Windows when
+ # readonly files are encountered
+ for root, dirs, files in os.walk(self.base, topdown=False):
+ for name in files:
+ os.chmod(os.path.join(root, name), 0700)
+ shutil.rmtree(self.base)
=== modified file 'bzrlib/store.py'
--- a/bzrlib/store.py 2005-03-29 01:26:19 +0000
+++ b/bzrlib/store.py 2005-04-04 10:35:13 +0000
@@ -169,6 +169,9 @@
def __del__(self):
for f in os.listdir(self._basedir):
- os.remove(os.path.join(self._basedir, f))
+ fpath = os.path.join(self._basedir, f)
+ # needed on windows, and maybe some other filesystems
+ os.chmod(fpath, 0600)
+ os.remove(fpath)
os.rmdir(self._basedir)
mutter("%r destroyed" % self)
More information about the Pkg-bazaar-commits
mailing list