##// END OF EJS Templates
merge with stable
Matt Mackall -
r16621:8c3c9031 merge default
parent child Browse files
Show More
@@ -40,8 +40,8 b" orig_cmd = os.getenv('SSH_ORIGINAL_COMMA"
40 try:
40 try:
41 cmdargv = shlex.split(orig_cmd)
41 cmdargv = shlex.split(orig_cmd)
42 except ValueError, e:
42 except ValueError, e:
43 sys.stderr.write("Illegal command %r: %s\n" % (orig_cmd, e))
43 sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
44 sys.exit(-1)
44 sys.exit(255)
45
45
46 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']:
46 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']:
47 path = cmdargv[2]
47 path = cmdargv[2]
@@ -49,9 +49,9 b" if cmdargv[:2] == ['hg', '-R'] and cmdar"
49 if repo in allowed_paths:
49 if repo in allowed_paths:
50 dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio']))
50 dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio']))
51 else:
51 else:
52 sys.stderr.write("Illegal repository %r\n" % repo)
52 sys.stderr.write('Illegal repository "%s"\n' % repo)
53 sys.exit(-1)
53 sys.exit(255)
54 else:
54 else:
55 sys.stderr.write("Illegal command %r\n" % orig_cmd)
55 sys.stderr.write('Illegal command "%s"\n' % orig_cmd)
56 sys.exit(-1)
56 sys.exit(255)
57
57
@@ -47,7 +47,10 b' by the command whatis or apropos.'
47 import re
47 import re
48
48
49 from docutils import nodes, writers, languages
49 from docutils import nodes, writers, languages
50 import roman
50 try:
51 import roman
52 except ImportError:
53 from docutils.utils import roman
51 import inspect
54 import inspect
52
55
53 FIELD_LIST_INDENT = 7
56 FIELD_LIST_INDENT = 7
@@ -153,6 +153,7 b' class changelog(revlog.revlog):'
153 r = revlog.revlog(self.opener, file)
153 r = revlog.revlog(self.opener, file)
154 self.index = r.index
154 self.index = r.index
155 self.nodemap = r.nodemap
155 self.nodemap = r.nodemap
156 self._nodecache = r._nodecache
156 self._chunkcache = r._chunkcache
157 self._chunkcache = r._chunkcache
157
158
158 def writepending(self):
159 def writepending(self):
@@ -243,6 +243,7 b' class cmdalias(object):'
243 self.opts = []
243 self.opts = []
244 self.help = ''
244 self.help = ''
245 self.norepo = True
245 self.norepo = True
246 self.optionalrepo = False
246 self.badalias = False
247 self.badalias = False
247
248
248 try:
249 try:
@@ -312,6 +313,8 b' class cmdalias(object):'
312 self.args = aliasargs(self.fn, args)
313 self.args = aliasargs(self.fn, args)
313 if cmd not in commands.norepo.split(' '):
314 if cmd not in commands.norepo.split(' '):
314 self.norepo = False
315 self.norepo = False
316 if cmd in commands.optionalrepo.split(' '):
317 self.optionalrepo = True
315 if self.help.startswith("hg " + cmd):
318 if self.help.startswith("hg " + cmd):
316 # drop prefix in old-style help lines so hg shows the alias
319 # drop prefix in old-style help lines so hg shows the alias
317 self.help = self.help[4 + len(cmd):]
320 self.help = self.help[4 + len(cmd):]
@@ -370,6 +373,8 b' def addaliases(ui, cmdtable):'
370 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
373 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
371 if aliasdef.norepo:
374 if aliasdef.norepo:
372 commands.norepo += ' %s' % alias
375 commands.norepo += ' %s' % alias
376 if aliasdef.optionalrepo:
377 commands.optionalrepo += ' %s' % alias
373
378
374 def _parse(ui, args):
379 def _parse(ui, args):
375 options = {}
380 options = {}
@@ -495,7 +500,6 b' def _getlocal(ui, rpath):'
495 return path, lui
500 return path, lui
496
501
497 def _checkshellalias(lui, ui, args):
502 def _checkshellalias(lui, ui, args):
498 norepo = commands.norepo
499 options = {}
503 options = {}
500
504
501 try:
505 try:
@@ -506,6 +510,12 b' def _checkshellalias(lui, ui, args):'
506 if not args:
510 if not args:
507 return
511 return
508
512
513 norepo = commands.norepo
514 optionalrepo = commands.optionalrepo
515 def restorecommands():
516 commands.norepo = norepo
517 commands.optionalrepo = optionalrepo
518
509 cmdtable = commands.table.copy()
519 cmdtable = commands.table.copy()
510 addaliases(lui, cmdtable)
520 addaliases(lui, cmdtable)
511
521
@@ -514,7 +524,7 b' def _checkshellalias(lui, ui, args):'
514 aliases, entry = cmdutil.findcmd(cmd, cmdtable,
524 aliases, entry = cmdutil.findcmd(cmd, cmdtable,
515 lui.configbool("ui", "strict"))
525 lui.configbool("ui", "strict"))
516 except (error.AmbiguousCommand, error.UnknownCommand):
526 except (error.AmbiguousCommand, error.UnknownCommand):
517 commands.norepo = norepo
527 restorecommands()
518 return
528 return
519
529
520 cmd = aliases[0]
530 cmd = aliases[0]
@@ -524,7 +534,7 b' def _checkshellalias(lui, ui, args):'
524 d = lambda: fn(ui, *args[1:])
534 d = lambda: fn(ui, *args[1:])
525 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
535 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
526
536
527 commands.norepo = norepo
537 restorecommands()
528
538
529 _loaded = set()
539 _loaded = set()
530 def _dispatch(req):
540 def _dispatch(req):
@@ -1113,7 +1113,6 b' static PyTypeObject indexType = {'
1113 0, /* tp_dictoffset */
1113 0, /* tp_dictoffset */
1114 (initproc)index_init, /* tp_init */
1114 (initproc)index_init, /* tp_init */
1115 0, /* tp_alloc */
1115 0, /* tp_alloc */
1116 PyType_GenericNew, /* tp_new */
1117 };
1116 };
1118
1117
1119 /*
1118 /*
@@ -1171,6 +1170,7 b' static PyMethodDef methods[] = {'
1171
1170
1172 static void module_init(PyObject *mod)
1171 static void module_init(PyObject *mod)
1173 {
1172 {
1173 indexType.tp_new = PyType_GenericNew;
1174 if (PyType_Ready(&indexType) < 0)
1174 if (PyType_Ready(&indexType) < 0)
1175 return;
1175 return;
1176 Py_INCREF(&indexType);
1176 Py_INCREF(&indexType);
@@ -9,6 +9,7 b''
9 > # should clobber ci but not commit (issue2993)
9 > # should clobber ci but not commit (issue2993)
10 > ci = version
10 > ci = version
11 > myinit = init
11 > myinit = init
12 > optionalrepo = showconfig alias.myinit
12 > cleanstatus = status -c
13 > cleanstatus = status -c
13 > unknown = bargle
14 > unknown = bargle
14 > ambiguous = s
15 > ambiguous = s
@@ -108,8 +109,17 b' invalid options'
108 $ hg help no--repository
109 $ hg help no--repository
109 error in definition for alias 'no--repository': --repository may only be given on the command line
110 error in definition for alias 'no--repository': --repository may only be given on the command line
110
111
112 optional repository
113
114 $ hg optionalrepo
115 init
111 $ cd alias
116 $ cd alias
112
117 $ cat > .hg/hgrc <<EOF
118 > [alias]
119 > myinit = init -q
120 > EOF
121 $ hg optionalrepo
122 init -q
113
123
114 no usage
124 no usage
115
125
@@ -57,14 +57,14 b' test changing case of path components'
57 A D/c
57 A D/c
58 $ hg ci -m addc D/c
58 $ hg ci -m addc D/c
59 $ hg mv d/b d/e
59 $ hg mv d/b d/e
60 moving D/b to D/e
60 moving D/b to D/e (glob)
61 $ hg st
61 $ hg st
62 A D/e
62 A D/e
63 R D/b
63 R D/b
64 $ hg revert -aq
64 $ hg revert -aq
65 $ rm d/e
65 $ rm d/e
66 $ hg mv d/b D/B
66 $ hg mv d/b D/B
67 moving D/b to D/B
67 moving D/b to D/B (glob)
68 $ hg st
68 $ hg st
69 A D/B
69 A D/B
70 R D/b
70 R D/b
@@ -579,3 +579,30 b' new tags must be visible in pretxncommit'
579 $ hg tag -f foo
579 $ hg tag -f foo
580 ['a', 'foo', 'tip']
580 ['a', 'foo', 'tip']
581
581
582 new commits must be visible in pretxnchangegroup (issue3428)
583
584 $ cd ..
585 $ hg init to
586 $ echo '[hooks]' >> to/.hg/hgrc
587 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
588 $ echo a >> to/a
589 $ hg --cwd to ci -Ama
590 adding a
591 $ hg clone to from
592 updating to branch default
593 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
594 $ echo aa >> from/a
595 $ hg --cwd from ci -mb
596 $ hg --cwd from push
597 pushing to $TESTTMP/to
598 searching for changes
599 adding changesets
600 adding manifests
601 adding file changes
602 added 1 changesets with 1 changes to 1 files
603 changeset: 1:9836a07b9b9d
604 tag: tip
605 user: test
606 date: Thu Jan 01 00:00:00 1970 +0000
607 summary: b
608
@@ -114,8 +114,12 b' def runtest() :'
114 for i, r in enumerate(ix):
114 for i, r in enumerate(ix):
115 if r[7] == nullid:
115 if r[7] == nullid:
116 i = -1
116 i = -1
117 if ix[r[7]] != i:
117 try:
118 print 'Reverse lookup inconsistent for %r' % r[7].encode('hex')
118 if ix[r[7]] != i:
119 print 'Reverse lookup inconsistent for %r' % r[7].encode('hex')
120 except TypeError:
121 # pure version doesn't support this
122 break
119
123
120 print "done"
124 print "done"
121
125
@@ -278,19 +278,36 b' Test remote paths with spaces (issue2983'
278 $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
278 $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
279 3fb238f49e8c
279 3fb238f49e8c
280
280
281 Test hg-ssh:
281 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
282 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
283 parameters:
282
284
283 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP/a repo\"" "ssh://user@dummy/a repo"
285 $ cat > ssh.sh << EOF
286 > userhost="\$1"
287 > SSH_ORIGINAL_COMMAND="\$2"
288 > export SSH_ORIGINAL_COMMAND
289 > PYTHONPATH="$PYTHONPATH"
290 > export PYTHONPATH
291 > python "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
292 > EOF
293
294 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
284 3fb238f49e8c
295 3fb238f49e8c
285 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP\"" "ssh://user@dummy/a repo"
296
286 remote: Illegal repository '$TESTTMP/a repo' (glob)
297 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
298 remote: Illegal repository "$TESTTMP/a'repo" (glob)
287 abort: no suitable response from remote hg!
299 abort: no suitable response from remote hg!
288 [255]
300 [255]
289 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" hg id --ssh "python \"$TESTDIR\"/../contrib/hg-ssh \"$TESTTMP\"" "ssh://user@dummy/a repo"
301
290 remote: Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
302 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
303 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
291 abort: no suitable response from remote hg!
304 abort: no suitable response from remote hg!
292 [255]
305 [255]
293
306
307 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" python "$TESTDIR/../contrib/hg-ssh"
308 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
309 [255]
310
294 $ cat dummylog
311 $ cat dummylog
295 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
312 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
296 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
313 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
General Comments 0
You need to be logged in to leave comments. Login now