annotate tests/test-hgweb-non-interactive.t @ 26228:0fd20a71abdb

extdiff: add a --patch argument for diffing changeset deltas One of the things I missed the most when transitioning from versioned MQ to evolve was the loss of being able to check that rebase conflicts were properly resolved by: $ hg ci --mq -m "before" $ hg rebase -s qbase -d tip $ hg bcompare --mq The old csets stay in the tree with evolve, but a straight diff includes all of the other changes that were pulled in, obscuring the code that was rebased. Diffing deltas can be confusing, but unless radical changes were made during the resolve, it is very clear when individual hunks are added, dropped or modified. Unlike the MQ technique, this can only compare a single pair of csets/patches at a time. Like the MQ method, this also highlights changes in the commit comment and other metadata. I originally tried monkey patching from the evolve extension, but that is too complicated given that it depends on the order the two different extensions are loaded. This functionality is also useful when comparing grafts however, so implementing it in the core is more than just convenience. The --change argument doesn't make much sense for this, but it isn't harmful so I didn't bother blocking it. The -I/-X options are ignored because of a limitation of cmdutil.export(). We'll fix that next.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 09 Sep 2015 21:07:38 -0400
parents a43328baa2ac
children 7df5d4760873
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12440
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
1 Tests if hgweb can run without touching sys.stdin, as is required
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
2 by the WSGI standard and strictly implemented by mod_wsgi.
5337
8c5ef3b87cb1 Don't try to determine interactivity if ui() called with interactive=False.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
3
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 12743
diff changeset
4 $ hg init repo
12440
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
5 $ cd repo
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
6 $ echo foo > bar
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
7 $ hg add bar
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
8 $ hg commit -m "test"
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
9 $ cat > request.py <<EOF
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
10 > from mercurial import dispatch
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
11 > from mercurial.hgweb.hgweb_mod import hgweb
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
12 > from mercurial.ui import ui
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
13 > from mercurial import hg
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
14 > from StringIO import StringIO
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
15 > import os, sys
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
16 >
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
17 > class FileLike(object):
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
18 > def __init__(self, real):
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
19 > self.real = real
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
20 > def fileno(self):
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
21 > print >> sys.__stdout__, 'FILENO'
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
22 > return self.real.fileno()
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
23 > def read(self):
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
24 > print >> sys.__stdout__, 'READ'
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
25 > return self.real.read()
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
26 > def readline(self):
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
27 > print >> sys.__stdout__, 'READLINE'
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
28 > return self.real.readline()
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
29 >
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
30 > sys.stdin = FileLike(sys.stdin)
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
31 > errors = StringIO()
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
32 > input = StringIO()
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
33 > output = StringIO()
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
34 >
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
35 > def startrsp(status, headers):
12743
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
36 > print '---- STATUS'
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
37 > print status
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
38 > print '---- HEADERS'
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
39 > print [i for i in headers if i[0] != 'ETag']
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
40 > print '---- DATA'
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
41 > return output.write
12440
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
42 >
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
43 > env = {
12743
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
44 > 'wsgi.version': (1, 0),
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
45 > 'wsgi.url_scheme': 'http',
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
46 > 'wsgi.errors': errors,
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
47 > 'wsgi.input': input,
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
48 > 'wsgi.multithread': False,
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
49 > 'wsgi.multiprocess': False,
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
50 > 'wsgi.run_once': False,
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
51 > 'REQUEST_METHOD': 'GET',
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
52 > 'SCRIPT_NAME': '',
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
53 > 'PATH_INFO': '',
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
54 > 'QUERY_STRING': '',
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
55 > 'SERVER_NAME': '127.0.0.1',
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
56 > 'SERVER_PORT': os.environ['HGPORT'],
4c4aeaab2339 check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 12440
diff changeset
57 > 'SERVER_PROTOCOL': 'HTTP/1.0'
12440
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
58 > }
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
59 >
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
60 > i = hgweb('.')
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
61 > i(env, startrsp)
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
62 > print '---- ERRORS'
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
63 > print errors.getvalue()
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
64 > print '---- OS.ENVIRON wsgi variables'
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
65 > print sorted([x for x in os.environ if x.startswith('wsgi')])
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
66 > print '---- request.ENVIRON wsgi variables'
26220
a43328baa2ac hgweb: use separate repo instances per thread
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26219
diff changeset
67 > with i._obtainrepo() as repo:
a43328baa2ac hgweb: use separate repo instances per thread
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26219
diff changeset
68 > print sorted([x for x in repo.ui.environ if x.startswith('wsgi')])
12440
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
69 > EOF
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
70 $ python request.py
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
71 ---- STATUS
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
72 200 Script output follows
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
73 ---- HEADERS
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
74 [('Content-Type', 'text/html; charset=ascii')]
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
75 ---- DATA
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
76 ---- ERRORS
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
77
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
78 ---- OS.ENVIRON wsgi variables
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
79 []
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
80 ---- request.ENVIRON wsgi variables
d9f7753a94d5 tests: unify test-hgweb-non-interactive
Matt Mackall <mpm@selenic.com>
parents: 12183
diff changeset
81 ['wsgi.errors', 'wsgi.input', 'wsgi.multiprocess', 'wsgi.multithread', 'wsgi.run_once', 'wsgi.url_scheme', 'wsgi.version']
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
82
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
83 $ cd ..