# HG changeset patch # User Bryan O'Sullivan # Date 1127496535 25200 # Node ID 8f06817bf26685d56f97283e7c119155184d5992 # Parent 04ed65045bccb08d426859d8fe54910466bf96a7 Allow files to be opened in text mode, even on Windows. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -327,10 +327,11 @@ def opener(base): remote file access from higher level code. """ p = base - def o(path, mode="r"): + def o(path, mode="r", text=False): f = os.path.join(p, path) - mode += "b" # for that other OS + if not text: + mode += "b" # for that other OS if mode[0] != "r": try: @@ -549,7 +550,7 @@ def makedate(): if time.daylight: tz = time.altzone else: tz = time.timezone return t, tz - + def datestr(date=None, format='%c'): """represent a (unixtime, offset) tuple as a localized time. unixtime is seconds since the epoch, and offset is the time zone's