##// 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 40 try:
41 41 cmdargv = shlex.split(orig_cmd)
42 42 except ValueError, e:
43 sys.stderr.write("Illegal command %r: %s\n" % (orig_cmd, e))
44 sys.exit(-1)
43 sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
44 sys.exit(255)
45 45
46 46 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']:
47 47 path = cmdargv[2]
@@ -49,9 +49,9 b" if cmdargv[:2] == ['hg', '-R'] and cmdar"
49 49 if repo in allowed_paths:
50 50 dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio']))
51 51 else:
52 sys.stderr.write("Illegal repository %r\n" % repo)
53 sys.exit(-1)
52 sys.stderr.write('Illegal repository "%s"\n' % repo)
53 sys.exit(255)
54 54 else:
55 sys.stderr.write("Illegal command %r\n" % orig_cmd)
56 sys.exit(-1)
55 sys.stderr.write('Illegal command "%s"\n' % orig_cmd)
56 sys.exit(255)
57 57
@@ -47,7 +47,10 b' by the command whatis or apropos.'
47 47 import re
48 48
49 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 54 import inspect
52 55
53 56 FIELD_LIST_INDENT = 7
@@ -153,6 +153,7 b' class changelog(revlog.revlog):'
153 153 r = revlog.revlog(self.opener, file)
154 154 self.index = r.index
155 155 self.nodemap = r.nodemap
156 self._nodecache = r._nodecache
156 157 self._chunkcache = r._chunkcache
157 158
158 159 def writepending(self):
@@ -243,6 +243,7 b' class cmdalias(object):'
243 243 self.opts = []
244 244 self.help = ''
245 245 self.norepo = True
246 self.optionalrepo = False
246 247 self.badalias = False
247 248
248 249 try:
@@ -312,6 +313,8 b' class cmdalias(object):'
312 313 self.args = aliasargs(self.fn, args)
313 314 if cmd not in commands.norepo.split(' '):
314 315 self.norepo = False
316 if cmd in commands.optionalrepo.split(' '):
317 self.optionalrepo = True
315 318 if self.help.startswith("hg " + cmd):
316 319 # drop prefix in old-style help lines so hg shows the alias
317 320 self.help = self.help[4 + len(cmd):]
@@ -370,6 +373,8 b' def addaliases(ui, cmdtable):'
370 373 cmdtable[aliasdef.name] = (aliasdef, aliasdef.opts, aliasdef.help)
371 374 if aliasdef.norepo:
372 375 commands.norepo += ' %s' % alias
376 if aliasdef.optionalrepo:
377 commands.optionalrepo += ' %s' % alias
373 378
374 379 def _parse(ui, args):
375 380 options = {}
@@ -495,7 +500,6 b' def _getlocal(ui, rpath):'
495 500 return path, lui
496 501
497 502 def _checkshellalias(lui, ui, args):
498 norepo = commands.norepo
499 503 options = {}
500 504
501 505 try:
@@ -506,6 +510,12 b' def _checkshellalias(lui, ui, args):'
506 510 if not args:
507 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 519 cmdtable = commands.table.copy()
510 520 addaliases(lui, cmdtable)
511 521
@@ -514,7 +524,7 b' def _checkshellalias(lui, ui, args):'
514 524 aliases, entry = cmdutil.findcmd(cmd, cmdtable,
515 525 lui.configbool("ui", "strict"))
516 526 except (error.AmbiguousCommand, error.UnknownCommand):
517 commands.norepo = norepo
527 restorecommands()
518 528 return
519 529
520 530 cmd = aliases[0]
@@ -524,7 +534,7 b' def _checkshellalias(lui, ui, args):'
524 534 d = lambda: fn(ui, *args[1:])
525 535 return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
526 536
527 commands.norepo = norepo
537 restorecommands()
528 538
529 539 _loaded = set()
530 540 def _dispatch(req):
@@ -1113,7 +1113,6 b' static PyTypeObject indexType = {'
1113 1113 0, /* tp_dictoffset */
1114 1114 (initproc)index_init, /* tp_init */
1115 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 1171 static void module_init(PyObject *mod)
1173 1172 {
1173 indexType.tp_new = PyType_GenericNew;
1174 1174 if (PyType_Ready(&indexType) < 0)
1175 1175 return;
1176 1176 Py_INCREF(&indexType);
@@ -9,6 +9,7 b''
9 9 > # should clobber ci but not commit (issue2993)
10 10 > ci = version
11 11 > myinit = init
12 > optionalrepo = showconfig alias.myinit
12 13 > cleanstatus = status -c
13 14 > unknown = bargle
14 15 > ambiguous = s
@@ -108,8 +109,17 b' invalid options'
108 109 $ hg help no--repository
109 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 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 124 no usage
115 125
@@ -57,14 +57,14 b' test changing case of path components'
57 57 A D/c
58 58 $ hg ci -m addc D/c
59 59 $ hg mv d/b d/e
60 moving D/b to D/e
60 moving D/b to D/e (glob)
61 61 $ hg st
62 62 A D/e
63 63 R D/b
64 64 $ hg revert -aq
65 65 $ rm d/e
66 66 $ hg mv d/b D/B
67 moving D/b to D/B
67 moving D/b to D/B (glob)
68 68 $ hg st
69 69 A D/B
70 70 R D/b
@@ -579,3 +579,30 b' new tags must be visible in pretxncommit'
579 579 $ hg tag -f foo
580 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 114 for i, r in enumerate(ix):
115 115 if r[7] == nullid:
116 116 i = -1
117 if ix[r[7]] != i:
118 print 'Reverse lookup inconsistent for %r' % r[7].encode('hex')
117 try:
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 124 print "done"
121 125
@@ -278,19 +278,36 b' Test remote paths with spaces (issue2983'
278 278 $ hg id --ssh "python \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
279 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 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"
286 remote: Illegal repository '$TESTTMP/a repo' (glob)
296
297 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
298 remote: Illegal repository "$TESTTMP/a'repo" (glob)
287 299 abort: no suitable response from remote hg!
288 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"
290 remote: Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
301
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 304 abort: no suitable response from remote hg!
292 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 311 $ cat dummylog
295 312 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
296 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