changeset 4926:164daf101a54

Automated merge with http://hg.intevation.org/mercurial/crew
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 17 Jul 2007 15:26:27 -0700
parents 2642726b61b6 (current diff) 59b8ff35c4ed (diff)
children 5e89b0dafce5
files
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Jul 17 15:24:59 2007 -0700
+++ b/mercurial/patch.py	Tue Jul 17 15:26:27 2007 -0700
@@ -281,7 +281,7 @@
 def internalpatch(patchname, ui, strip, cwd, files):
     """use builtin patch to apply <patchname> to the working directory.
     returns whether patch was applied with fuzz factor."""
-    fp = file(patchname)
+    fp = file(patchname, 'rb')
     if cwd:
         curdir = os.getcwd()
         os.chdir(cwd)
@@ -303,7 +303,7 @@
         self.fname = fname
         self.ui = ui
         try:
-            fp = file(fname, 'r')
+            fp = file(fname, 'rb')
             self.lines = fp.readlines()
             self.exists = True
         except IOError:
@@ -383,7 +383,7 @@
         try: os.unlink(fname)
         except:
             pass
-        fp = file(fname, 'w')
+        fp = file(fname, 'wb')
         base = os.path.basename(self.fname)
         fp.write("--- %s\n+++ %s\n" % (base, base))
         for x in self.rej:
@@ -402,7 +402,7 @@
                 if st.st_nlink > 1:
                     os.unlink(dest)
             except: pass
-            fp = file(dest, 'w')
+            fp = file(dest, 'wb')
             if st:
                 os.chmod(dest, st.st_mode)
             fp.writelines(self.lines)
@@ -777,13 +777,13 @@
         if count == 0:
             return path.rstrip()
         while count > 0:
-            i = path.find(os.sep, i)
+            i = path.find('/', i)
             if i == -1:
                 raise PatchError(_("unable to strip away %d dirs from %s") %
                                  (count, path))
             i += 1
             # consume '//' in the path
-            while i < pathlen - 1 and path[i] == os.sep:
+            while i < pathlen - 1 and path[i] == '/':
                 i += 1
             count -= 1
         return path[i:].rstrip()
--- a/mercurial/util_win32.py	Tue Jul 17 15:24:59 2007 -0700
+++ b/mercurial/util_win32.py	Tue Jul 17 15:26:27 2007 -0700
@@ -209,9 +209,9 @@
 
     def __init__(self, name, mode='rb'):
         access = 0
-        if 'r' in mode or '+' in mode:
+        if 'r' in mode:
             access |= win32file.GENERIC_READ
-        if 'w' in mode or 'a' in mode:
+        if 'w' in mode or 'a' in mode or '+' in mode:
             access |= win32file.GENERIC_WRITE
         if 'r' in mode:
             creation = win32file.OPEN_EXISTING