Show More
@@ -38,8 +38,8 b' class convert_cvs(converter_source):' | |||||
38 | self.lastbranch = {} |
|
38 | self.lastbranch = {} | |
39 | self.parent = {} |
|
39 | self.parent = {} | |
40 | self.socket = None |
|
40 | self.socket = None | |
41 |
self.cvsroot = |
|
41 | self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1] | |
42 |
self.cvsrepo = |
|
42 | self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1] | |
43 | self.encoding = locale.getpreferredencoding() |
|
43 | self.encoding = locale.getpreferredencoding() | |
44 |
|
44 | |||
45 | self._connect() |
|
45 | self._connect() |
@@ -130,7 +130,7 b' def createlog(ui, directory=None, root="' | |||||
130 |
|
130 | |||
131 | # Get the real directory in the repository |
|
131 | # Get the real directory in the repository | |
132 | try: |
|
132 | try: | |
133 |
prefix = |
|
133 | prefix = open(os.path.join('CVS','Repository')).read().strip() | |
134 | if prefix == ".": |
|
134 | if prefix == ".": | |
135 | prefix = "" |
|
135 | prefix = "" | |
136 | directory = prefix |
|
136 | directory = prefix | |
@@ -142,7 +142,7 b' def createlog(ui, directory=None, root="' | |||||
142 |
|
142 | |||
143 | # Use the Root file in the sandbox, if it exists |
|
143 | # Use the Root file in the sandbox, if it exists | |
144 | try: |
|
144 | try: | |
145 |
root = |
|
145 | root = open(os.path.join('CVS','Root')).read().strip() | |
146 | except IOError: |
|
146 | except IOError: | |
147 | pass |
|
147 | pass | |
148 |
|
148 | |||
@@ -175,7 +175,7 b' def createlog(ui, directory=None, root="' | |||||
175 | if cache == 'update': |
|
175 | if cache == 'update': | |
176 | try: |
|
176 | try: | |
177 | ui.note(_('reading cvs log cache %s\n') % cachefile) |
|
177 | ui.note(_('reading cvs log cache %s\n') % cachefile) | |
178 |
oldlog = pickle.load( |
|
178 | oldlog = pickle.load(open(cachefile)) | |
179 | ui.note(_('cache has %d log entries\n') % len(oldlog)) |
|
179 | ui.note(_('cache has %d log entries\n') % len(oldlog)) | |
180 | except Exception, e: |
|
180 | except Exception, e: | |
181 | ui.note(_('error reading cache: %r\n') % e) |
|
181 | ui.note(_('error reading cache: %r\n') % e) | |
@@ -445,7 +445,7 b' def createlog(ui, directory=None, root="' | |||||
445 |
|
445 | |||
446 | # write the new cachefile |
|
446 | # write the new cachefile | |
447 | ui.note(_('writing cvs log cache %s\n') % cachefile) |
|
447 | ui.note(_('writing cvs log cache %s\n') % cachefile) | |
448 |
pickle.dump(log, |
|
448 | pickle.dump(log, open(cachefile, 'w')) | |
449 | else: |
|
449 | else: | |
450 | log = oldlog |
|
450 | log = oldlog | |
451 |
|
451 |
@@ -750,7 +750,7 b" def debugcomplete(ui, cmd='', **opts):" | |||||
750 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) |
|
750 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) | |
751 |
|
751 | |||
752 | def debugfsinfo(ui, path = "."): |
|
752 | def debugfsinfo(ui, path = "."): | |
753 |
|
|
753 | open('.debugfsinfo', 'w').write('') | |
754 | ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no')) |
|
754 | ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no')) | |
755 | ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no')) |
|
755 | ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no')) | |
756 | ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo') |
|
756 | ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo') | |
@@ -983,7 +983,7 b' def debuginstall(ui):' | |||||
983 | if list(files) != [os.path.basename(fa)]: |
|
983 | if list(files) != [os.path.basename(fa)]: | |
984 | ui.write(_(" unexpected patch output!\n")) |
|
984 | ui.write(_(" unexpected patch output!\n")) | |
985 | patchproblems += 1 |
|
985 | patchproblems += 1 | |
986 |
a = |
|
986 | a = open(fa).read() | |
987 | if a != b: |
|
987 | if a != b: | |
988 | ui.write(_(" patch test failed!\n")) |
|
988 | ui.write(_(" patch test failed!\n")) | |
989 | patchproblems += 1 |
|
989 | patchproblems += 1 |
@@ -69,7 +69,7 b' def staticfile(directory, fname, req):' | |||||
69 | os.stat(path) |
|
69 | os.stat(path) | |
70 | ct = mimetypes.guess_type(path)[0] or "text/plain" |
|
70 | ct = mimetypes.guess_type(path)[0] or "text/plain" | |
71 | req.respond(HTTP_OK, ct, length = os.path.getsize(path)) |
|
71 | req.respond(HTTP_OK, ct, length = os.path.getsize(path)) | |
72 |
return |
|
72 | return open(path, 'rb').read() | |
73 | except TypeError: |
|
73 | except TypeError: | |
74 | raise ErrorResponse(HTTP_SERVER_ERROR, 'illegal filename') |
|
74 | raise ErrorResponse(HTTP_SERVER_ERROR, 'illegal filename') | |
75 | except OSError, err: |
|
75 | except OSError, err: |
@@ -1139,7 +1139,7 b' def internalpatch(patchobj, ui, strip, c' | |||||
1139 | raise util.Abort(_('Unsupported line endings type: %s') % eolmode) |
|
1139 | raise util.Abort(_('Unsupported line endings type: %s') % eolmode) | |
1140 |
|
1140 | |||
1141 | try: |
|
1141 | try: | |
1142 |
fp = |
|
1142 | fp = open(patchobj, 'rb') | |
1143 | except TypeError: |
|
1143 | except TypeError: | |
1144 | fp = patchobj |
|
1144 | fp = patchobj | |
1145 | if cwd: |
|
1145 | if cwd: |
@@ -9,7 +9,7 b' from i18n import _' | |||||
9 | import osutil |
|
9 | import osutil | |
10 | import os, sys, errno, stat, getpass, pwd, grp |
|
10 | import os, sys, errno, stat, getpass, pwd, grp | |
11 |
|
11 | |||
12 |
posixfile = |
|
12 | posixfile = open | |
13 | nulldev = '/dev/null' |
|
13 | nulldev = '/dev/null' | |
14 | normpath = os.path.normpath |
|
14 | normpath = os.path.normpath | |
15 | samestat = os.path.samestat |
|
15 | samestat = os.path.samestat | |
@@ -70,20 +70,20 b' def set_flags(f, l, x):' | |||||
70 | if l: |
|
70 | if l: | |
71 | if not stat.S_ISLNK(s): |
|
71 | if not stat.S_ISLNK(s): | |
72 | # switch file to link |
|
72 | # switch file to link | |
73 |
data = |
|
73 | data = open(f).read() | |
74 | os.unlink(f) |
|
74 | os.unlink(f) | |
75 | try: |
|
75 | try: | |
76 | os.symlink(data, f) |
|
76 | os.symlink(data, f) | |
77 | except: |
|
77 | except: | |
78 | # failed to make a link, rewrite file |
|
78 | # failed to make a link, rewrite file | |
79 |
|
|
79 | open(f, "w").write(data) | |
80 | # no chmod needed at this point |
|
80 | # no chmod needed at this point | |
81 | return |
|
81 | return | |
82 | if stat.S_ISLNK(s): |
|
82 | if stat.S_ISLNK(s): | |
83 | # switch link to file |
|
83 | # switch link to file | |
84 | data = os.readlink(f) |
|
84 | data = os.readlink(f) | |
85 | os.unlink(f) |
|
85 | os.unlink(f) | |
86 |
|
|
86 | open(f, "w").write(data) | |
87 | s = 0666 & ~umask # avoid restatting for chmod |
|
87 | s = 0666 & ~umask # avoid restatting for chmod | |
88 |
|
88 | |||
89 | sx = s & 0100 |
|
89 | sx = s & 0100 |
@@ -8,7 +8,7 b'' | |||||
8 | import os |
|
8 | import os | |
9 | import stat as _stat |
|
9 | import stat as _stat | |
10 |
|
10 | |||
11 |
posixfile = |
|
11 | posixfile = open | |
12 |
|
12 | |||
13 | def _mode_to_kind(mode): |
|
13 | def _mode_to_kind(mode): | |
14 | if _stat.S_ISREG(mode): return _stat.S_IFREG |
|
14 | if _stat.S_ISREG(mode): return _stat.S_IFREG |
@@ -143,7 +143,7 b" elif os.path.exists('.hg_archival.txt'):" | |||||
143 | break |
|
143 | break | |
144 |
|
144 | |||
145 | if version: |
|
145 | if version: | |
146 |
f = |
|
146 | f = open("mercurial/__version__.py", "w") | |
147 | f.write('# this file is autogenerated by setup.py\n') |
|
147 | f.write('# this file is autogenerated by setup.py\n') | |
148 | f.write('version = "%s"\n' % version) |
|
148 | f.write('version = "%s"\n' % version) | |
149 | f.close() |
|
149 | f.close() |
@@ -4,7 +4,7 b' import os, sys, time, errno, signal' | |||||
4 |
|
4 | |||
5 | # Kill off any leftover daemon processes |
|
5 | # Kill off any leftover daemon processes | |
6 | try: |
|
6 | try: | |
7 |
fp = |
|
7 | fp = open(os.environ['DAEMON_PIDS']) | |
8 | for line in fp: |
|
8 | for line in fp: | |
9 | try: |
|
9 | try: | |
10 | pid = int(line) |
|
10 | pid = int(line) |
@@ -419,7 +419,7 b' def runone(options, test, skips, fails):' | |||||
419 | vlog("# Test", test) |
|
419 | vlog("# Test", test) | |
420 |
|
420 | |||
421 | # create a fresh hgrc |
|
421 | # create a fresh hgrc | |
422 |
hgrc = |
|
422 | hgrc = open(HGRCPATH, 'w+') | |
423 | hgrc.write('[ui]\n') |
|
423 | hgrc.write('[ui]\n') | |
424 | hgrc.write('slash = True\n') |
|
424 | hgrc.write('slash = True\n') | |
425 | hgrc.write('[defaults]\n') |
|
425 | hgrc.write('[defaults]\n') | |
@@ -525,7 +525,7 b' def runone(options, test, skips, fails):' | |||||
525 |
|
525 | |||
526 | # Kill off any leftover daemon processes |
|
526 | # Kill off any leftover daemon processes | |
527 | try: |
|
527 | try: | |
528 |
fp = |
|
528 | fp = open(DAEMON_PIDS) | |
529 | for line in fp: |
|
529 | for line in fp: | |
530 | try: |
|
530 | try: | |
531 | pid = int(line) |
|
531 | pid = int(line) |
@@ -7,7 +7,7 b" repo = hg.repository(u, 'test1', create=" | |||||
7 | os.chdir('test1') |
|
7 | os.chdir('test1') | |
8 |
|
8 | |||
9 | # create 'foo' with fixed time stamp |
|
9 | # create 'foo' with fixed time stamp | |
10 |
f = |
|
10 | f = open('foo', 'w') | |
11 | f.write('foo\n') |
|
11 | f.write('foo\n') | |
12 | f.close() |
|
12 | f.close() | |
13 | os.utime('foo', (1000, 1000)) |
|
13 | os.utime('foo', (1000, 1000)) |
@@ -15,14 +15,14 b' testdispatch("init test1")' | |||||
15 | os.chdir('test1') |
|
15 | os.chdir('test1') | |
16 |
|
16 | |||
17 | # create file 'foo', add and commit |
|
17 | # create file 'foo', add and commit | |
18 |
f = |
|
18 | f = open('foo', 'wb') | |
19 | f.write('foo\n') |
|
19 | f.write('foo\n') | |
20 | f.close() |
|
20 | f.close() | |
21 | testdispatch("add foo") |
|
21 | testdispatch("add foo") | |
22 | testdispatch("commit -m commit1 -d 2000-01-01 foo") |
|
22 | testdispatch("commit -m commit1 -d 2000-01-01 foo") | |
23 |
|
23 | |||
24 | # append to file 'foo' and commit |
|
24 | # append to file 'foo' and commit | |
25 |
f = |
|
25 | f = open('foo', 'ab') | |
26 | f.write('bar\n') |
|
26 | f.write('bar\n') | |
27 | f.close() |
|
27 | f.close() | |
28 | testdispatch("commit -m commit2 -d 2000-01-02 foo") |
|
28 | testdispatch("commit -m commit2 -d 2000-01-02 foo") |
@@ -10,7 +10,7 b' def commit(text, time):' | |||||
10 | repo.commit(text=text, date="%d 0" % time) |
|
10 | repo.commit(text=text, date="%d 0" % time) | |
11 |
|
11 | |||
12 | def addcommit(name, time): |
|
12 | def addcommit(name, time): | |
13 |
f = |
|
13 | f = open(name, 'w') | |
14 | f.write('%s\n' % name) |
|
14 | f.write('%s\n' % name) | |
15 | f.close() |
|
15 | f.close() | |
16 | repo.add([name]) |
|
16 | repo.add([name]) |
General Comments 0
You need to be logged in to leave comments.
Login now