##// END OF EJS Templates
test-http-branchmap: enable on Windows...
Patrick Mezard -
r17467:448d0c45 default
parent child Browse files
Show More
@@ -1,308 +1,312 b''
1 import os, stat, socket
1 import os, stat, socket
2 import re
2 import re
3 import sys
3 import sys
4 import tempfile
4 import tempfile
5
5
6 tempprefix = 'hg-hghave-'
6 tempprefix = 'hg-hghave-'
7
7
8 def matchoutput(cmd, regexp, ignorestatus=False):
8 def matchoutput(cmd, regexp, ignorestatus=False):
9 """Return True if cmd executes successfully and its output
9 """Return True if cmd executes successfully and its output
10 is matched by the supplied regular expression.
10 is matched by the supplied regular expression.
11 """
11 """
12 r = re.compile(regexp)
12 r = re.compile(regexp)
13 fh = os.popen(cmd)
13 fh = os.popen(cmd)
14 s = fh.read()
14 s = fh.read()
15 try:
15 try:
16 ret = fh.close()
16 ret = fh.close()
17 except IOError:
17 except IOError:
18 # Happen in Windows test environment
18 # Happen in Windows test environment
19 ret = 1
19 ret = 1
20 return (ignorestatus or ret is None) and r.search(s)
20 return (ignorestatus or ret is None) and r.search(s)
21
21
22 def has_baz():
22 def has_baz():
23 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
23 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
24
24
25 def has_bzr():
25 def has_bzr():
26 try:
26 try:
27 import bzrlib
27 import bzrlib
28 return bzrlib.__doc__ is not None
28 return bzrlib.__doc__ is not None
29 except ImportError:
29 except ImportError:
30 return False
30 return False
31
31
32 def has_bzr114():
32 def has_bzr114():
33 try:
33 try:
34 import bzrlib
34 import bzrlib
35 return (bzrlib.__doc__ is not None
35 return (bzrlib.__doc__ is not None
36 and bzrlib.version_info[:2] >= (1, 14))
36 and bzrlib.version_info[:2] >= (1, 14))
37 except ImportError:
37 except ImportError:
38 return False
38 return False
39
39
40 def has_cvs():
40 def has_cvs():
41 re = r'Concurrent Versions System.*?server'
41 re = r'Concurrent Versions System.*?server'
42 return matchoutput('cvs --version 2>&1', re) and not has_msys()
42 return matchoutput('cvs --version 2>&1', re) and not has_msys()
43
43
44 def has_darcs():
44 def has_darcs():
45 return matchoutput('darcs --version', r'2\.[2-9]', True)
45 return matchoutput('darcs --version', r'2\.[2-9]', True)
46
46
47 def has_mtn():
47 def has_mtn():
48 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
48 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
49 'mtn --version', r'monotone 0\.', True)
49 'mtn --version', r'monotone 0\.', True)
50
50
51 def has_eol_in_paths():
51 def has_eol_in_paths():
52 try:
52 try:
53 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r')
53 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r')
54 os.close(fd)
54 os.close(fd)
55 os.remove(path)
55 os.remove(path)
56 return True
56 return True
57 except (IOError, OSError):
57 except (IOError, OSError):
58 return False
58 return False
59
59
60 def has_executablebit():
60 def has_executablebit():
61 try:
61 try:
62 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
62 EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
63 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
63 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
64 try:
64 try:
65 os.close(fh)
65 os.close(fh)
66 m = os.stat(fn).st_mode & 0777
66 m = os.stat(fn).st_mode & 0777
67 new_file_has_exec = m & EXECFLAGS
67 new_file_has_exec = m & EXECFLAGS
68 os.chmod(fn, m ^ EXECFLAGS)
68 os.chmod(fn, m ^ EXECFLAGS)
69 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0777) == m)
69 exec_flags_cannot_flip = ((os.stat(fn).st_mode & 0777) == m)
70 finally:
70 finally:
71 os.unlink(fn)
71 os.unlink(fn)
72 except (IOError, OSError):
72 except (IOError, OSError):
73 # we don't care, the user probably won't be able to commit anyway
73 # we don't care, the user probably won't be able to commit anyway
74 return False
74 return False
75 return not (new_file_has_exec or exec_flags_cannot_flip)
75 return not (new_file_has_exec or exec_flags_cannot_flip)
76
76
77 def has_icasefs():
77 def has_icasefs():
78 # Stolen from mercurial.util
78 # Stolen from mercurial.util
79 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
79 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
80 os.close(fd)
80 os.close(fd)
81 try:
81 try:
82 s1 = os.stat(path)
82 s1 = os.stat(path)
83 d, b = os.path.split(path)
83 d, b = os.path.split(path)
84 p2 = os.path.join(d, b.upper())
84 p2 = os.path.join(d, b.upper())
85 if path == p2:
85 if path == p2:
86 p2 = os.path.join(d, b.lower())
86 p2 = os.path.join(d, b.lower())
87 try:
87 try:
88 s2 = os.stat(p2)
88 s2 = os.stat(p2)
89 return s2 == s1
89 return s2 == s1
90 except OSError:
90 except OSError:
91 return False
91 return False
92 finally:
92 finally:
93 os.remove(path)
93 os.remove(path)
94
94
95 def has_inotify():
95 def has_inotify():
96 try:
96 try:
97 import hgext.inotify.linux.watcher
97 import hgext.inotify.linux.watcher
98 except ImportError:
98 except ImportError:
99 return False
99 return False
100 name = tempfile.mktemp(dir='.', prefix=tempprefix)
100 name = tempfile.mktemp(dir='.', prefix=tempprefix)
101 sock = socket.socket(socket.AF_UNIX)
101 sock = socket.socket(socket.AF_UNIX)
102 try:
102 try:
103 sock.bind(name)
103 sock.bind(name)
104 except socket.error, err:
104 except socket.error, err:
105 return False
105 return False
106 sock.close()
106 sock.close()
107 os.unlink(name)
107 os.unlink(name)
108 return True
108 return True
109
109
110 def has_fifo():
110 def has_fifo():
111 if getattr(os, "mkfifo", None) is None:
111 if getattr(os, "mkfifo", None) is None:
112 return False
112 return False
113 name = tempfile.mktemp(dir='.', prefix=tempprefix)
113 name = tempfile.mktemp(dir='.', prefix=tempprefix)
114 try:
114 try:
115 os.mkfifo(name)
115 os.mkfifo(name)
116 os.unlink(name)
116 os.unlink(name)
117 return True
117 return True
118 except OSError:
118 except OSError:
119 return False
119 return False
120
120
121 def has_killdaemons():
122 return True
123
121 def has_cacheable_fs():
124 def has_cacheable_fs():
122 from mercurial import util
125 from mercurial import util
123
126
124 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
127 fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix)
125 os.close(fd)
128 os.close(fd)
126 try:
129 try:
127 return util.cachestat(path).cacheable()
130 return util.cachestat(path).cacheable()
128 finally:
131 finally:
129 os.remove(path)
132 os.remove(path)
130
133
131 def has_lsprof():
134 def has_lsprof():
132 try:
135 try:
133 import _lsprof
136 import _lsprof
134 return True
137 return True
135 except ImportError:
138 except ImportError:
136 return False
139 return False
137
140
138 def has_gettext():
141 def has_gettext():
139 return matchoutput('msgfmt --version', 'GNU gettext-tools')
142 return matchoutput('msgfmt --version', 'GNU gettext-tools')
140
143
141 def has_git():
144 def has_git():
142 return matchoutput('git --version 2>&1', r'^git version')
145 return matchoutput('git --version 2>&1', r'^git version')
143
146
144 def has_docutils():
147 def has_docutils():
145 try:
148 try:
146 from docutils.core import publish_cmdline
149 from docutils.core import publish_cmdline
147 return True
150 return True
148 except ImportError:
151 except ImportError:
149 return False
152 return False
150
153
151 def getsvnversion():
154 def getsvnversion():
152 m = matchoutput('svn --version 2>&1', r'^svn,\s+version\s+(\d+)\.(\d+)')
155 m = matchoutput('svn --version 2>&1', r'^svn,\s+version\s+(\d+)\.(\d+)')
153 if not m:
156 if not m:
154 return (0, 0)
157 return (0, 0)
155 return (int(m.group(1)), int(m.group(2)))
158 return (int(m.group(1)), int(m.group(2)))
156
159
157 def has_svn15():
160 def has_svn15():
158 return getsvnversion() >= (1, 5)
161 return getsvnversion() >= (1, 5)
159
162
160 def has_svn13():
163 def has_svn13():
161 return getsvnversion() >= (1, 3)
164 return getsvnversion() >= (1, 3)
162
165
163 def has_svn():
166 def has_svn():
164 return matchoutput('svn --version 2>&1', r'^svn, version') and \
167 return matchoutput('svn --version 2>&1', r'^svn, version') and \
165 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
168 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
166
169
167 def has_svn_bindings():
170 def has_svn_bindings():
168 try:
171 try:
169 import svn.core
172 import svn.core
170 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
173 version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR
171 if version < (1, 4):
174 if version < (1, 4):
172 return False
175 return False
173 return True
176 return True
174 except ImportError:
177 except ImportError:
175 return False
178 return False
176
179
177 def has_p4():
180 def has_p4():
178 return (matchoutput('p4 -V', r'Rev\. P4/') and
181 return (matchoutput('p4 -V', r'Rev\. P4/') and
179 matchoutput('p4d -V', r'Rev\. P4D/'))
182 matchoutput('p4d -V', r'Rev\. P4D/'))
180
183
181 def has_symlink():
184 def has_symlink():
182 if getattr(os, "symlink", None) is None:
185 if getattr(os, "symlink", None) is None:
183 return False
186 return False
184 name = tempfile.mktemp(dir='.', prefix=tempprefix)
187 name = tempfile.mktemp(dir='.', prefix=tempprefix)
185 try:
188 try:
186 os.symlink(".", name)
189 os.symlink(".", name)
187 os.unlink(name)
190 os.unlink(name)
188 return True
191 return True
189 except (OSError, AttributeError):
192 except (OSError, AttributeError):
190 return False
193 return False
191
194
192 def has_hardlink():
195 def has_hardlink():
193 from mercurial import util
196 from mercurial import util
194 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
197 fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix)
195 os.close(fh)
198 os.close(fh)
196 name = tempfile.mktemp(dir='.', prefix=tempprefix)
199 name = tempfile.mktemp(dir='.', prefix=tempprefix)
197 try:
200 try:
198 try:
201 try:
199 util.oslink(fn, name)
202 util.oslink(fn, name)
200 os.unlink(name)
203 os.unlink(name)
201 return True
204 return True
202 except OSError:
205 except OSError:
203 return False
206 return False
204 finally:
207 finally:
205 os.unlink(fn)
208 os.unlink(fn)
206
209
207 def has_tla():
210 def has_tla():
208 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
211 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
209
212
210 def has_gpg():
213 def has_gpg():
211 return matchoutput('gpg --version 2>&1', r'GnuPG')
214 return matchoutput('gpg --version 2>&1', r'GnuPG')
212
215
213 def has_unix_permissions():
216 def has_unix_permissions():
214 d = tempfile.mkdtemp(dir='.', prefix=tempprefix)
217 d = tempfile.mkdtemp(dir='.', prefix=tempprefix)
215 try:
218 try:
216 fname = os.path.join(d, 'foo')
219 fname = os.path.join(d, 'foo')
217 for umask in (077, 007, 022):
220 for umask in (077, 007, 022):
218 os.umask(umask)
221 os.umask(umask)
219 f = open(fname, 'w')
222 f = open(fname, 'w')
220 f.close()
223 f.close()
221 mode = os.stat(fname).st_mode
224 mode = os.stat(fname).st_mode
222 os.unlink(fname)
225 os.unlink(fname)
223 if mode & 0777 != ~umask & 0666:
226 if mode & 0777 != ~umask & 0666:
224 return False
227 return False
225 return True
228 return True
226 finally:
229 finally:
227 os.rmdir(d)
230 os.rmdir(d)
228
231
229 def has_pyflakes():
232 def has_pyflakes():
230 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
233 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
231 r"<stdin>:1: 're' imported but unused",
234 r"<stdin>:1: 're' imported but unused",
232 True)
235 True)
233
236
234 def has_pygments():
237 def has_pygments():
235 try:
238 try:
236 import pygments
239 import pygments
237 return True
240 return True
238 except ImportError:
241 except ImportError:
239 return False
242 return False
240
243
241 def has_outer_repo():
244 def has_outer_repo():
242 # failing for other reasons than 'no repo' imply that there is a repo
245 # failing for other reasons than 'no repo' imply that there is a repo
243 return not matchoutput('hg root 2>&1',
246 return not matchoutput('hg root 2>&1',
244 r'abort: no repository found', True)
247 r'abort: no repository found', True)
245
248
246 def has_ssl():
249 def has_ssl():
247 try:
250 try:
248 import ssl
251 import ssl
249 import OpenSSL
252 import OpenSSL
250 OpenSSL.SSL.Context
253 OpenSSL.SSL.Context
251 return True
254 return True
252 except ImportError:
255 except ImportError:
253 return False
256 return False
254
257
255 def has_windows():
258 def has_windows():
256 return os.name == 'nt'
259 return os.name == 'nt'
257
260
258 def has_system_sh():
261 def has_system_sh():
259 return os.name != 'nt'
262 return os.name != 'nt'
260
263
261 def has_serve():
264 def has_serve():
262 return os.name != 'nt' # gross approximation
265 return os.name != 'nt' # gross approximation
263
266
264 def has_tic():
267 def has_tic():
265 return matchoutput('test -x "`which tic`"', '')
268 return matchoutput('test -x "`which tic`"', '')
266
269
267 def has_msys():
270 def has_msys():
268 return os.getenv('MSYSTEM')
271 return os.getenv('MSYSTEM')
269
272
270 checks = {
273 checks = {
271 "true": (lambda: True, "yak shaving"),
274 "true": (lambda: True, "yak shaving"),
272 "false": (lambda: False, "nail clipper"),
275 "false": (lambda: False, "nail clipper"),
273 "baz": (has_baz, "GNU Arch baz client"),
276 "baz": (has_baz, "GNU Arch baz client"),
274 "bzr": (has_bzr, "Canonical's Bazaar client"),
277 "bzr": (has_bzr, "Canonical's Bazaar client"),
275 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
278 "bzr114": (has_bzr114, "Canonical's Bazaar client >= 1.14"),
276 "cacheable": (has_cacheable_fs, "cacheable filesystem"),
279 "cacheable": (has_cacheable_fs, "cacheable filesystem"),
277 "cvs": (has_cvs, "cvs client/server"),
280 "cvs": (has_cvs, "cvs client/server"),
278 "darcs": (has_darcs, "darcs client"),
281 "darcs": (has_darcs, "darcs client"),
279 "docutils": (has_docutils, "Docutils text processing library"),
282 "docutils": (has_docutils, "Docutils text processing library"),
280 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
283 "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
281 "execbit": (has_executablebit, "executable bit"),
284 "execbit": (has_executablebit, "executable bit"),
282 "fifo": (has_fifo, "named pipes"),
285 "fifo": (has_fifo, "named pipes"),
283 "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
286 "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
284 "git": (has_git, "git command line client"),
287 "git": (has_git, "git command line client"),
285 "gpg": (has_gpg, "gpg client"),
288 "gpg": (has_gpg, "gpg client"),
286 "hardlink": (has_hardlink, "hardlinks"),
289 "hardlink": (has_hardlink, "hardlinks"),
287 "icasefs": (has_icasefs, "case insensitive file system"),
290 "icasefs": (has_icasefs, "case insensitive file system"),
288 "inotify": (has_inotify, "inotify extension support"),
291 "inotify": (has_inotify, "inotify extension support"),
292 "killdaemons": (has_killdaemons, 'killdaemons.py support'),
289 "lsprof": (has_lsprof, "python lsprof module"),
293 "lsprof": (has_lsprof, "python lsprof module"),
290 "mtn": (has_mtn, "monotone client (>= 1.0)"),
294 "mtn": (has_mtn, "monotone client (>= 1.0)"),
291 "outer-repo": (has_outer_repo, "outer repo"),
295 "outer-repo": (has_outer_repo, "outer repo"),
292 "p4": (has_p4, "Perforce server and client"),
296 "p4": (has_p4, "Perforce server and client"),
293 "pyflakes": (has_pyflakes, "Pyflakes python linter"),
297 "pyflakes": (has_pyflakes, "Pyflakes python linter"),
294 "pygments": (has_pygments, "Pygments source highlighting library"),
298 "pygments": (has_pygments, "Pygments source highlighting library"),
295 "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
299 "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
296 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
300 "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
297 "svn": (has_svn, "subversion client and admin tools"),
301 "svn": (has_svn, "subversion client and admin tools"),
298 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
302 "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
299 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"),
303 "svn15": (has_svn15, "subversion client and admin tools >= 1.5"),
300 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
304 "svn-bindings": (has_svn_bindings, "subversion python bindings"),
301 "symlink": (has_symlink, "symbolic links"),
305 "symlink": (has_symlink, "symbolic links"),
302 "system-sh": (has_system_sh, "system() uses sh"),
306 "system-sh": (has_system_sh, "system() uses sh"),
303 "tic": (has_tic, "terminfo compiler"),
307 "tic": (has_tic, "terminfo compiler"),
304 "tla": (has_tla, "GNU Arch tla client"),
308 "tla": (has_tla, "GNU Arch tla client"),
305 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
309 "unix-permissions": (has_unix_permissions, "unix-style permissions"),
306 "windows": (has_windows, "Windows"),
310 "windows": (has_windows, "Windows"),
307 "msys": (has_msys, "Windows with MSYS"),
311 "msys": (has_msys, "Windows with MSYS"),
308 }
312 }
@@ -1,94 +1,96 b''
1 $ "$TESTDIR/hghave" serve || exit 80
1 $ "$TESTDIR/hghave" killdaemons || exit 80
2
2
3 $ hgserve() {
3 $ hgserve() {
4 > hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@
4 > hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid \
5 > -E errors.log -v $@ > startup.log
6 > # Grepping hg serve stdout would hang on Windows
7 > grep -v 'listening at' startup.log
5 > cat hg.pid >> "$DAEMON_PIDS"
8 > cat hg.pid >> "$DAEMON_PIDS"
6 > }
9 > }
7 $ hg init a
10 $ hg init a
8 $ hg --encoding utf-8 -R a branch Γ¦
11 $ hg --encoding utf-8 -R a branch Γ¦
9 marked working directory as branch \xc3\xa6 (esc)
12 marked working directory as branch \xc3\xa6 (esc)
10 (branches are permanent and global, did you want a bookmark?)
13 (branches are permanent and global, did you want a bookmark?)
11 $ echo foo > a/foo
14 $ echo foo > a/foo
12 $ hg -R a ci -Am foo
15 $ hg -R a ci -Am foo
13 adding foo
16 adding foo
14 $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
17 $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
15 listening at http://*:$HGPORT1/ (bound to 127.0.0.1:$HGPORT1) (glob)
16 $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b
18 $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b
17 requesting all changes
19 requesting all changes
18 adding changesets
20 adding changesets
19 adding manifests
21 adding manifests
20 adding file changes
22 adding file changes
21 added 1 changesets with 1 changes to 1 files
23 added 1 changesets with 1 changes to 1 files
22 updating to branch \xc3\xa6 (esc)
24 updating to branch \xc3\xa6 (esc)
23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 $ hg --encoding utf-8 -R b log
26 $ hg --encoding utf-8 -R b log
25 changeset: 0:867c11ce77b8
27 changeset: 0:867c11ce77b8
26 branch: \xc3\xa6 (esc)
28 branch: \xc3\xa6 (esc)
27 tag: tip
29 tag: tip
28 user: test
30 user: test
29 date: Thu Jan 01 00:00:00 1970 +0000
31 date: Thu Jan 01 00:00:00 1970 +0000
30 summary: foo
32 summary: foo
31
33
32 $ echo bar >> b/foo
34 $ echo bar >> b/foo
33 $ hg -R b ci -m bar
35 $ hg -R b ci -m bar
34 $ hg --encoding utf-8 -R b push
36 $ hg --encoding utf-8 -R b push
35 pushing to http://localhost:$HGPORT1/
37 pushing to http://localhost:$HGPORT1/
36 searching for changes
38 searching for changes
37 remote: adding changesets
39 remote: adding changesets
38 remote: adding manifests
40 remote: adding manifests
39 remote: adding file changes
41 remote: adding file changes
40 remote: added 1 changesets with 1 changes to 1 files
42 remote: added 1 changesets with 1 changes to 1 files
41 $ hg -R a --encoding utf-8 log
43 $ hg -R a --encoding utf-8 log
42 changeset: 1:58e7c90d67cb
44 changeset: 1:58e7c90d67cb
43 branch: \xc3\xa6 (esc)
45 branch: \xc3\xa6 (esc)
44 tag: tip
46 tag: tip
45 user: test
47 user: test
46 date: Thu Jan 01 00:00:00 1970 +0000
48 date: Thu Jan 01 00:00:00 1970 +0000
47 summary: bar
49 summary: bar
48
50
49 changeset: 0:867c11ce77b8
51 changeset: 0:867c11ce77b8
50 branch: \xc3\xa6 (esc)
52 branch: \xc3\xa6 (esc)
51 user: test
53 user: test
52 date: Thu Jan 01 00:00:00 1970 +0000
54 date: Thu Jan 01 00:00:00 1970 +0000
53 summary: foo
55 summary: foo
54
56
55 $ kill `cat hg.pid`
57 $ "$TESTDIR/killdaemons.py" hg.pid
56
58
57 verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
59 verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
58
60
59 $ cat <<EOF > oldhg
61 $ cat <<EOF > oldhg
60 > import sys
62 > import sys
61 > from mercurial import ui, hg, commands
63 > from mercurial import ui, hg, commands
62 >
64 >
63 > class StdoutWrapper(object):
65 > class StdoutWrapper(object):
64 > def __init__(self, stdout):
66 > def __init__(self, stdout):
65 > self._file = stdout
67 > self._file = stdout
66 >
68 >
67 > def write(self, data):
69 > def write(self, data):
68 > if data == '47\n':
70 > if data == '47\n':
69 > # latin1 encoding is one %xx (3 bytes) shorter
71 > # latin1 encoding is one %xx (3 bytes) shorter
70 > data = '44\n'
72 > data = '44\n'
71 > elif data.startswith('%C3%A6 '):
73 > elif data.startswith('%C3%A6 '):
72 > # translate to latin1 encoding
74 > # translate to latin1 encoding
73 > data = '%%E6 %s' % data[7:]
75 > data = '%%E6 %s' % data[7:]
74 > self._file.write(data)
76 > self._file.write(data)
75 >
77 >
76 > def __getattr__(self, name):
78 > def __getattr__(self, name):
77 > return getattr(self._file, name)
79 > return getattr(self._file, name)
78 >
80 >
79 > sys.stdout = StdoutWrapper(sys.stdout)
81 > sys.stdout = StdoutWrapper(sys.stdout)
80 > sys.stderr = StdoutWrapper(sys.stderr)
82 > sys.stderr = StdoutWrapper(sys.stderr)
81 >
83 >
82 > myui = ui.ui()
84 > myui = ui.ui()
83 > repo = hg.repository(myui, 'a')
85 > repo = hg.repository(myui, 'a')
84 > commands.serve(myui, repo, stdio=True, cmdserver=False)
86 > commands.serve(myui, repo, stdio=True, cmdserver=False)
85 > EOF
87 > EOF
86 $ echo baz >> b/foo
88 $ echo baz >> b/foo
87 $ hg -R b ci -m baz
89 $ hg -R b ci -m baz
88 $ hg push -R b -e 'python oldhg' ssh://dummy/ --encoding latin1
90 $ hg push -R b -e 'python oldhg' ssh://dummy/ --encoding latin1
89 pushing to ssh://dummy/
91 pushing to ssh://dummy/
90 searching for changes
92 searching for changes
91 remote: adding changesets
93 remote: adding changesets
92 remote: adding manifests
94 remote: adding manifests
93 remote: adding file changes
95 remote: adding file changes
94 remote: added 1 changesets with 1 changes to 1 files
96 remote: added 1 changesets with 1 changes to 1 files
General Comments 0
You need to be logged in to leave comments. Login now