# HG changeset patch # User mpm@selenic.com # Date 1119410705 28800 # Node ID f2d1f5fd0179227e8114aa9e5b74f1f6b57ddbe8 # Parent 5e9e8b8d262998334b7a9199340d149ea5e4dbad [PATCH] file type fixes for the other 'OS' -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] file type fixes for the other 'OS' From: K Thananchayan Filetype fixes: All working files and files in the repository are processed as binary. .hgignore is read as text when constructing ignorelist as this file is intended to be edited. manifest hash: c034cdcc54011fd3de9e32f1aa8b2b6f84e1b2b8 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuNoRywK+sNU5EO8RAjarAJ9ScUoFL1A7mpO7qorCy6okhi0nggCcDgpp dfDl4dALGQA0PqXqtI+T5gU= =IVxr -----END PGP SIGNATURE----- diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -47,7 +47,7 @@ def dodiff(ui, repo, path, files = None, (c, a, d, u) = repo.diffdir(path, node1) if not node1: node1 = repo.dirstate.parents()[0] - def read(f): return file(os.path.join(repo.root, f)).read() + def read(f): return repo.wfile(f).read() if ui.quiet: r = None @@ -272,7 +272,7 @@ def debugchangegroup(ui, repo, roots): sys.stdout.write(chunk) def debugindex(ui, file): - r = hg.revlog(open, file, "") + r = hg.revlog(hg.opener(""), file, "") print " rev offset length base linkrev"+\ " p1 p2 nodeid" for i in range(r.count()): @@ -282,7 +282,7 @@ def debugindex(ui, file): hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])) def debugindexdot(ui, file): - r = hg.revlog(open, file, "") + r = hg.revlog(hg.opener(""), file, "") print "digraph G {" for i in range(r.count()): e = r.index[i] diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -336,7 +336,7 @@ def opener(base): os.makedirs(d) else: if s.st_nlink > 1: - file(f + ".tmp", "w").write(file(f).read()) + file(f + ".tmp", "wb").write(file(f, "rb").read()) os.rename(f+".tmp", f) return file(f, mode) @@ -386,7 +386,7 @@ class localrepository: if self.ignorelist is None: self.ignorelist = [] try: - l = self.wfile(".hgignore") + l = file(self.wjoin(".hgignore")) for pat in l: if pat != "\n": self.ignorelist.append(re.compile(pat[:-1])) @@ -569,7 +569,7 @@ class localrepository: try: fp = self.wjoin(f) mf1[f] = is_exec(fp) - t = file(fp).read() + t = self.wopener(f).read() except IOError: self.warn("trouble committing %s!\n" % f) raise @@ -1198,7 +1198,7 @@ class localrepository: def temp(prefix, node): pre = "%s~%s." % (os.path.basename(fn), prefix) (fd, name) = tempfile.mkstemp("", pre) - f = os.fdopen(fd, "w") + f = os.fdopen(fd, "wb") f.write(fl.revision(node)) f.close() return name