##// END OF EJS Templates
hgweb: drop references to deprecated cgitb...
Mads Kiilerich -
r51627:d5cd1fd6 stable
parent child Browse files
Show More
@@ -1,22 +1,19 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python3
2 #
2 #
3 # An example FastCGI script for use with flup, edit as necessary
3 # An example FastCGI script for use with flup, edit as necessary
4
4
5 # Path to repo or hgweb config to serve (see 'hg help hgweb')
5 # Path to repo or hgweb config to serve (see 'hg help hgweb')
6 config = b"/path/to/repo/or/config"
6 config = b"/path/to/repo/or/config"
7
7
8 # Uncomment and adjust if Mercurial is not installed system-wide
8 # Uncomment and adjust if Mercurial is not installed system-wide
9 # (consult "installed modules" path from 'hg debuginstall'):
9 # (consult "installed modules" path from 'hg debuginstall'):
10 # import sys; sys.path.insert(0, "/path/to/python/lib")
10 # import sys; sys.path.insert(0, "/path/to/python/lib")
11
11
12 # Uncomment to send python tracebacks to the browser if an error occurs:
13 # import cgitb; cgitb.enable()
14
15 from mercurial import demandimport
12 from mercurial import demandimport
16
13
17 demandimport.enable()
14 demandimport.enable()
18 from mercurial.hgweb import hgweb
15 from mercurial.hgweb import hgweb
19 from flup.server.fcgi import WSGIServer
16 from flup.server.fcgi import WSGIServer
20
17
21 application = hgweb(config)
18 application = hgweb(config)
22 WSGIServer(application).run()
19 WSGIServer(application).run()
@@ -1,18 +1,15 b''
1 # An example WSGI for use with mod_wsgi, edit as necessary
1 # An example WSGI for use with mod_wsgi, edit as necessary
2 # See https://mercurial-scm.org/wiki/modwsgi for more information
2 # See https://mercurial-scm.org/wiki/modwsgi for more information
3
3
4 # Path to repo or hgweb config to serve (see 'hg help hgweb')
4 # Path to repo or hgweb config to serve (see 'hg help hgweb')
5 config = b"/path/to/repo/or/config"
5 config = b"/path/to/repo/or/config"
6
6
7 # Uncomment and adjust if Mercurial is not installed system-wide
7 # Uncomment and adjust if Mercurial is not installed system-wide
8 # (consult "installed modules" path from 'hg debuginstall'):
8 # (consult "installed modules" path from 'hg debuginstall'):
9 #import sys; sys.path.insert(0, "/path/to/python/lib")
9 #import sys; sys.path.insert(0, "/path/to/python/lib")
10
10
11 # Uncomment to send python tracebacks to the browser if an error occurs:
12 #import cgitb; cgitb.enable()
13
14 # enable demandloading to reduce startup time
11 # enable demandloading to reduce startup time
15 from mercurial import demandimport; demandimport.enable()
12 from mercurial import demandimport; demandimport.enable()
16
13
17 from mercurial.hgweb import hgweb
14 from mercurial.hgweb import hgweb
18 application = hgweb(config)
15 application = hgweb(config)
@@ -1,22 +1,19 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python3
2 #
2 #
3 # An example hgweb CGI script, edit as necessary
3 # An example hgweb CGI script, edit as necessary
4 # See also https://mercurial-scm.org/wiki/PublishingRepositories
4 # See also https://mercurial-scm.org/wiki/PublishingRepositories
5
5
6 # Path to repo or hgweb config to serve (see 'hg help hgweb')
6 # Path to repo or hgweb config to serve (see 'hg help hgweb')
7 config = b"/path/to/repo/or/config"
7 config = b"/path/to/repo/or/config"
8
8
9 # Uncomment and adjust if Mercurial is not installed system-wide
9 # Uncomment and adjust if Mercurial is not installed system-wide
10 # (consult "installed modules" path from 'hg debuginstall'):
10 # (consult "installed modules" path from 'hg debuginstall'):
11 # import sys; sys.path.insert(0, "/path/to/python/lib")
11 # import sys; sys.path.insert(0, "/path/to/python/lib")
12
12
13 # Uncomment to send python tracebacks to the browser if an error occurs:
14 # import cgitb; cgitb.enable()
15
16 from mercurial import demandimport
13 from mercurial import demandimport
17
14
18 demandimport.enable()
15 demandimport.enable()
19 from mercurial.hgweb import hgweb, wsgicgi
16 from mercurial.hgweb import hgweb, wsgicgi
20
17
21 application = hgweb(config)
18 application = hgweb(config)
22 wsgicgi.launch(application)
19 wsgicgi.launch(application)
@@ -1,39 +1,37 b''
1 #require no-msys # MSYS will translate web paths as if they were file paths
1 #require no-msys # MSYS will translate web paths as if they were file paths
2
2
3 This is a test of the wire protocol over CGI-based hgweb.
3 This is a test of the wire protocol over CGI-based hgweb.
4 initialize repository
4 initialize repository
5
5
6 $ hg init test
6 $ hg init test
7 $ cd test
7 $ cd test
8 $ echo a > a
8 $ echo a > a
9 $ hg ci -Ama
9 $ hg ci -Ama
10 adding a
10 adding a
11 $ cd ..
11 $ cd ..
12 $ cat >hgweb.cgi <<HGWEB
12 $ cat >hgweb.cgi <<HGWEB
13 > #
13 > #
14 > # An example CGI script to use hgweb, edit as necessary
14 > # An example CGI script to use hgweb, edit as necessary
15 > import cgitb
16 > cgitb.enable()
17 > from mercurial import demandimport; demandimport.enable()
15 > from mercurial import demandimport; demandimport.enable()
18 > from mercurial.hgweb import hgweb
16 > from mercurial.hgweb import hgweb
19 > from mercurial.hgweb import wsgicgi
17 > from mercurial.hgweb import wsgicgi
20 > application = hgweb(b"test", b"Empty test repository")
18 > application = hgweb(b"test", b"Empty test repository")
21 > wsgicgi.launch(application)
19 > wsgicgi.launch(application)
22 > HGWEB
20 > HGWEB
23 $ chmod 755 hgweb.cgi
21 $ chmod 755 hgweb.cgi
24
22
25 try hgweb request
23 try hgweb request
26
24
27 $ . "$TESTDIR/cgienv"
25 $ . "$TESTDIR/cgienv"
28 $ QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING
26 $ QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING
29 $ "$PYTHON" hgweb.cgi >page1 2>&1
27 $ "$PYTHON" hgweb.cgi >page1 2>&1
30 $ "$PYTHON" "$TESTDIR/md5sum.py" page1
28 $ "$PYTHON" "$TESTDIR/md5sum.py" page1
31 1f424bb22ec05c3c6bc866b6e67efe43 page1
29 1f424bb22ec05c3c6bc866b6e67efe43 page1
32
30
33 make sure headers are sent even when there is no body
31 make sure headers are sent even when there is no body
34
32
35 $ QUERY_STRING="cmd=listkeys&namespace=nosuchnamespace" "$PYTHON" hgweb.cgi
33 $ QUERY_STRING="cmd=listkeys&namespace=nosuchnamespace" "$PYTHON" hgweb.cgi
36 Status: 200 Script output follows\r (esc)
34 Status: 200 Script output follows\r (esc)
37 Content-Type: application/mercurial-0.1\r (esc)
35 Content-Type: application/mercurial-0.1\r (esc)
38 Content-Length: 0\r (esc)
36 Content-Length: 0\r (esc)
39 \r (esc)
37 \r (esc)
@@ -1,1622 +1,1620 b''
1 $ checkundo()
1 $ checkundo()
2 > {
2 > {
3 > if [ -f .hg/store/undo ]; then
3 > if [ -f .hg/store/undo ]; then
4 > echo ".hg/store/undo still exists after $1"
4 > echo ".hg/store/undo still exists after $1"
5 > fi
5 > fi
6 > }
6 > }
7
7
8 $ cat <<EOF >> $HGRCPATH
8 $ cat <<EOF >> $HGRCPATH
9 > [extensions]
9 > [extensions]
10 > mq =
10 > mq =
11 > [mq]
11 > [mq]
12 > plain = true
12 > plain = true
13 > EOF
13 > EOF
14
14
15
15
16 help
16 help
17
17
18 $ hg help mq
18 $ hg help mq
19 mq extension - manage a stack of patches
19 mq extension - manage a stack of patches
20
20
21 This extension lets you work with a stack of patches in a Mercurial
21 This extension lets you work with a stack of patches in a Mercurial
22 repository. It manages two stacks of patches - all known patches, and applied
22 repository. It manages two stacks of patches - all known patches, and applied
23 patches (subset of known patches).
23 patches (subset of known patches).
24
24
25 Known patches are represented as patch files in the .hg/patches directory.
25 Known patches are represented as patch files in the .hg/patches directory.
26 Applied patches are both patch files and changesets.
26 Applied patches are both patch files and changesets.
27
27
28 Common tasks (use 'hg help COMMAND' for more details):
28 Common tasks (use 'hg help COMMAND' for more details):
29
29
30 create new patch qnew
30 create new patch qnew
31 import existing patch qimport
31 import existing patch qimport
32
32
33 print patch series qseries
33 print patch series qseries
34 print applied patches qapplied
34 print applied patches qapplied
35
35
36 add known patch to applied stack qpush
36 add known patch to applied stack qpush
37 remove patch from applied stack qpop
37 remove patch from applied stack qpop
38 refresh contents of top applied patch qrefresh
38 refresh contents of top applied patch qrefresh
39
39
40 By default, mq will automatically use git patches when required to avoid
40 By default, mq will automatically use git patches when required to avoid
41 losing file mode changes, copy records, binary files or empty files creations
41 losing file mode changes, copy records, binary files or empty files creations
42 or deletions. This behavior can be configured with:
42 or deletions. This behavior can be configured with:
43
43
44 [mq]
44 [mq]
45 git = auto/keep/yes/no
45 git = auto/keep/yes/no
46
46
47 If set to 'keep', mq will obey the [diff] section configuration while
47 If set to 'keep', mq will obey the [diff] section configuration while
48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
49 will override the [diff] section and always generate git or regular patches,
49 will override the [diff] section and always generate git or regular patches,
50 possibly losing data in the second case.
50 possibly losing data in the second case.
51
51
52 It may be desirable for mq changesets to be kept in the secret phase (see 'hg
52 It may be desirable for mq changesets to be kept in the secret phase (see 'hg
53 help phases'), which can be enabled with the following setting:
53 help phases'), which can be enabled with the following setting:
54
54
55 [mq]
55 [mq]
56 secret = True
56 secret = True
57
57
58 You will by default be managing a patch queue named "patches". You can create
58 You will by default be managing a patch queue named "patches". You can create
59 other, independent patch queues with the 'hg qqueue' command.
59 other, independent patch queues with the 'hg qqueue' command.
60
60
61 If the working directory contains uncommitted files, qpush, qpop and qgoto
61 If the working directory contains uncommitted files, qpush, qpop and qgoto
62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
63
63
64 [mq]
64 [mq]
65 keepchanges = True
65 keepchanges = True
66
66
67 make them behave as if --keep-changes were passed, and non-conflicting local
67 make them behave as if --keep-changes were passed, and non-conflicting local
68 changes will be tolerated and preserved. If incompatible options such as
68 changes will be tolerated and preserved. If incompatible options such as
69 -f/--force or --exact are passed, this setting is ignored.
69 -f/--force or --exact are passed, this setting is ignored.
70
70
71 This extension used to provide a strip command. This command now lives in the
71 This extension used to provide a strip command. This command now lives in the
72 strip extension.
72 strip extension.
73
73
74 list of commands:
74 list of commands:
75
75
76 Repository creation:
76 Repository creation:
77
77
78 qclone clone main and patch repository at same time
78 qclone clone main and patch repository at same time
79
79
80 Change creation:
80 Change creation:
81
81
82 qnew create a new patch
82 qnew create a new patch
83 qrefresh update the current patch
83 qrefresh update the current patch
84
84
85 Change manipulation:
85 Change manipulation:
86
86
87 qfold fold the named patches into the current patch
87 qfold fold the named patches into the current patch
88
88
89 Change organization:
89 Change organization:
90
90
91 qapplied print the patches already applied
91 qapplied print the patches already applied
92 qdelete remove patches from queue
92 qdelete remove patches from queue
93 qfinish move applied patches into repository history
93 qfinish move applied patches into repository history
94 qgoto push or pop patches until named patch is at top of stack
94 qgoto push or pop patches until named patch is at top of stack
95 qguard set or print guards for a patch
95 qguard set or print guards for a patch
96 qheader print the header of the topmost or specified patch
96 qheader print the header of the topmost or specified patch
97 qnext print the name of the next pushable patch
97 qnext print the name of the next pushable patch
98 qpop pop the current patch off the stack
98 qpop pop the current patch off the stack
99 qprev print the name of the preceding applied patch
99 qprev print the name of the preceding applied patch
100 qpush push the next patch onto the stack
100 qpush push the next patch onto the stack
101 qqueue manage multiple patch queues
101 qqueue manage multiple patch queues
102 qrename rename a patch
102 qrename rename a patch
103 qselect set or print guarded patches to push
103 qselect set or print guarded patches to push
104 qseries print the entire series file
104 qseries print the entire series file
105 qtop print the name of the current patch
105 qtop print the name of the current patch
106 qunapplied print the patches not yet applied
106 qunapplied print the patches not yet applied
107
107
108 File content management:
108 File content management:
109
109
110 qdiff diff of the current patch and subsequent modifications
110 qdiff diff of the current patch and subsequent modifications
111
111
112 Change import/export:
112 Change import/export:
113
113
114 qimport import a patch or existing changeset
114 qimport import a patch or existing changeset
115
115
116 (use 'hg help -v mq' to show built-in aliases and global options)
116 (use 'hg help -v mq' to show built-in aliases and global options)
117
117
118 $ hg init a
118 $ hg init a
119 $ cd a
119 $ cd a
120 $ echo a > a
120 $ echo a > a
121 $ hg ci -Ama
121 $ hg ci -Ama
122 adding a
122 adding a
123
123
124 $ hg clone . ../k
124 $ hg clone . ../k
125 updating to branch default
125 updating to branch default
126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
127
127
128 $ mkdir b
128 $ mkdir b
129 $ echo z > b/z
129 $ echo z > b/z
130 $ hg ci -Ama
130 $ hg ci -Ama
131 adding b/z
131 adding b/z
132
132
133
133
134 qinit
134 qinit
135
135
136 $ hg qinit
136 $ hg qinit
137
137
138 $ cd ..
138 $ cd ..
139 $ hg init b
139 $ hg init b
140
140
141
141
142 -R qinit
142 -R qinit
143
143
144 $ hg -R b qinit
144 $ hg -R b qinit
145
145
146 $ hg init c
146 $ hg init c
147
147
148
148
149 qinit -c
149 qinit -c
150
150
151 $ hg --cwd c qinit -c
151 $ hg --cwd c qinit -c
152 $ hg -R c/.hg/patches st
152 $ hg -R c/.hg/patches st
153 A .hgignore
153 A .hgignore
154 A series
154 A series
155
155
156
156
157 qinit; qinit -c
157 qinit; qinit -c
158
158
159 $ hg init d
159 $ hg init d
160 $ cd d
160 $ cd d
161 $ hg qinit
161 $ hg qinit
162 $ hg qinit -c
162 $ hg qinit -c
163
163
164 qinit -c should create both files if they don't exist
164 qinit -c should create both files if they don't exist
165
165
166 $ cat .hg/patches/.hgignore
166 $ cat .hg/patches/.hgignore
167 ^\.hg
167 ^\.hg
168 ^\.mq
168 ^\.mq
169 syntax: glob
169 syntax: glob
170 status
170 status
171 guards
171 guards
172 $ cat .hg/patches/series
172 $ cat .hg/patches/series
173 $ hg qinit -c
173 $ hg qinit -c
174 abort: repository $TESTTMP/d/.hg/patches already exists
174 abort: repository $TESTTMP/d/.hg/patches already exists
175 [255]
175 [255]
176 $ cd ..
176 $ cd ..
177
177
178 $ echo '% qinit; <stuff>; qinit -c'
178 $ echo '% qinit; <stuff>; qinit -c'
179 % qinit; <stuff>; qinit -c
179 % qinit; <stuff>; qinit -c
180 $ hg init e
180 $ hg init e
181 $ cd e
181 $ cd e
182 $ hg qnew A
182 $ hg qnew A
183 $ checkundo qnew
183 $ checkundo qnew
184 $ echo foo > foo
184 $ echo foo > foo
185 $ hg phase -r qbase
185 $ hg phase -r qbase
186 0: draft
186 0: draft
187 $ hg add foo
187 $ hg add foo
188 $ hg qrefresh
188 $ hg qrefresh
189 $ hg phase -r qbase
189 $ hg phase -r qbase
190 0: draft
190 0: draft
191 $ hg qnew B
191 $ hg qnew B
192 $ echo >> foo
192 $ echo >> foo
193 $ hg qrefresh
193 $ hg qrefresh
194 $ echo status >> .hg/patches/.hgignore
194 $ echo status >> .hg/patches/.hgignore
195 $ echo bleh >> .hg/patches/.hgignore
195 $ echo bleh >> .hg/patches/.hgignore
196 $ hg qinit -c
196 $ hg qinit -c
197 adding .hg/patches/A
197 adding .hg/patches/A
198 adding .hg/patches/B
198 adding .hg/patches/B
199 $ hg -R .hg/patches status
199 $ hg -R .hg/patches status
200 A .hgignore
200 A .hgignore
201 A A
201 A A
202 A B
202 A B
203 A series
203 A series
204
204
205 qinit -c shouldn't touch these files if they already exist
205 qinit -c shouldn't touch these files if they already exist
206
206
207 $ cat .hg/patches/.hgignore
207 $ cat .hg/patches/.hgignore
208 status
208 status
209 bleh
209 bleh
210 $ cat .hg/patches/series
210 $ cat .hg/patches/series
211 A
211 A
212 B
212 B
213
213
214 add an untracked file
214 add an untracked file
215
215
216 $ echo >> .hg/patches/flaf
216 $ echo >> .hg/patches/flaf
217
217
218 status --mq with color (issue2096)
218 status --mq with color (issue2096)
219
219
220 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
220 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
221 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
221 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
222 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
222 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
223 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
223 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
224 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
224 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
225 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
225 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
226
226
227 try the --mq option on a command provided by an extension
227 try the --mq option on a command provided by an extension
228
228
229 $ hg purge --mq --verbose --config extensions.purge=
229 $ hg purge --mq --verbose --config extensions.purge=
230 removing file flaf
230 removing file flaf
231
231
232 $ cd ..
232 $ cd ..
233
233
234 #if no-outer-repo
234 #if no-outer-repo
235
235
236 init --mq without repo
236 init --mq without repo
237
237
238 $ mkdir f
238 $ mkdir f
239 $ cd f
239 $ cd f
240 $ hg init --mq
240 $ hg init --mq
241 abort: there is no Mercurial repository here (.hg not found)
241 abort: there is no Mercurial repository here (.hg not found)
242 [255]
242 [255]
243 $ cd ..
243 $ cd ..
244
244
245 #endif
245 #endif
246
246
247 init --mq with repo path
247 init --mq with repo path
248
248
249 $ hg init g
249 $ hg init g
250 $ hg init --mq g
250 $ hg init --mq g
251 $ test -d g/.hg/patches/.hg
251 $ test -d g/.hg/patches/.hg
252
252
253 init --mq with nonexistent directory
253 init --mq with nonexistent directory
254
254
255 $ hg init --mq nonexistentdir
255 $ hg init --mq nonexistentdir
256 abort: repository nonexistentdir not found
256 abort: repository nonexistentdir not found
257 [255]
257 [255]
258
258
259
259
260 init --mq with bundle (non "local")
260 init --mq with bundle (non "local")
261
261
262 $ hg -R a bundle --all a.bundle >/dev/null
262 $ hg -R a bundle --all a.bundle >/dev/null
263 $ hg init --mq a.bundle
263 $ hg init --mq a.bundle
264 abort: only a local queue repository may be initialized
264 abort: only a local queue repository may be initialized
265 [255]
265 [255]
266
266
267 $ cd a
267 $ cd a
268
268
269 $ hg qnew -m 'foo bar' test.patch
269 $ hg qnew -m 'foo bar' test.patch
270
270
271 $ echo '# comment' > .hg/patches/series.tmp
271 $ echo '# comment' > .hg/patches/series.tmp
272 $ echo >> .hg/patches/series.tmp # empty line
272 $ echo >> .hg/patches/series.tmp # empty line
273 $ cat .hg/patches/series >> .hg/patches/series.tmp
273 $ cat .hg/patches/series >> .hg/patches/series.tmp
274 $ mv .hg/patches/series.tmp .hg/patches/series
274 $ mv .hg/patches/series.tmp .hg/patches/series
275
275
276
276
277 qrefresh
277 qrefresh
278
278
279 $ echo a >> a
279 $ echo a >> a
280 $ hg qrefresh
280 $ hg qrefresh
281 $ cat .hg/patches/test.patch
281 $ cat .hg/patches/test.patch
282 foo bar
282 foo bar
283
283
284 diff -r [a-f0-9]* a (re)
284 diff -r [a-f0-9]* a (re)
285 --- a/a\t(?P<date>.*) (re)
285 --- a/a\t(?P<date>.*) (re)
286 \+\+\+ b/a\t(?P<date2>.*) (re)
286 \+\+\+ b/a\t(?P<date2>.*) (re)
287 @@ -1,1 +1,2 @@
287 @@ -1,1 +1,2 @@
288 a
288 a
289 +a
289 +a
290
290
291 empty qrefresh
291 empty qrefresh
292
292
293 $ hg qrefresh -X a
293 $ hg qrefresh -X a
294
294
295 revision:
295 revision:
296
296
297 $ hg diff -r -2 -r -1
297 $ hg diff -r -2 -r -1
298
298
299 patch:
299 patch:
300
300
301 $ cat .hg/patches/test.patch
301 $ cat .hg/patches/test.patch
302 foo bar
302 foo bar
303
303
304
304
305 working dir diff:
305 working dir diff:
306
306
307 $ hg diff --nodates -q
307 $ hg diff --nodates -q
308 diff -r dde259bd5934 a
308 diff -r dde259bd5934 a
309 --- a/a
309 --- a/a
310 +++ b/a
310 +++ b/a
311 @@ -1,1 +1,2 @@
311 @@ -1,1 +1,2 @@
312 a
312 a
313 +a
313 +a
314
314
315 restore things
315 restore things
316
316
317 $ hg qrefresh
317 $ hg qrefresh
318 $ checkundo qrefresh
318 $ checkundo qrefresh
319
319
320
320
321 qpop
321 qpop
322
322
323 $ hg qpop
323 $ hg qpop
324 popping test.patch
324 popping test.patch
325 patch queue now empty
325 patch queue now empty
326 $ checkundo qpop
326 $ checkundo qpop
327
327
328
328
329 qpush with dump of tag cache
329 qpush with dump of tag cache
330 Dump the tag cache to ensure that it has exactly one head after qpush.
330 Dump the tag cache to ensure that it has exactly one head after qpush.
331
331
332 $ rm -f .hg/cache/tags2-visible
332 $ rm -f .hg/cache/tags2-visible
333 $ hg tags > /dev/null
333 $ hg tags > /dev/null
334
334
335 .hg/cache/tags2-visible (pre qpush):
335 .hg/cache/tags2-visible (pre qpush):
336
336
337 $ cat .hg/cache/tags2-visible
337 $ cat .hg/cache/tags2-visible
338 1 [\da-f]{40} (re)
338 1 [\da-f]{40} (re)
339 $ hg qpush
339 $ hg qpush
340 applying test.patch
340 applying test.patch
341 now at: test.patch
341 now at: test.patch
342 $ hg phase -r qbase
342 $ hg phase -r qbase
343 2: draft
343 2: draft
344 $ hg tags > /dev/null
344 $ hg tags > /dev/null
345
345
346 .hg/cache/tags2-visible (post qpush):
346 .hg/cache/tags2-visible (post qpush):
347
347
348 $ cat .hg/cache/tags2-visible
348 $ cat .hg/cache/tags2-visible
349 2 [\da-f]{40} (re)
349 2 [\da-f]{40} (re)
350 $ checkundo qpush
350 $ checkundo qpush
351 $ cd ..
351 $ cd ..
352
352
353
353
354 pop/push outside repo
354 pop/push outside repo
355 $ hg -R a qpop
355 $ hg -R a qpop
356 popping test.patch
356 popping test.patch
357 patch queue now empty
357 patch queue now empty
358 $ hg -R a qpush
358 $ hg -R a qpush
359 applying test.patch
359 applying test.patch
360 now at: test.patch
360 now at: test.patch
361
361
362 $ cd a
362 $ cd a
363 $ hg qnew test2.patch
363 $ hg qnew test2.patch
364
364
365 qrefresh in subdir
365 qrefresh in subdir
366
366
367 $ cd b
367 $ cd b
368 $ echo a > a
368 $ echo a > a
369 $ hg add a
369 $ hg add a
370 $ hg qrefresh
370 $ hg qrefresh
371
371
372 pop/push -a in subdir
372 pop/push -a in subdir
373
373
374 $ hg qpop -a
374 $ hg qpop -a
375 popping test2.patch
375 popping test2.patch
376 popping test.patch
376 popping test.patch
377 patch queue now empty
377 patch queue now empty
378 $ hg --traceback qpush -a
378 $ hg --traceback qpush -a
379 applying test.patch
379 applying test.patch
380 applying test2.patch
380 applying test2.patch
381 now at: test2.patch
381 now at: test2.patch
382
382
383
383
384 setting columns & formatted tests truncating (issue1912)
384 setting columns & formatted tests truncating (issue1912)
385
385
386 $ COLUMNS=4 hg qseries --config ui.formatted=true --color=no
386 $ COLUMNS=4 hg qseries --config ui.formatted=true --color=no
387 test.patch
387 test.patch
388 test2.patch
388 test2.patch
389 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs --color=no
389 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs --color=no
390 0 A test.patch: f...
390 0 A test.patch: f...
391 1 A test2.patch:
391 1 A test2.patch:
392 $ hg qpop
392 $ hg qpop
393 popping test2.patch
393 popping test2.patch
394 now at: test.patch
394 now at: test.patch
395 $ hg qseries -vs
395 $ hg qseries -vs
396 0 A test.patch: foo bar
396 0 A test.patch: foo bar
397 1 U test2.patch:
397 1 U test2.patch:
398 $ hg sum | grep mq
398 $ hg sum | grep mq
399 mq: 1 applied, 1 unapplied
399 mq: 1 applied, 1 unapplied
400 $ hg qpush
400 $ hg qpush
401 applying test2.patch
401 applying test2.patch
402 now at: test2.patch
402 now at: test2.patch
403 $ hg sum | grep mq
403 $ hg sum | grep mq
404 mq: 2 applied
404 mq: 2 applied
405 $ hg qapplied
405 $ hg qapplied
406 test.patch
406 test.patch
407 test2.patch
407 test2.patch
408 $ hg qtop
408 $ hg qtop
409 test2.patch
409 test2.patch
410
410
411
411
412 prev
412 prev
413
413
414 $ hg qapp -1
414 $ hg qapp -1
415 test.patch
415 test.patch
416
416
417 next
417 next
418
418
419 $ hg qunapp -1
419 $ hg qunapp -1
420 all patches applied
420 all patches applied
421 [1]
421 [1]
422
422
423 $ hg qpop
423 $ hg qpop
424 popping test2.patch
424 popping test2.patch
425 now at: test.patch
425 now at: test.patch
426
426
427 commit should fail
427 commit should fail
428
428
429 $ hg commit
429 $ hg commit
430 abort: cannot commit over an applied mq patch
430 abort: cannot commit over an applied mq patch
431 [255]
431 [255]
432
432
433 push should fail if draft
433 push should fail if draft
434
434
435 $ hg push ../../k
435 $ hg push ../../k
436 pushing to ../../k
436 pushing to ../../k
437 abort: source has mq patches applied
437 abort: source has mq patches applied
438 [255]
438 [255]
439
439
440
440
441 import should fail
441 import should fail
442
442
443 $ hg st .
443 $ hg st .
444 $ echo foo >> ../a
444 $ echo foo >> ../a
445 $ hg diff > ../../import.diff
445 $ hg diff > ../../import.diff
446 $ hg revert --no-backup ../a
446 $ hg revert --no-backup ../a
447 $ hg import ../../import.diff
447 $ hg import ../../import.diff
448 abort: cannot import over an applied patch
448 abort: cannot import over an applied patch
449 [255]
449 [255]
450 $ hg st
450 $ hg st
451
451
452 import --no-commit should succeed
452 import --no-commit should succeed
453
453
454 $ hg import --no-commit ../../import.diff
454 $ hg import --no-commit ../../import.diff
455 applying ../../import.diff
455 applying ../../import.diff
456 $ hg st
456 $ hg st
457 M a
457 M a
458 $ hg revert --no-backup ../a
458 $ hg revert --no-backup ../a
459
459
460
460
461 qunapplied
461 qunapplied
462
462
463 $ hg qunapplied
463 $ hg qunapplied
464 test2.patch
464 test2.patch
465
465
466
466
467 qpush/qpop with index
467 qpush/qpop with index
468
468
469 $ hg qnew test1b.patch
469 $ hg qnew test1b.patch
470 $ echo 1b > 1b
470 $ echo 1b > 1b
471 $ hg add 1b
471 $ hg add 1b
472 $ hg qrefresh
472 $ hg qrefresh
473 $ hg qpush 2
473 $ hg qpush 2
474 applying test2.patch
474 applying test2.patch
475 now at: test2.patch
475 now at: test2.patch
476 $ hg qpop 0
476 $ hg qpop 0
477 popping test2.patch
477 popping test2.patch
478 popping test1b.patch
478 popping test1b.patch
479 now at: test.patch
479 now at: test.patch
480 $ hg qpush test.patch+1
480 $ hg qpush test.patch+1
481 applying test1b.patch
481 applying test1b.patch
482 now at: test1b.patch
482 now at: test1b.patch
483 $ hg qpush test.patch+2
483 $ hg qpush test.patch+2
484 applying test2.patch
484 applying test2.patch
485 now at: test2.patch
485 now at: test2.patch
486 $ hg qpop test2.patch-1
486 $ hg qpop test2.patch-1
487 popping test2.patch
487 popping test2.patch
488 now at: test1b.patch
488 now at: test1b.patch
489 $ hg qpop test2.patch-2
489 $ hg qpop test2.patch-2
490 popping test1b.patch
490 popping test1b.patch
491 now at: test.patch
491 now at: test.patch
492 $ hg qpush test1b.patch+1
492 $ hg qpush test1b.patch+1
493 applying test1b.patch
493 applying test1b.patch
494 applying test2.patch
494 applying test2.patch
495 now at: test2.patch
495 now at: test2.patch
496
496
497
497
498 qpush --move
498 qpush --move
499
499
500 $ hg qpop -a
500 $ hg qpop -a
501 popping test2.patch
501 popping test2.patch
502 popping test1b.patch
502 popping test1b.patch
503 popping test.patch
503 popping test.patch
504 patch queue now empty
504 patch queue now empty
505 $ hg qguard test1b.patch -- -negguard
505 $ hg qguard test1b.patch -- -negguard
506 $ hg qguard test2.patch -- +posguard
506 $ hg qguard test2.patch -- +posguard
507 $ hg qpush --move test2.patch # can't move guarded patch
507 $ hg qpush --move test2.patch # can't move guarded patch
508 cannot push 'test2.patch' - guarded by '+posguard'
508 cannot push 'test2.patch' - guarded by '+posguard'
509 [1]
509 [1]
510 $ hg qselect posguard
510 $ hg qselect posguard
511 number of unguarded, unapplied patches has changed from 2 to 3
511 number of unguarded, unapplied patches has changed from 2 to 3
512 $ hg qpush --move test2.patch # move to front
512 $ hg qpush --move test2.patch # move to front
513 applying test2.patch
513 applying test2.patch
514 now at: test2.patch
514 now at: test2.patch
515 $ hg qpush --move test1b.patch # negative guard unselected
515 $ hg qpush --move test1b.patch # negative guard unselected
516 applying test1b.patch
516 applying test1b.patch
517 now at: test1b.patch
517 now at: test1b.patch
518 $ hg qpush --move test.patch # noop move
518 $ hg qpush --move test.patch # noop move
519 applying test.patch
519 applying test.patch
520 now at: test.patch
520 now at: test.patch
521 $ hg qseries -v
521 $ hg qseries -v
522 0 A test2.patch
522 0 A test2.patch
523 1 A test1b.patch
523 1 A test1b.patch
524 2 A test.patch
524 2 A test.patch
525 $ hg qpop -a
525 $ hg qpop -a
526 popping test.patch
526 popping test.patch
527 popping test1b.patch
527 popping test1b.patch
528 popping test2.patch
528 popping test2.patch
529 patch queue now empty
529 patch queue now empty
530
530
531 cleaning up
531 cleaning up
532
532
533 $ hg qselect --none
533 $ hg qselect --none
534 guards deactivated
534 guards deactivated
535 number of unguarded, unapplied patches has changed from 3 to 2
535 number of unguarded, unapplied patches has changed from 3 to 2
536 $ hg qguard --none test1b.patch
536 $ hg qguard --none test1b.patch
537 $ hg qguard --none test2.patch
537 $ hg qguard --none test2.patch
538 $ hg qpush --move test.patch
538 $ hg qpush --move test.patch
539 applying test.patch
539 applying test.patch
540 now at: test.patch
540 now at: test.patch
541 $ hg qpush --move test1b.patch
541 $ hg qpush --move test1b.patch
542 applying test1b.patch
542 applying test1b.patch
543 now at: test1b.patch
543 now at: test1b.patch
544 $ hg qpush --move bogus # nonexistent patch
544 $ hg qpush --move bogus # nonexistent patch
545 abort: patch bogus not in series
545 abort: patch bogus not in series
546 [255]
546 [255]
547 $ hg qpush --move # no patch
547 $ hg qpush --move # no patch
548 abort: please specify the patch to move
548 abort: please specify the patch to move
549 [255]
549 [255]
550 $ hg qpush --move test.patch # already applied
550 $ hg qpush --move test.patch # already applied
551 abort: cannot push to a previous patch: test.patch
551 abort: cannot push to a previous patch: test.patch
552 [255]
552 [255]
553 $ sed '2i\
553 $ sed '2i\
554 > # make qtip index different in series and fullseries
554 > # make qtip index different in series and fullseries
555 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
555 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
556 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
556 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
557 $ cat `hg root`/.hg/patches/series
557 $ cat `hg root`/.hg/patches/series
558 # comment
558 # comment
559 # make qtip index different in series and fullseries
559 # make qtip index different in series and fullseries
560
560
561 test.patch
561 test.patch
562 test1b.patch
562 test1b.patch
563 test2.patch
563 test2.patch
564 $ hg qpush --move test2.patch
564 $ hg qpush --move test2.patch
565 applying test2.patch
565 applying test2.patch
566 now at: test2.patch
566 now at: test2.patch
567
567
568
568
569 series after move
569 series after move
570
570
571 $ cat `hg root`/.hg/patches/series
571 $ cat `hg root`/.hg/patches/series
572 # comment
572 # comment
573 # make qtip index different in series and fullseries
573 # make qtip index different in series and fullseries
574
574
575 test.patch
575 test.patch
576 test1b.patch
576 test1b.patch
577 test2.patch
577 test2.patch
578
578
579
579
580 pop, qapplied, qunapplied
580 pop, qapplied, qunapplied
581
581
582 $ hg qseries -v
582 $ hg qseries -v
583 0 A test.patch
583 0 A test.patch
584 1 A test1b.patch
584 1 A test1b.patch
585 2 A test2.patch
585 2 A test2.patch
586
586
587 qapplied -1 test.patch
587 qapplied -1 test.patch
588
588
589 $ hg qapplied -1 test.patch
589 $ hg qapplied -1 test.patch
590 only one patch applied
590 only one patch applied
591 [1]
591 [1]
592
592
593 qapplied -1 test1b.patch
593 qapplied -1 test1b.patch
594
594
595 $ hg qapplied -1 test1b.patch
595 $ hg qapplied -1 test1b.patch
596 test.patch
596 test.patch
597
597
598 qapplied -1 test2.patch
598 qapplied -1 test2.patch
599
599
600 $ hg qapplied -1 test2.patch
600 $ hg qapplied -1 test2.patch
601 test1b.patch
601 test1b.patch
602
602
603 qapplied -1
603 qapplied -1
604
604
605 $ hg qapplied -1
605 $ hg qapplied -1
606 test1b.patch
606 test1b.patch
607
607
608 qapplied
608 qapplied
609
609
610 $ hg qapplied
610 $ hg qapplied
611 test.patch
611 test.patch
612 test1b.patch
612 test1b.patch
613 test2.patch
613 test2.patch
614
614
615 qapplied test1b.patch
615 qapplied test1b.patch
616
616
617 $ hg qapplied test1b.patch
617 $ hg qapplied test1b.patch
618 test.patch
618 test.patch
619 test1b.patch
619 test1b.patch
620
620
621 qunapplied -1
621 qunapplied -1
622
622
623 $ hg qunapplied -1
623 $ hg qunapplied -1
624 all patches applied
624 all patches applied
625 [1]
625 [1]
626
626
627 qunapplied
627 qunapplied
628
628
629 $ hg qunapplied
629 $ hg qunapplied
630
630
631 popping
631 popping
632
632
633 $ hg qpop
633 $ hg qpop
634 popping test2.patch
634 popping test2.patch
635 now at: test1b.patch
635 now at: test1b.patch
636
636
637 qunapplied -1
637 qunapplied -1
638
638
639 $ hg qunapplied -1
639 $ hg qunapplied -1
640 test2.patch
640 test2.patch
641
641
642 qunapplied
642 qunapplied
643
643
644 $ hg qunapplied
644 $ hg qunapplied
645 test2.patch
645 test2.patch
646
646
647 qunapplied test2.patch
647 qunapplied test2.patch
648
648
649 $ hg qunapplied test2.patch
649 $ hg qunapplied test2.patch
650
650
651 qunapplied -1 test2.patch
651 qunapplied -1 test2.patch
652
652
653 $ hg qunapplied -1 test2.patch
653 $ hg qunapplied -1 test2.patch
654 all patches applied
654 all patches applied
655 [1]
655 [1]
656
656
657 popping -a
657 popping -a
658
658
659 $ hg qpop -a
659 $ hg qpop -a
660 popping test1b.patch
660 popping test1b.patch
661 popping test.patch
661 popping test.patch
662 patch queue now empty
662 patch queue now empty
663
663
664 qapplied
664 qapplied
665
665
666 $ hg qapplied
666 $ hg qapplied
667
667
668 qapplied -1
668 qapplied -1
669
669
670 $ hg qapplied -1
670 $ hg qapplied -1
671 no patches applied
671 no patches applied
672 [1]
672 [1]
673 $ hg qpush
673 $ hg qpush
674 applying test.patch
674 applying test.patch
675 now at: test.patch
675 now at: test.patch
676
676
677
677
678 push should succeed
678 push should succeed
679
679
680 $ hg qpop -a
680 $ hg qpop -a
681 popping test.patch
681 popping test.patch
682 patch queue now empty
682 patch queue now empty
683 $ hg push ../../k
683 $ hg push ../../k
684 pushing to ../../k
684 pushing to ../../k
685 searching for changes
685 searching for changes
686 adding changesets
686 adding changesets
687 adding manifests
687 adding manifests
688 adding file changes
688 adding file changes
689 added 1 changesets with 1 changes to 1 files
689 added 1 changesets with 1 changes to 1 files
690
690
691
691
692 we want to start with some patches applied
692 we want to start with some patches applied
693
693
694 $ hg qpush -a
694 $ hg qpush -a
695 applying test.patch
695 applying test.patch
696 applying test1b.patch
696 applying test1b.patch
697 applying test2.patch
697 applying test2.patch
698 now at: test2.patch
698 now at: test2.patch
699
699
700 % pops all patches and succeeds
700 % pops all patches and succeeds
701
701
702 $ hg qpop -a
702 $ hg qpop -a
703 popping test2.patch
703 popping test2.patch
704 popping test1b.patch
704 popping test1b.patch
705 popping test.patch
705 popping test.patch
706 patch queue now empty
706 patch queue now empty
707
707
708 % does nothing and succeeds
708 % does nothing and succeeds
709
709
710 $ hg qpop -a
710 $ hg qpop -a
711 no patches applied
711 no patches applied
712
712
713 % fails - nothing else to pop
713 % fails - nothing else to pop
714
714
715 $ hg qpop
715 $ hg qpop
716 no patches applied
716 no patches applied
717 [1]
717 [1]
718
718
719 % pushes a patch and succeeds
719 % pushes a patch and succeeds
720
720
721 $ hg qpush
721 $ hg qpush
722 applying test.patch
722 applying test.patch
723 now at: test.patch
723 now at: test.patch
724
724
725 % pops a patch and succeeds
725 % pops a patch and succeeds
726
726
727 $ hg qpop
727 $ hg qpop
728 popping test.patch
728 popping test.patch
729 patch queue now empty
729 patch queue now empty
730
730
731 % pushes up to test1b.patch and succeeds
731 % pushes up to test1b.patch and succeeds
732
732
733 $ hg qpush test1b.patch
733 $ hg qpush test1b.patch
734 applying test.patch
734 applying test.patch
735 applying test1b.patch
735 applying test1b.patch
736 now at: test1b.patch
736 now at: test1b.patch
737
737
738 % does nothing and succeeds
738 % does nothing and succeeds
739
739
740 $ hg qpush test1b.patch
740 $ hg qpush test1b.patch
741 qpush: test1b.patch is already at the top
741 qpush: test1b.patch is already at the top
742
742
743 % does nothing and succeeds
743 % does nothing and succeeds
744
744
745 $ hg qpop test1b.patch
745 $ hg qpop test1b.patch
746 qpop: test1b.patch is already at the top
746 qpop: test1b.patch is already at the top
747
747
748 % fails - can't push to this patch
748 % fails - can't push to this patch
749
749
750 $ hg qpush test.patch
750 $ hg qpush test.patch
751 abort: cannot push to a previous patch: test.patch
751 abort: cannot push to a previous patch: test.patch
752 [255]
752 [255]
753
753
754 % fails - can't pop to this patch
754 % fails - can't pop to this patch
755
755
756 $ hg qpop test2.patch
756 $ hg qpop test2.patch
757 abort: patch test2.patch is not applied
757 abort: patch test2.patch is not applied
758 [255]
758 [255]
759
759
760 % pops up to test.patch and succeeds
760 % pops up to test.patch and succeeds
761
761
762 $ hg qpop test.patch
762 $ hg qpop test.patch
763 popping test1b.patch
763 popping test1b.patch
764 now at: test.patch
764 now at: test.patch
765
765
766 % pushes all patches and succeeds
766 % pushes all patches and succeeds
767
767
768 $ hg qpush -a
768 $ hg qpush -a
769 applying test1b.patch
769 applying test1b.patch
770 applying test2.patch
770 applying test2.patch
771 now at: test2.patch
771 now at: test2.patch
772
772
773 % does nothing and succeeds
773 % does nothing and succeeds
774
774
775 $ hg qpush -a
775 $ hg qpush -a
776 all patches are currently applied
776 all patches are currently applied
777
777
778 % fails - nothing else to push
778 % fails - nothing else to push
779
779
780 $ hg qpush
780 $ hg qpush
781 patch series already fully applied
781 patch series already fully applied
782 [1]
782 [1]
783
783
784 % does nothing and succeeds
784 % does nothing and succeeds
785
785
786 $ hg qpush test2.patch
786 $ hg qpush test2.patch
787 qpush: test2.patch is already at the top
787 qpush: test2.patch is already at the top
788
788
789 strip
789 strip
790
790
791 $ cd ../../b
791 $ cd ../../b
792 $ echo x>x
792 $ echo x>x
793 $ hg ci -Ama
793 $ hg ci -Ama
794 adding x
794 adding x
795 $ hg strip tip
795 $ hg strip tip
796 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
796 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
797 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
797 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
798 $ hg unbundle .hg/strip-backup/*
798 $ hg unbundle .hg/strip-backup/*
799 adding changesets
799 adding changesets
800 adding manifests
800 adding manifests
801 adding file changes
801 adding file changes
802 added 1 changesets with 1 changes to 1 files
802 added 1 changesets with 1 changes to 1 files
803 new changesets 770eb8fce608 (1 drafts)
803 new changesets 770eb8fce608 (1 drafts)
804 (run 'hg update' to get a working copy)
804 (run 'hg update' to get a working copy)
805
805
806
806
807 strip with local changes, should complain
807 strip with local changes, should complain
808
808
809 $ hg up
809 $ hg up
810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
811 $ echo y>y
811 $ echo y>y
812 $ hg add y
812 $ hg add y
813 $ hg strip tip
813 $ hg strip tip
814 abort: uncommitted changes
814 abort: uncommitted changes
815 [20]
815 [20]
816
816
817 --force strip with local changes
817 --force strip with local changes
818
818
819 $ hg strip -f tip
819 $ hg strip -f tip
820 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
820 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
821 saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg
821 saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg
822 $ cd ..
822 $ cd ..
823
823
824
824
825 cd b; hg qrefresh
825 cd b; hg qrefresh
826
826
827 $ hg init refresh
827 $ hg init refresh
828 $ cd refresh
828 $ cd refresh
829 $ echo a > a
829 $ echo a > a
830 $ hg ci -Ama
830 $ hg ci -Ama
831 adding a
831 adding a
832 $ hg qnew -mfoo foo
832 $ hg qnew -mfoo foo
833 $ echo a >> a
833 $ echo a >> a
834 $ hg qrefresh
834 $ hg qrefresh
835 $ mkdir b
835 $ mkdir b
836 $ cd b
836 $ cd b
837 $ echo f > f
837 $ echo f > f
838 $ hg add f
838 $ hg add f
839 $ hg qrefresh
839 $ hg qrefresh
840 $ cat ../.hg/patches/foo
840 $ cat ../.hg/patches/foo
841 foo
841 foo
842
842
843 diff -r cb9a9f314b8b a
843 diff -r cb9a9f314b8b a
844 --- a/a\t(?P<date>.*) (re)
844 --- a/a\t(?P<date>.*) (re)
845 \+\+\+ b/a\t(?P<date>.*) (re)
845 \+\+\+ b/a\t(?P<date>.*) (re)
846 @@ -1,1 +1,2 @@
846 @@ -1,1 +1,2 @@
847 a
847 a
848 +a
848 +a
849 diff -r cb9a9f314b8b b/f
849 diff -r cb9a9f314b8b b/f
850 --- /dev/null\t(?P<date>.*) (re)
850 --- /dev/null\t(?P<date>.*) (re)
851 \+\+\+ b/b/f\t(?P<date>.*) (re)
851 \+\+\+ b/b/f\t(?P<date>.*) (re)
852 @@ -0,0 +1,1 @@
852 @@ -0,0 +1,1 @@
853 +f
853 +f
854
854
855 hg qrefresh .
855 hg qrefresh .
856
856
857 $ hg qrefresh .
857 $ hg qrefresh .
858 $ cat ../.hg/patches/foo
858 $ cat ../.hg/patches/foo
859 foo
859 foo
860
860
861 diff -r cb9a9f314b8b b/f
861 diff -r cb9a9f314b8b b/f
862 --- /dev/null\t(?P<date>.*) (re)
862 --- /dev/null\t(?P<date>.*) (re)
863 \+\+\+ b/b/f\t(?P<date>.*) (re)
863 \+\+\+ b/b/f\t(?P<date>.*) (re)
864 @@ -0,0 +1,1 @@
864 @@ -0,0 +1,1 @@
865 +f
865 +f
866 $ hg status
866 $ hg status
867 M a
867 M a
868
868
869
869
870 qpush failure
870 qpush failure
871
871
872 $ cd ..
872 $ cd ..
873 $ hg qrefresh
873 $ hg qrefresh
874 $ hg qnew -mbar bar
874 $ hg qnew -mbar bar
875 $ echo foo > foo
875 $ echo foo > foo
876 $ echo bar > bar
876 $ echo bar > bar
877 $ hg add foo bar
877 $ hg add foo bar
878 $ hg qrefresh
878 $ hg qrefresh
879 $ hg qpop -a
879 $ hg qpop -a
880 popping bar
880 popping bar
881 popping foo
881 popping foo
882 patch queue now empty
882 patch queue now empty
883 $ echo bar > foo
883 $ echo bar > foo
884 $ hg qpush -a
884 $ hg qpush -a
885 applying foo
885 applying foo
886 applying bar
886 applying bar
887 file foo already exists
887 file foo already exists
888 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
888 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
889 patch failed, unable to continue (try -v)
889 patch failed, unable to continue (try -v)
890 patch failed, rejects left in working directory
890 patch failed, rejects left in working directory
891 errors during apply, please fix and qrefresh bar
891 errors during apply, please fix and qrefresh bar
892 [2]
892 [2]
893 $ hg st
893 $ hg st
894 ? foo
894 ? foo
895 ? foo.rej
895 ? foo.rej
896
896
897
897
898 mq tags
898 mq tags
899
899
900 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
900 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
901 0 qparent
901 0 qparent
902 1 foo qbase
902 1 foo qbase
903 2 bar qtip tip
903 2 bar qtip tip
904
904
905 mq revset
905 mq revset
906
906
907 $ hg log -r 'mq()' --template '{rev}\n'
907 $ hg log -r 'mq()' --template '{rev}\n'
908 1
908 1
909 2
909 2
910 $ hg help revisions.mq
910 $ hg help revisions.mq
911 "mq()"
911 "mq()"
912 Changesets managed by MQ.
912 Changesets managed by MQ.
913
913
914
914
915 bad node in status
915 bad node in status
916
916
917 $ hg qpop
917 $ hg qpop
918 popping bar
918 popping bar
919 now at: foo
919 now at: foo
920 $ hg strip -qn tip
920 $ hg strip -qn tip
921 $ hg tip
921 $ hg tip
922 changeset: 0:cb9a9f314b8b
922 changeset: 0:cb9a9f314b8b
923 tag: tip
923 tag: tip
924 user: test
924 user: test
925 date: Thu Jan 01 00:00:00 1970 +0000
925 date: Thu Jan 01 00:00:00 1970 +0000
926 summary: a
926 summary: a
927
927
928 $ hg branches
928 $ hg branches
929 default 0:cb9a9f314b8b
929 default 0:cb9a9f314b8b
930 $ hg qpop
930 $ hg qpop
931 no patches applied
931 no patches applied
932 [1]
932 [1]
933
933
934 $ cd ..
934 $ cd ..
935
935
936
936
937 git patches
937 git patches
938
938
939 $ cat >>$HGRCPATH <<EOF
939 $ cat >>$HGRCPATH <<EOF
940 > [diff]
940 > [diff]
941 > git = True
941 > git = True
942 > EOF
942 > EOF
943 $ hg init git
943 $ hg init git
944 $ cd git
944 $ cd git
945 $ hg qinit
945 $ hg qinit
946
946
947 $ hg qnew -m'new file' new
947 $ hg qnew -m'new file' new
948 $ echo foo > new
948 $ echo foo > new
949 #if execbit
949 #if execbit
950 $ chmod +x new
950 $ chmod +x new
951 #endif
951 #endif
952 $ hg add new
952 $ hg add new
953 $ hg qrefresh
953 $ hg qrefresh
954
954
955 $ cat .hg/patches/new
955 $ cat .hg/patches/new
956 new file
956 new file
957
957
958 diff --git a/new b/new
958 diff --git a/new b/new
959 new file mode 100755 (execbit !)
959 new file mode 100755 (execbit !)
960 new file mode 100644 (no-execbit !)
960 new file mode 100644 (no-execbit !)
961 --- /dev/null
961 --- /dev/null
962 +++ b/new
962 +++ b/new
963 @@ -0,0 +1,1 @@
963 @@ -0,0 +1,1 @@
964 +foo
964 +foo
965
965
966 $ hg qnew -m'copy file' copy
966 $ hg qnew -m'copy file' copy
967 $ hg cp new copy
967 $ hg cp new copy
968 $ hg qrefresh
968 $ hg qrefresh
969 $ cat .hg/patches/copy
969 $ cat .hg/patches/copy
970 copy file
970 copy file
971
971
972 diff --git a/new b/copy
972 diff --git a/new b/copy
973 copy from new
973 copy from new
974 copy to copy
974 copy to copy
975
975
976 $ hg qpop
976 $ hg qpop
977 popping copy
977 popping copy
978 now at: new
978 now at: new
979 $ hg qpush
979 $ hg qpush
980 applying copy
980 applying copy
981 now at: copy
981 now at: copy
982 $ hg qdiff
982 $ hg qdiff
983 diff --git a/new b/copy
983 diff --git a/new b/copy
984 copy from new
984 copy from new
985 copy to copy
985 copy to copy
986 $ cat >>$HGRCPATH <<EOF
986 $ cat >>$HGRCPATH <<EOF
987 > [diff]
987 > [diff]
988 > git = False
988 > git = False
989 > EOF
989 > EOF
990 $ hg qdiff --git
990 $ hg qdiff --git
991 diff --git a/new b/copy
991 diff --git a/new b/copy
992 copy from new
992 copy from new
993 copy to copy
993 copy to copy
994 $ cd ..
994 $ cd ..
995
995
996 empty lines in status
996 empty lines in status
997
997
998 $ hg init emptystatus
998 $ hg init emptystatus
999 $ cd emptystatus
999 $ cd emptystatus
1000 $ hg qinit
1000 $ hg qinit
1001 $ printf '\n\n' > .hg/patches/status
1001 $ printf '\n\n' > .hg/patches/status
1002 $ hg qser
1002 $ hg qser
1003 $ cd ..
1003 $ cd ..
1004
1004
1005 bad line in status (without ":")
1005 bad line in status (without ":")
1006
1006
1007 $ hg init badstatus
1007 $ hg init badstatus
1008 $ cd badstatus
1008 $ cd badstatus
1009 $ hg qinit
1009 $ hg qinit
1010 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1010 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1011 $ hg qser
1011 $ hg qser
1012 malformated mq status line: ['babar has no colon in this line']
1012 malformated mq status line: ['babar has no colon in this line']
1013 $ cd ..
1013 $ cd ..
1014
1014
1015
1015
1016 test file addition in slow path
1016 test file addition in slow path
1017
1017
1018 $ hg init slow
1018 $ hg init slow
1019 $ cd slow
1019 $ cd slow
1020 $ hg qinit
1020 $ hg qinit
1021 $ echo foo > foo
1021 $ echo foo > foo
1022 $ hg add foo
1022 $ hg add foo
1023 $ hg ci -m 'add foo'
1023 $ hg ci -m 'add foo'
1024 $ hg qnew bar
1024 $ hg qnew bar
1025 $ echo bar > bar
1025 $ echo bar > bar
1026 $ hg add bar
1026 $ hg add bar
1027 $ hg mv foo baz
1027 $ hg mv foo baz
1028 $ hg qrefresh --git
1028 $ hg qrefresh --git
1029 $ hg up -C 0
1029 $ hg up -C 0
1030 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1030 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1031 $ echo >> foo
1031 $ echo >> foo
1032 $ hg ci -m 'change foo'
1032 $ hg ci -m 'change foo'
1033 created new head
1033 created new head
1034 $ hg up -C 1
1034 $ hg up -C 1
1035 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1035 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1036 $ hg qrefresh --git
1036 $ hg qrefresh --git
1037 $ cat .hg/patches/bar
1037 $ cat .hg/patches/bar
1038 diff --git a/bar b/bar
1038 diff --git a/bar b/bar
1039 new file mode 100644
1039 new file mode 100644
1040 --- /dev/null
1040 --- /dev/null
1041 +++ b/bar
1041 +++ b/bar
1042 @@ -0,0 +1,1 @@
1042 @@ -0,0 +1,1 @@
1043 +bar
1043 +bar
1044 diff --git a/foo b/baz
1044 diff --git a/foo b/baz
1045 rename from foo
1045 rename from foo
1046 rename to baz
1046 rename to baz
1047 $ hg log -v --template '{rev} {file_copies}\n' -r .
1047 $ hg log -v --template '{rev} {file_copies}\n' -r .
1048 2 baz (foo)
1048 2 baz (foo)
1049 $ hg qrefresh --git
1049 $ hg qrefresh --git
1050 $ cat .hg/patches/bar
1050 $ cat .hg/patches/bar
1051 diff --git a/bar b/bar
1051 diff --git a/bar b/bar
1052 new file mode 100644
1052 new file mode 100644
1053 --- /dev/null
1053 --- /dev/null
1054 +++ b/bar
1054 +++ b/bar
1055 @@ -0,0 +1,1 @@
1055 @@ -0,0 +1,1 @@
1056 +bar
1056 +bar
1057 diff --git a/foo b/baz
1057 diff --git a/foo b/baz
1058 rename from foo
1058 rename from foo
1059 rename to baz
1059 rename to baz
1060 $ hg log -v --template '{rev} {file_copies}\n' -r .
1060 $ hg log -v --template '{rev} {file_copies}\n' -r .
1061 2 baz (foo)
1061 2 baz (foo)
1062 $ hg qrefresh
1062 $ hg qrefresh
1063 $ grep 'diff --git' .hg/patches/bar
1063 $ grep 'diff --git' .hg/patches/bar
1064 diff --git a/bar b/bar
1064 diff --git a/bar b/bar
1065 diff --git a/foo b/baz
1065 diff --git a/foo b/baz
1066
1066
1067
1067
1068 test file move chains in the slow path
1068 test file move chains in the slow path
1069
1069
1070 $ hg up -C 1
1070 $ hg up -C 1
1071 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1071 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1072 $ echo >> foo
1072 $ echo >> foo
1073 $ hg ci -m 'change foo again'
1073 $ hg ci -m 'change foo again'
1074 $ hg up -C 2
1074 $ hg up -C 2
1075 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1075 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1076 $ hg mv bar quux
1076 $ hg mv bar quux
1077 $ hg mv baz bleh
1077 $ hg mv baz bleh
1078 $ hg qrefresh --git
1078 $ hg qrefresh --git
1079 $ cat .hg/patches/bar
1079 $ cat .hg/patches/bar
1080 diff --git a/foo b/bleh
1080 diff --git a/foo b/bleh
1081 rename from foo
1081 rename from foo
1082 rename to bleh
1082 rename to bleh
1083 diff --git a/quux b/quux
1083 diff --git a/quux b/quux
1084 new file mode 100644
1084 new file mode 100644
1085 --- /dev/null
1085 --- /dev/null
1086 +++ b/quux
1086 +++ b/quux
1087 @@ -0,0 +1,1 @@
1087 @@ -0,0 +1,1 @@
1088 +bar
1088 +bar
1089 $ hg log -v --template '{rev} {file_copies}\n' -r .
1089 $ hg log -v --template '{rev} {file_copies}\n' -r .
1090 3 bleh (foo)
1090 3 bleh (foo)
1091 $ hg mv quux fred
1091 $ hg mv quux fred
1092 $ hg mv bleh barney
1092 $ hg mv bleh barney
1093 $ hg qrefresh --git
1093 $ hg qrefresh --git
1094 $ cat .hg/patches/bar
1094 $ cat .hg/patches/bar
1095 diff --git a/foo b/barney
1095 diff --git a/foo b/barney
1096 rename from foo
1096 rename from foo
1097 rename to barney
1097 rename to barney
1098 diff --git a/fred b/fred
1098 diff --git a/fred b/fred
1099 new file mode 100644
1099 new file mode 100644
1100 --- /dev/null
1100 --- /dev/null
1101 +++ b/fred
1101 +++ b/fred
1102 @@ -0,0 +1,1 @@
1102 @@ -0,0 +1,1 @@
1103 +bar
1103 +bar
1104 $ hg log -v --template '{rev} {file_copies}\n' -r .
1104 $ hg log -v --template '{rev} {file_copies}\n' -r .
1105 3 barney (foo)
1105 3 barney (foo)
1106
1106
1107
1107
1108 refresh omitting an added file
1108 refresh omitting an added file
1109
1109
1110 $ hg qnew baz
1110 $ hg qnew baz
1111 $ echo newfile > newfile
1111 $ echo newfile > newfile
1112 $ hg add newfile
1112 $ hg add newfile
1113 $ hg qrefresh
1113 $ hg qrefresh
1114 $ hg st -A newfile
1114 $ hg st -A newfile
1115 C newfile
1115 C newfile
1116 $ hg qrefresh -X newfile
1116 $ hg qrefresh -X newfile
1117 $ hg st -A newfile
1117 $ hg st -A newfile
1118 A newfile
1118 A newfile
1119 $ hg revert newfile
1119 $ hg revert newfile
1120 $ rm newfile
1120 $ rm newfile
1121 $ hg qpop
1121 $ hg qpop
1122 popping baz
1122 popping baz
1123 now at: bar
1123 now at: bar
1124
1124
1125 test qdel/qrm
1125 test qdel/qrm
1126
1126
1127 $ hg qdel baz
1127 $ hg qdel baz
1128 $ echo p >> .hg/patches/series
1128 $ echo p >> .hg/patches/series
1129 $ hg qrm p
1129 $ hg qrm p
1130 $ hg qser
1130 $ hg qser
1131 bar
1131 bar
1132
1132
1133 create a git patch
1133 create a git patch
1134
1134
1135 $ echo a > alexander
1135 $ echo a > alexander
1136 $ hg add alexander
1136 $ hg add alexander
1137 $ hg qnew -f --git addalexander
1137 $ hg qnew -f --git addalexander
1138 $ grep diff .hg/patches/addalexander
1138 $ grep diff .hg/patches/addalexander
1139 diff --git a/alexander b/alexander
1139 diff --git a/alexander b/alexander
1140
1140
1141
1141
1142 create a git binary patch
1142 create a git binary patch
1143
1143
1144 $ cat > writebin.py <<EOF
1144 $ cat > writebin.py <<EOF
1145 > import sys
1145 > import sys
1146 > path = sys.argv[1]
1146 > path = sys.argv[1]
1147 > open(path, 'wb').write(b'BIN\x00ARY')
1147 > open(path, 'wb').write(b'BIN\x00ARY')
1148 > EOF
1148 > EOF
1149 $ "$PYTHON" writebin.py bucephalus
1149 $ "$PYTHON" writebin.py bucephalus
1150
1150
1151 $ "$PYTHON" "$TESTDIR/md5sum.py" bucephalus
1151 $ "$PYTHON" "$TESTDIR/md5sum.py" bucephalus
1152 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1152 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1153 $ hg add bucephalus
1153 $ hg add bucephalus
1154 $ hg qnew -f --git addbucephalus
1154 $ hg qnew -f --git addbucephalus
1155 $ grep diff .hg/patches/addbucephalus
1155 $ grep diff .hg/patches/addbucephalus
1156 diff --git a/bucephalus b/bucephalus
1156 diff --git a/bucephalus b/bucephalus
1157
1157
1158
1158
1159 check binary patches can be popped and pushed
1159 check binary patches can be popped and pushed
1160
1160
1161 $ hg qpop
1161 $ hg qpop
1162 popping addbucephalus
1162 popping addbucephalus
1163 now at: addalexander
1163 now at: addalexander
1164 $ test -f bucephalus && echo % bucephalus should not be there
1164 $ test -f bucephalus && echo % bucephalus should not be there
1165 [1]
1165 [1]
1166 $ hg qpush
1166 $ hg qpush
1167 applying addbucephalus
1167 applying addbucephalus
1168 now at: addbucephalus
1168 now at: addbucephalus
1169 $ test -f bucephalus
1169 $ test -f bucephalus
1170 $ "$PYTHON" "$TESTDIR/md5sum.py" bucephalus
1170 $ "$PYTHON" "$TESTDIR/md5sum.py" bucephalus
1171 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1171 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1172
1172
1173
1173
1174
1174
1175 strip again
1175 strip again
1176
1176
1177 $ cd ..
1177 $ cd ..
1178 $ hg init strip
1178 $ hg init strip
1179 $ cd strip
1179 $ cd strip
1180 $ touch foo
1180 $ touch foo
1181 $ hg add foo
1181 $ hg add foo
1182 $ hg ci -m 'add foo'
1182 $ hg ci -m 'add foo'
1183 $ echo >> foo
1183 $ echo >> foo
1184 $ hg ci -m 'change foo 1'
1184 $ hg ci -m 'change foo 1'
1185 $ hg up -C 0
1185 $ hg up -C 0
1186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1187 $ echo 1 >> foo
1187 $ echo 1 >> foo
1188 $ hg ci -m 'change foo 2'
1188 $ hg ci -m 'change foo 2'
1189 created new head
1189 created new head
1190 $ HGMERGE=true hg merge
1190 $ HGMERGE=true hg merge
1191 merging foo
1191 merging foo
1192 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1192 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1193 (branch merge, don't forget to commit)
1193 (branch merge, don't forget to commit)
1194 $ hg ci -m merge
1194 $ hg ci -m merge
1195 $ hg log
1195 $ hg log
1196 changeset: 3:99615015637b
1196 changeset: 3:99615015637b
1197 tag: tip
1197 tag: tip
1198 parent: 2:20cbbe65cff7
1198 parent: 2:20cbbe65cff7
1199 parent: 1:d2871fc282d4
1199 parent: 1:d2871fc282d4
1200 user: test
1200 user: test
1201 date: Thu Jan 01 00:00:00 1970 +0000
1201 date: Thu Jan 01 00:00:00 1970 +0000
1202 summary: merge
1202 summary: merge
1203
1203
1204 changeset: 2:20cbbe65cff7
1204 changeset: 2:20cbbe65cff7
1205 parent: 0:53245c60e682
1205 parent: 0:53245c60e682
1206 user: test
1206 user: test
1207 date: Thu Jan 01 00:00:00 1970 +0000
1207 date: Thu Jan 01 00:00:00 1970 +0000
1208 summary: change foo 2
1208 summary: change foo 2
1209
1209
1210 changeset: 1:d2871fc282d4
1210 changeset: 1:d2871fc282d4
1211 user: test
1211 user: test
1212 date: Thu Jan 01 00:00:00 1970 +0000
1212 date: Thu Jan 01 00:00:00 1970 +0000
1213 summary: change foo 1
1213 summary: change foo 1
1214
1214
1215 changeset: 0:53245c60e682
1215 changeset: 0:53245c60e682
1216 user: test
1216 user: test
1217 date: Thu Jan 01 00:00:00 1970 +0000
1217 date: Thu Jan 01 00:00:00 1970 +0000
1218 summary: add foo
1218 summary: add foo
1219
1219
1220 $ hg strip 1
1220 $ hg strip 1
1221 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1221 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1222 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1222 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1223 $ checkundo strip
1223 $ checkundo strip
1224 $ hg log
1224 $ hg log
1225 changeset: 1:20cbbe65cff7
1225 changeset: 1:20cbbe65cff7
1226 tag: tip
1226 tag: tip
1227 user: test
1227 user: test
1228 date: Thu Jan 01 00:00:00 1970 +0000
1228 date: Thu Jan 01 00:00:00 1970 +0000
1229 summary: change foo 2
1229 summary: change foo 2
1230
1230
1231 changeset: 0:53245c60e682
1231 changeset: 0:53245c60e682
1232 user: test
1232 user: test
1233 date: Thu Jan 01 00:00:00 1970 +0000
1233 date: Thu Jan 01 00:00:00 1970 +0000
1234 summary: add foo
1234 summary: add foo
1235
1235
1236 $ cd ..
1236 $ cd ..
1237
1237
1238
1238
1239 qclone
1239 qclone
1240
1240
1241 $ qlog()
1241 $ qlog()
1242 > {
1242 > {
1243 > echo 'main repo:'
1243 > echo 'main repo:'
1244 > hg log --template ' rev {rev}: {desc}\n'
1244 > hg log --template ' rev {rev}: {desc}\n'
1245 > echo 'patch repo:'
1245 > echo 'patch repo:'
1246 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1246 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1247 > }
1247 > }
1248 $ hg init qclonesource
1248 $ hg init qclonesource
1249 $ cd qclonesource
1249 $ cd qclonesource
1250 $ echo foo > foo
1250 $ echo foo > foo
1251 $ hg add foo
1251 $ hg add foo
1252 $ hg ci -m 'add foo'
1252 $ hg ci -m 'add foo'
1253 $ hg qinit
1253 $ hg qinit
1254 $ hg qnew patch1
1254 $ hg qnew patch1
1255 $ echo bar >> foo
1255 $ echo bar >> foo
1256 $ hg qrefresh -m 'change foo'
1256 $ hg qrefresh -m 'change foo'
1257 $ cd ..
1257 $ cd ..
1258
1258
1259
1259
1260 repo with unversioned patch dir
1260 repo with unversioned patch dir
1261
1261
1262 $ hg qclone qclonesource failure
1262 $ hg qclone qclonesource failure
1263 abort: versioned patch repository not found (see init --mq)
1263 abort: versioned patch repository not found (see init --mq)
1264 [255]
1264 [255]
1265
1265
1266 $ cd qclonesource
1266 $ cd qclonesource
1267 $ hg qinit -c
1267 $ hg qinit -c
1268 adding .hg/patches/patch1
1268 adding .hg/patches/patch1
1269 $ hg qci -m checkpoint
1269 $ hg qci -m checkpoint
1270 $ qlog
1270 $ qlog
1271 main repo:
1271 main repo:
1272 rev 1: change foo
1272 rev 1: change foo
1273 rev 0: add foo
1273 rev 0: add foo
1274 patch repo:
1274 patch repo:
1275 rev 0: checkpoint
1275 rev 0: checkpoint
1276 $ cd ..
1276 $ cd ..
1277
1277
1278
1278
1279 repo with patches applied
1279 repo with patches applied
1280
1280
1281 $ hg qclone qclonesource qclonedest
1281 $ hg qclone qclonesource qclonedest
1282 updating to branch default
1282 updating to branch default
1283 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1283 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1285 $ cd qclonedest
1285 $ cd qclonedest
1286 $ qlog
1286 $ qlog
1287 main repo:
1287 main repo:
1288 rev 0: add foo
1288 rev 0: add foo
1289 patch repo:
1289 patch repo:
1290 rev 0: checkpoint
1290 rev 0: checkpoint
1291 $ cd ..
1291 $ cd ..
1292
1292
1293
1293
1294 repo with patches unapplied
1294 repo with patches unapplied
1295
1295
1296 $ cd qclonesource
1296 $ cd qclonesource
1297 $ hg qpop -a
1297 $ hg qpop -a
1298 popping patch1
1298 popping patch1
1299 patch queue now empty
1299 patch queue now empty
1300 $ qlog
1300 $ qlog
1301 main repo:
1301 main repo:
1302 rev 0: add foo
1302 rev 0: add foo
1303 patch repo:
1303 patch repo:
1304 rev 0: checkpoint
1304 rev 0: checkpoint
1305 $ cd ..
1305 $ cd ..
1306 $ hg qclone qclonesource qclonedest2
1306 $ hg qclone qclonesource qclonedest2
1307 updating to branch default
1307 updating to branch default
1308 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1308 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1309 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1309 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1310 $ cd qclonedest2
1310 $ cd qclonedest2
1311 $ qlog
1311 $ qlog
1312 main repo:
1312 main repo:
1313 rev 0: add foo
1313 rev 0: add foo
1314 patch repo:
1314 patch repo:
1315 rev 0: checkpoint
1315 rev 0: checkpoint
1316 $ cd ..
1316 $ cd ..
1317
1317
1318
1318
1319 Issue1033: test applying on an empty file
1319 Issue1033: test applying on an empty file
1320
1320
1321 $ hg init empty
1321 $ hg init empty
1322 $ cd empty
1322 $ cd empty
1323 $ touch a
1323 $ touch a
1324 $ hg ci -Am addempty
1324 $ hg ci -Am addempty
1325 adding a
1325 adding a
1326 $ echo a > a
1326 $ echo a > a
1327 $ hg qnew -f -e changea
1327 $ hg qnew -f -e changea
1328 $ hg qpop
1328 $ hg qpop
1329 popping changea
1329 popping changea
1330 patch queue now empty
1330 patch queue now empty
1331 $ hg qpush
1331 $ hg qpush
1332 applying changea
1332 applying changea
1333 now at: changea
1333 now at: changea
1334 $ cd ..
1334 $ cd ..
1335
1335
1336 test qpush with --force, issue1087
1336 test qpush with --force, issue1087
1337
1337
1338 $ hg init forcepush
1338 $ hg init forcepush
1339 $ cd forcepush
1339 $ cd forcepush
1340 $ echo hello > hello.txt
1340 $ echo hello > hello.txt
1341 $ echo bye > bye.txt
1341 $ echo bye > bye.txt
1342 $ hg ci -Ama
1342 $ hg ci -Ama
1343 adding bye.txt
1343 adding bye.txt
1344 adding hello.txt
1344 adding hello.txt
1345 $ hg qnew -d '0 0' empty
1345 $ hg qnew -d '0 0' empty
1346 $ hg qpop
1346 $ hg qpop
1347 popping empty
1347 popping empty
1348 patch queue now empty
1348 patch queue now empty
1349 $ echo world >> hello.txt
1349 $ echo world >> hello.txt
1350
1350
1351
1351
1352 qpush should fail, local changes
1352 qpush should fail, local changes
1353
1353
1354 $ hg qpush
1354 $ hg qpush
1355 abort: local changes found
1355 abort: local changes found
1356 [255]
1356 [255]
1357
1357
1358
1358
1359 apply force, should not discard changes with empty patch
1359 apply force, should not discard changes with empty patch
1360
1360
1361 $ hg qpush -f
1361 $ hg qpush -f
1362 applying empty
1362 applying empty
1363 patch empty is empty
1363 patch empty is empty
1364 now at: empty
1364 now at: empty
1365 $ hg diff --config diff.nodates=True
1365 $ hg diff --config diff.nodates=True
1366 diff -r d58265112590 hello.txt
1366 diff -r d58265112590 hello.txt
1367 --- a/hello.txt
1367 --- a/hello.txt
1368 +++ b/hello.txt
1368 +++ b/hello.txt
1369 @@ -1,1 +1,2 @@
1369 @@ -1,1 +1,2 @@
1370 hello
1370 hello
1371 +world
1371 +world
1372 $ hg qdiff --config diff.nodates=True
1372 $ hg qdiff --config diff.nodates=True
1373 diff -r 9ecee4f634e3 hello.txt
1373 diff -r 9ecee4f634e3 hello.txt
1374 --- a/hello.txt
1374 --- a/hello.txt
1375 +++ b/hello.txt
1375 +++ b/hello.txt
1376 @@ -1,1 +1,2 @@
1376 @@ -1,1 +1,2 @@
1377 hello
1377 hello
1378 +world
1378 +world
1379 $ hg log -l1 -p
1379 $ hg log -l1 -p
1380 changeset: 1:d58265112590
1380 changeset: 1:d58265112590
1381 tag: empty
1381 tag: empty
1382 tag: qbase
1382 tag: qbase
1383 tag: qtip
1383 tag: qtip
1384 tag: tip
1384 tag: tip
1385 user: test
1385 user: test
1386 date: Thu Jan 01 00:00:00 1970 +0000
1386 date: Thu Jan 01 00:00:00 1970 +0000
1387 summary: imported patch empty
1387 summary: imported patch empty
1388
1388
1389
1389
1390 $ hg qref -d '0 0'
1390 $ hg qref -d '0 0'
1391 $ hg qpop
1391 $ hg qpop
1392 popping empty
1392 popping empty
1393 patch queue now empty
1393 patch queue now empty
1394 $ echo universe >> hello.txt
1394 $ echo universe >> hello.txt
1395 $ echo universe >> bye.txt
1395 $ echo universe >> bye.txt
1396
1396
1397
1397
1398 qpush should fail, local changes
1398 qpush should fail, local changes
1399
1399
1400 $ hg qpush
1400 $ hg qpush
1401 abort: local changes found
1401 abort: local changes found
1402 [255]
1402 [255]
1403
1403
1404
1404
1405 apply force, should discard changes in hello, but not bye
1405 apply force, should discard changes in hello, but not bye
1406
1406
1407 $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
1407 $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
1408 applying empty
1408 applying empty
1409 creating directory: $TESTTMP/forcepush/.hg/origbackups
1409 creating directory: $TESTTMP/forcepush/.hg/origbackups
1410 saving current version of hello.txt as .hg/origbackups/hello.txt
1410 saving current version of hello.txt as .hg/origbackups/hello.txt
1411 patching file hello.txt
1411 patching file hello.txt
1412 committing files:
1412 committing files:
1413 hello.txt
1413 hello.txt
1414 committing manifest
1414 committing manifest
1415 committing changelog
1415 committing changelog
1416 now at: empty
1416 now at: empty
1417 $ hg st
1417 $ hg st
1418 M bye.txt
1418 M bye.txt
1419 $ hg diff --config diff.nodates=True
1419 $ hg diff --config diff.nodates=True
1420 diff -r ba252371dbc1 bye.txt
1420 diff -r ba252371dbc1 bye.txt
1421 --- a/bye.txt
1421 --- a/bye.txt
1422 +++ b/bye.txt
1422 +++ b/bye.txt
1423 @@ -1,1 +1,2 @@
1423 @@ -1,1 +1,2 @@
1424 bye
1424 bye
1425 +universe
1425 +universe
1426 $ hg qdiff --config diff.nodates=True
1426 $ hg qdiff --config diff.nodates=True
1427 diff -r 9ecee4f634e3 bye.txt
1427 diff -r 9ecee4f634e3 bye.txt
1428 --- a/bye.txt
1428 --- a/bye.txt
1429 +++ b/bye.txt
1429 +++ b/bye.txt
1430 @@ -1,1 +1,2 @@
1430 @@ -1,1 +1,2 @@
1431 bye
1431 bye
1432 +universe
1432 +universe
1433 diff -r 9ecee4f634e3 hello.txt
1433 diff -r 9ecee4f634e3 hello.txt
1434 --- a/hello.txt
1434 --- a/hello.txt
1435 +++ b/hello.txt
1435 +++ b/hello.txt
1436 @@ -1,1 +1,3 @@
1436 @@ -1,1 +1,3 @@
1437 hello
1437 hello
1438 +world
1438 +world
1439 +universe
1439 +universe
1440
1440
1441 test that the previous call to qpush with -f (--force) and --config actually put
1441 test that the previous call to qpush with -f (--force) and --config actually put
1442 the orig files out of the working copy
1442 the orig files out of the working copy
1443 $ ls .hg/origbackups
1443 $ ls .hg/origbackups
1444 hello.txt
1444 hello.txt
1445
1445
1446 test popping revisions not in working dir ancestry
1446 test popping revisions not in working dir ancestry
1447
1447
1448 $ hg qseries -v
1448 $ hg qseries -v
1449 0 A empty
1449 0 A empty
1450 $ hg up qparent
1450 $ hg up qparent
1451 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1451 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1452 $ hg qpop
1452 $ hg qpop
1453 popping empty
1453 popping empty
1454 patch queue now empty
1454 patch queue now empty
1455
1455
1456 $ cd ..
1456 $ cd ..
1457 $ hg init deletion-order
1457 $ hg init deletion-order
1458 $ cd deletion-order
1458 $ cd deletion-order
1459
1459
1460 $ touch a
1460 $ touch a
1461 $ hg ci -Aqm0
1461 $ hg ci -Aqm0
1462
1462
1463 $ hg qnew rename-dir
1463 $ hg qnew rename-dir
1464 $ hg rm a
1464 $ hg rm a
1465 $ hg qrefresh
1465 $ hg qrefresh
1466
1466
1467 $ mkdir a b
1467 $ mkdir a b
1468 $ touch a/a b/b
1468 $ touch a/a b/b
1469 $ hg add -q a b
1469 $ hg add -q a b
1470 $ hg qrefresh
1470 $ hg qrefresh
1471
1471
1472
1472
1473 test popping must remove files added in subdirectories first
1473 test popping must remove files added in subdirectories first
1474
1474
1475 $ hg qpop
1475 $ hg qpop
1476 popping rename-dir
1476 popping rename-dir
1477 patch queue now empty
1477 patch queue now empty
1478 $ cd ..
1478 $ cd ..
1479
1479
1480
1480
1481 test case preservation through patch pushing especially on case
1481 test case preservation through patch pushing especially on case
1482 insensitive filesystem
1482 insensitive filesystem
1483
1483
1484 $ hg init casepreserve
1484 $ hg init casepreserve
1485 $ cd casepreserve
1485 $ cd casepreserve
1486
1486
1487 $ hg qnew add-file1
1487 $ hg qnew add-file1
1488 $ echo a > TeXtFiLe.TxT
1488 $ echo a > TeXtFiLe.TxT
1489 $ hg add TeXtFiLe.TxT
1489 $ hg add TeXtFiLe.TxT
1490 $ hg qrefresh
1490 $ hg qrefresh
1491
1491
1492 $ hg qnew add-file2
1492 $ hg qnew add-file2
1493 $ echo b > AnOtHeRFiLe.TxT
1493 $ echo b > AnOtHeRFiLe.TxT
1494 $ hg add AnOtHeRFiLe.TxT
1494 $ hg add AnOtHeRFiLe.TxT
1495 $ hg qrefresh
1495 $ hg qrefresh
1496
1496
1497 $ hg qnew modify-file
1497 $ hg qnew modify-file
1498 $ echo c >> AnOtHeRFiLe.TxT
1498 $ echo c >> AnOtHeRFiLe.TxT
1499 $ hg qrefresh
1499 $ hg qrefresh
1500
1500
1501 $ hg qapplied
1501 $ hg qapplied
1502 add-file1
1502 add-file1
1503 add-file2
1503 add-file2
1504 modify-file
1504 modify-file
1505 $ hg qpop -a
1505 $ hg qpop -a
1506 popping modify-file
1506 popping modify-file
1507 popping add-file2
1507 popping add-file2
1508 popping add-file1
1508 popping add-file1
1509 patch queue now empty
1509 patch queue now empty
1510
1510
1511 this qpush causes problems below, if case preservation on case
1511 this qpush causes problems below, if case preservation on case
1512 insensitive filesystem is not enough:
1512 insensitive filesystem is not enough:
1513 (1) unexpected "adding ..." messages are shown
1513 (1) unexpected "adding ..." messages are shown
1514 (2) patching fails in modification of (1) files
1514 (2) patching fails in modification of (1) files
1515
1515
1516 $ hg qpush -a
1516 $ hg qpush -a
1517 applying add-file1
1517 applying add-file1
1518 applying add-file2
1518 applying add-file2
1519 applying modify-file
1519 applying modify-file
1520 now at: modify-file
1520 now at: modify-file
1521
1521
1522 Proper phase default with mq:
1522 Proper phase default with mq:
1523
1523
1524 1. mq.secret=false
1524 1. mq.secret=false
1525
1525
1526 $ rm .hg/store/phaseroots
1526 $ rm .hg/store/phaseroots
1527 $ hg phase 'qparent::'
1527 $ hg phase 'qparent::'
1528 -1: public
1528 -1: public
1529 0: draft
1529 0: draft
1530 1: draft
1530 1: draft
1531 2: draft
1531 2: draft
1532 $ echo '[mq]' >> $HGRCPATH
1532 $ echo '[mq]' >> $HGRCPATH
1533 $ echo 'secret=true' >> $HGRCPATH
1533 $ echo 'secret=true' >> $HGRCPATH
1534 $ rm -f .hg/store/phaseroots
1534 $ rm -f .hg/store/phaseroots
1535 $ hg phase 'qparent::'
1535 $ hg phase 'qparent::'
1536 -1: public
1536 -1: public
1537 0: secret
1537 0: secret
1538 1: secret
1538 1: secret
1539 2: secret
1539 2: secret
1540
1540
1541 Test that qfinish change phase when mq.secret=true
1541 Test that qfinish change phase when mq.secret=true
1542
1542
1543 $ hg qfinish qbase
1543 $ hg qfinish qbase
1544 patch add-file1 finalized without changeset message
1544 patch add-file1 finalized without changeset message
1545 $ hg phase 'all()'
1545 $ hg phase 'all()'
1546 0: draft
1546 0: draft
1547 1: secret
1547 1: secret
1548 2: secret
1548 2: secret
1549
1549
1550 Test that qfinish respect phases.new-commit setting
1550 Test that qfinish respect phases.new-commit setting
1551
1551
1552 $ echo '[phases]' >> $HGRCPATH
1552 $ echo '[phases]' >> $HGRCPATH
1553 $ echo 'new-commit=secret' >> $HGRCPATH
1553 $ echo 'new-commit=secret' >> $HGRCPATH
1554 $ hg qfinish qbase
1554 $ hg qfinish qbase
1555 patch add-file2 finalized without changeset message
1555 patch add-file2 finalized without changeset message
1556 $ hg phase 'all()'
1556 $ hg phase 'all()'
1557 0: draft
1557 0: draft
1558 1: secret
1558 1: secret
1559 2: secret
1559 2: secret
1560
1560
1561 (restore env for next test)
1561 (restore env for next test)
1562
1562
1563 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1563 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1564 $ cp $TESTTMP/sedtmp $HGRCPATH
1564 $ cp $TESTTMP/sedtmp $HGRCPATH
1565 $ hg qimport -r 1 --name add-file2
1565 $ hg qimport -r 1 --name add-file2
1566
1566
1567 Test that qfinish preserve phase when mq.secret=false
1567 Test that qfinish preserve phase when mq.secret=false
1568
1568
1569 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1569 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1570 $ cp $TESTTMP/sedtmp $HGRCPATH
1570 $ cp $TESTTMP/sedtmp $HGRCPATH
1571 $ hg qfinish qbase
1571 $ hg qfinish qbase
1572 patch add-file2 finalized without changeset message
1572 patch add-file2 finalized without changeset message
1573 $ hg phase 'all()'
1573 $ hg phase 'all()'
1574 0: draft
1574 0: draft
1575 1: secret
1575 1: secret
1576 2: secret
1576 2: secret
1577
1577
1578 Test that secret mq patch does not break hgweb
1578 Test that secret mq patch does not break hgweb
1579
1579
1580 $ cat > hgweb.cgi <<HGWEB
1580 $ cat > hgweb.cgi <<HGWEB
1581 > from mercurial import demandimport; demandimport.enable()
1581 > from mercurial import demandimport; demandimport.enable()
1582 > from mercurial.hgweb import hgweb
1582 > from mercurial.hgweb import hgweb
1583 > from mercurial.hgweb import wsgicgi
1583 > from mercurial.hgweb import wsgicgi
1584 > import cgitb
1585 > cgitb.enable()
1586 > app = hgweb(b'.', b'test')
1584 > app = hgweb(b'.', b'test')
1587 > wsgicgi.launch(app)
1585 > wsgicgi.launch(app)
1588 > HGWEB
1586 > HGWEB
1589 $ . "$TESTDIR/cgienv"
1587 $ . "$TESTDIR/cgienv"
1590 #if msys
1588 #if msys
1591 $ PATH_INFO=//tags; export PATH_INFO
1589 $ PATH_INFO=//tags; export PATH_INFO
1592 #else
1590 #else
1593 $ PATH_INFO=/tags; export PATH_INFO
1591 $ PATH_INFO=/tags; export PATH_INFO
1594 #endif
1592 #endif
1595 $ QUERY_STRING='style=raw'
1593 $ QUERY_STRING='style=raw'
1596 $ "$PYTHON" hgweb.cgi | grep '^tip'
1594 $ "$PYTHON" hgweb.cgi | grep '^tip'
1597 tip [0-9a-f]{40} (re)
1595 tip [0-9a-f]{40} (re)
1598
1596
1599 $ cd ..
1597 $ cd ..
1600
1598
1601 Test interaction with revset (issue4426)
1599 Test interaction with revset (issue4426)
1602
1600
1603 $ hg init issue4426
1601 $ hg init issue4426
1604 $ cd issue4426
1602 $ cd issue4426
1605
1603
1606 $ echo a > a
1604 $ echo a > a
1607 $ hg ci -Am a
1605 $ hg ci -Am a
1608 adding a
1606 adding a
1609 $ echo a >> a
1607 $ echo a >> a
1610 $ hg ci -m a
1608 $ hg ci -m a
1611 $ echo a >> a
1609 $ echo a >> a
1612 $ hg ci -m a
1610 $ hg ci -m a
1613 $ hg qimport -r 0::
1611 $ hg qimport -r 0::
1614
1612
1615 reimport things
1613 reimport things
1616
1614
1617 $ hg qimport -r 1::
1615 $ hg qimport -r 1::
1618 abort: revision 2 is already managed
1616 abort: revision 2 is already managed
1619 [255]
1617 [255]
1620
1618
1621
1619
1622 $ cd ..
1620 $ cd ..
@@ -1,66 +1,60 b''
1 #require no-msys # MSYS will translate web paths as if they were file paths
1 #require no-msys # MSYS will translate web paths as if they were file paths
2
2
3 This tests if CGI files from after d0db3462d568 but
3 This tests if CGI files from after d0db3462d568 but
4 before d74fc8dec2b4 still work.
4 before d74fc8dec2b4 still work.
5
5
6 $ hg init test
6 $ hg init test
7 $ cat >hgweb.cgi <<HGWEB
7 $ cat >hgweb.cgi <<HGWEB
8 > #!$PYTHON
8 > #!$PYTHON
9 > #
9 > #
10 > # An example CGI script to use hgweb, edit as necessary
10 > # An example CGI script to use hgweb, edit as necessary
11 >
11 >
12 > import cgitb
13 > cgitb.enable()
14 >
15 > from mercurial import demandimport; demandimport.enable()
12 > from mercurial import demandimport; demandimport.enable()
16 > from mercurial.hgweb import hgweb
13 > from mercurial.hgweb import hgweb
17 > from mercurial.hgweb import wsgicgi
14 > from mercurial.hgweb import wsgicgi
18 > from mercurial.hgweb.request import wsgiapplication
15 > from mercurial.hgweb.request import wsgiapplication
19 >
16 >
20 > def make_web_app():
17 > def make_web_app():
21 > return hgweb(b"test", b"Empty test repository")
18 > return hgweb(b"test", b"Empty test repository")
22 >
19 >
23 > wsgicgi.launch(wsgiapplication(make_web_app))
20 > wsgicgi.launch(wsgiapplication(make_web_app))
24 > HGWEB
21 > HGWEB
25
22
26 $ chmod 755 hgweb.cgi
23 $ chmod 755 hgweb.cgi
27
24
28 $ cat >hgweb.config <<HGWEBDIRCONF
25 $ cat >hgweb.config <<HGWEBDIRCONF
29 > [paths]
26 > [paths]
30 > test = test
27 > test = test
31 > HGWEBDIRCONF
28 > HGWEBDIRCONF
32
29
33 $ cat >hgwebdir.cgi <<HGWEBDIR
30 $ cat >hgwebdir.cgi <<HGWEBDIR
34 > #!$PYTHON
31 > #!$PYTHON
35 > #
32 > #
36 > # An example CGI script to export multiple hgweb repos, edit as necessary
33 > # An example CGI script to export multiple hgweb repos, edit as necessary
37 >
34 >
38 > import cgitb
39 > cgitb.enable()
40 >
41 > from mercurial import demandimport; demandimport.enable()
35 > from mercurial import demandimport; demandimport.enable()
42 > from mercurial.hgweb import hgwebdir
36 > from mercurial.hgweb import hgwebdir
43 > from mercurial.hgweb import wsgicgi
37 > from mercurial.hgweb import wsgicgi
44 > from mercurial.hgweb.request import wsgiapplication
38 > from mercurial.hgweb.request import wsgiapplication
45 >
39 >
46 > def make_web_app():
40 > def make_web_app():
47 > return hgwebdir(b"hgweb.config")
41 > return hgwebdir(b"hgweb.config")
48 >
42 >
49 > wsgicgi.launch(wsgiapplication(make_web_app))
43 > wsgicgi.launch(wsgiapplication(make_web_app))
50 > HGWEBDIR
44 > HGWEBDIR
51
45
52 $ chmod 755 hgwebdir.cgi
46 $ chmod 755 hgwebdir.cgi
53
47
54 $ . "$TESTDIR/cgienv"
48 $ . "$TESTDIR/cgienv"
55 $ "$PYTHON" hgweb.cgi > page1
49 $ "$PYTHON" hgweb.cgi > page1
56 $ "$PYTHON" hgwebdir.cgi > page2
50 $ "$PYTHON" hgwebdir.cgi > page2
57
51
58 $ PATH_INFO="/test/"
52 $ PATH_INFO="/test/"
59 $ PATH_TRANSLATED="/var/something/test.cgi"
53 $ PATH_TRANSLATED="/var/something/test.cgi"
60 $ REQUEST_URI="/test/test/"
54 $ REQUEST_URI="/test/test/"
61 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
55 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
62 $ SCRIPT_URL="/test/test/"
56 $ SCRIPT_URL="/test/test/"
63 $ "$PYTHON" hgwebdir.cgi > page3
57 $ "$PYTHON" hgwebdir.cgi > page3
64
58
65 $ grep -i error page1 page2 page3
59 $ grep -i error page1 page2 page3
66 [1]
60 [1]
@@ -1,60 +1,54 b''
1 #require no-msys # MSYS will translate web paths as if they were file paths
1 #require no-msys # MSYS will translate web paths as if they were file paths
2
2
3 This is a rudimentary test of the CGI files as of d74fc8dec2b4.
3 This is a rudimentary test of the CGI files as of d74fc8dec2b4.
4
4
5 $ hg init test
5 $ hg init test
6
6
7 $ cat >hgweb.cgi <<HGWEB
7 $ cat >hgweb.cgi <<HGWEB
8 > #!$PYTHON
8 > #!$PYTHON
9 > #
9 > #
10 > # An example CGI script to use hgweb, edit as necessary
10 > # An example CGI script to use hgweb, edit as necessary
11 >
11 >
12 > import cgitb
13 > cgitb.enable()
14 >
15 > from mercurial import demandimport; demandimport.enable()
12 > from mercurial import demandimport; demandimport.enable()
16 > from mercurial.hgweb import hgweb
13 > from mercurial.hgweb import hgweb
17 > from mercurial.hgweb import wsgicgi
14 > from mercurial.hgweb import wsgicgi
18 >
15 >
19 > application = hgweb(b"test", b"Empty test repository")
16 > application = hgweb(b"test", b"Empty test repository")
20 > wsgicgi.launch(application)
17 > wsgicgi.launch(application)
21 > HGWEB
18 > HGWEB
22
19
23 $ chmod 755 hgweb.cgi
20 $ chmod 755 hgweb.cgi
24
21
25 $ cat >hgweb.config <<HGWEBDIRCONF
22 $ cat >hgweb.config <<HGWEBDIRCONF
26 > [paths]
23 > [paths]
27 > test = test
24 > test = test
28 > HGWEBDIRCONF
25 > HGWEBDIRCONF
29
26
30 $ cat >hgwebdir.cgi <<HGWEBDIR
27 $ cat >hgwebdir.cgi <<HGWEBDIR
31 > #!$PYTHON
28 > #!$PYTHON
32 > #
29 > #
33 > # An example CGI script to export multiple hgweb repos, edit as necessary
30 > # An example CGI script to export multiple hgweb repos, edit as necessary
34 >
31 >
35 > import cgitb
36 > cgitb.enable()
37 >
38 > from mercurial import demandimport; demandimport.enable()
32 > from mercurial import demandimport; demandimport.enable()
39 > from mercurial.hgweb import hgwebdir
33 > from mercurial.hgweb import hgwebdir
40 > from mercurial.hgweb import wsgicgi
34 > from mercurial.hgweb import wsgicgi
41 >
35 >
42 > application = hgwebdir(b"hgweb.config")
36 > application = hgwebdir(b"hgweb.config")
43 > wsgicgi.launch(application)
37 > wsgicgi.launch(application)
44 > HGWEBDIR
38 > HGWEBDIR
45
39
46 $ chmod 755 hgwebdir.cgi
40 $ chmod 755 hgwebdir.cgi
47
41
48 $ . "$TESTDIR/cgienv"
42 $ . "$TESTDIR/cgienv"
49 $ "$PYTHON" hgweb.cgi > page1
43 $ "$PYTHON" hgweb.cgi > page1
50 $ "$PYTHON" hgwebdir.cgi > page2
44 $ "$PYTHON" hgwebdir.cgi > page2
51
45
52 $ PATH_INFO="/test/"
46 $ PATH_INFO="/test/"
53 $ PATH_TRANSLATED="/var/something/test.cgi"
47 $ PATH_TRANSLATED="/var/something/test.cgi"
54 $ REQUEST_URI="/test/test/"
48 $ REQUEST_URI="/test/test/"
55 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
49 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
56 $ SCRIPT_URL="/test/test/"
50 $ SCRIPT_URL="/test/test/"
57 $ "$PYTHON" hgwebdir.cgi > page3
51 $ "$PYTHON" hgwebdir.cgi > page3
58
52
59 $ grep -i error page1 page2 page3
53 $ grep -i error page1 page2 page3
60 [1]
54 [1]
@@ -1,76 +1,74 b''
1 #require no-msys # MSYS will translate web paths as if they were file paths
1 #require no-msys # MSYS will translate web paths as if they were file paths
2
2
3 This tests if CGI files from before d0db3462d568 still work.
3 This tests if CGI files from before d0db3462d568 still work.
4
4
5 $ hg init test
5 $ hg init test
6 $ cat >hgweb.cgi <<HGWEB
6 $ cat >hgweb.cgi <<HGWEB
7 > #!"$PYTHON"
7 > #!"$PYTHON"
8 > #
8 > #
9 > # An example CGI script to use hgweb, edit as necessary
9 > # An example CGI script to use hgweb, edit as necessary
10 >
10 >
11 > import cgitb, os, sys
11 > import os, sys
12 > cgitb.enable()
13 >
12 >
14 > # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
13 > # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
15 > from mercurial import hgweb
14 > from mercurial import hgweb
16 >
15 >
17 > h = hgweb.hgweb(b"test", b"Empty test repository")
16 > h = hgweb.hgweb(b"test", b"Empty test repository")
18 > h.run()
17 > h.run()
19 > HGWEB
18 > HGWEB
20
19
21 $ chmod 755 hgweb.cgi
20 $ chmod 755 hgweb.cgi
22
21
23 $ cat >hgweb.config <<HGWEBDIRCONF
22 $ cat >hgweb.config <<HGWEBDIRCONF
24 > [paths]
23 > [paths]
25 > test = test
24 > test = test
26 > HGWEBDIRCONF
25 > HGWEBDIRCONF
27
26
28 $ cat >hgwebdir.cgi <<HGWEBDIR
27 $ cat >hgwebdir.cgi <<HGWEBDIR
29 > #!"$PYTHON"
28 > #!"$PYTHON"
30 > #
29 > #
31 > # An example CGI script to export multiple hgweb repos, edit as necessary
30 > # An example CGI script to export multiple hgweb repos, edit as necessary
32 >
31 >
33 > import cgitb, sys
32 > import sys
34 > cgitb.enable()
35 >
33 >
36 > # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
34 > # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
37 > from mercurial import hgweb
35 > from mercurial import hgweb
38 >
36 >
39 > # The config file looks like this. You can have paths to individual
37 > # The config file looks like this. You can have paths to individual
40 > # repos, collections of repos in a directory tree, or both.
38 > # repos, collections of repos in a directory tree, or both.
41 > #
39 > #
42 > # [paths]
40 > # [paths]
43 > # virtual/path = /real/path
41 > # virtual/path = /real/path
44 > # virtual/path = /real/path
42 > # virtual/path = /real/path
45 > #
43 > #
46 > # [collections]
44 > # [collections]
47 > # /prefix/to/strip/off = /root/of/tree/full/of/repos
45 > # /prefix/to/strip/off = /root/of/tree/full/of/repos
48 > #
46 > #
49 > # collections example: say directory tree /foo contains repos /foo/bar,
47 > # collections example: say directory tree /foo contains repos /foo/bar,
50 > # /foo/quux/baz. Give this config section:
48 > # /foo/quux/baz. Give this config section:
51 > # [collections]
49 > # [collections]
52 > # /foo = /foo
50 > # /foo = /foo
53 > # Then repos will list as bar and quux/baz.
51 > # Then repos will list as bar and quux/baz.
54 >
52 >
55 > # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
53 > # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
56 > # or use a dictionary with entries like 'virtual/path': '/real/path'
54 > # or use a dictionary with entries like 'virtual/path': '/real/path'
57 >
55 >
58 > h = hgweb.hgwebdir(b"hgweb.config")
56 > h = hgweb.hgwebdir(b"hgweb.config")
59 > h.run()
57 > h.run()
60 > HGWEBDIR
58 > HGWEBDIR
61
59
62 $ chmod 755 hgwebdir.cgi
60 $ chmod 755 hgwebdir.cgi
63
61
64 $ . "$TESTDIR/cgienv"
62 $ . "$TESTDIR/cgienv"
65 $ "$PYTHON" hgweb.cgi > page1
63 $ "$PYTHON" hgweb.cgi > page1
66 $ "$PYTHON" hgwebdir.cgi > page2
64 $ "$PYTHON" hgwebdir.cgi > page2
67
65
68 $ PATH_INFO="/test/"
66 $ PATH_INFO="/test/"
69 $ PATH_TRANSLATED="/var/something/test.cgi"
67 $ PATH_TRANSLATED="/var/something/test.cgi"
70 $ REQUEST_URI="/test/test/"
68 $ REQUEST_URI="/test/test/"
71 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
69 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
72 $ SCRIPT_URL="/test/test/"
70 $ SCRIPT_URL="/test/test/"
73 $ "$PYTHON" hgwebdir.cgi > page3
71 $ "$PYTHON" hgwebdir.cgi > page3
74
72
75 $ grep -i error page1 page2 page3
73 $ grep -i error page1 page2 page3
76 [1]
74 [1]
@@ -1,95 +1,93 b''
1 #require no-msys # MSYS will translate web paths as if they were file paths
1 #require no-msys # MSYS will translate web paths as if they were file paths
2
2
3 This is a test of the push wire protocol over CGI-based hgweb.
3 This is a test of the push wire protocol over CGI-based hgweb.
4
4
5 initialize repository
5 initialize repository
6
6
7 $ hg init r
7 $ hg init r
8 $ cd r
8 $ cd r
9 $ echo a > a
9 $ echo a > a
10 $ hg ci -A -m "0"
10 $ hg ci -A -m "0"
11 adding a
11 adding a
12 $ echo '[web]' > .hg/hgrc
12 $ echo '[web]' > .hg/hgrc
13 $ echo 'allow_push = *' >> .hg/hgrc
13 $ echo 'allow_push = *' >> .hg/hgrc
14 $ echo 'push_ssl = false' >> .hg/hgrc
14 $ echo 'push_ssl = false' >> .hg/hgrc
15
15
16 create hgweb invocation script
16 create hgweb invocation script
17
17
18 $ cat >hgweb.cgi <<HGWEB
18 $ cat >hgweb.cgi <<HGWEB
19 > import cgitb
20 > cgitb.enable()
21 > from mercurial import demandimport; demandimport.enable()
19 > from mercurial import demandimport; demandimport.enable()
22 > from mercurial.hgweb import hgweb
20 > from mercurial.hgweb import hgweb
23 > from mercurial.hgweb import wsgicgi
21 > from mercurial.hgweb import wsgicgi
24 > application = hgweb(b'.', b'test repository')
22 > application = hgweb(b'.', b'test repository')
25 > wsgicgi.launch(application)
23 > wsgicgi.launch(application)
26 > HGWEB
24 > HGWEB
27 $ chmod 755 hgweb.cgi
25 $ chmod 755 hgweb.cgi
28
26
29 test preparation
27 test preparation
30
28
31 $ . "$TESTDIR/cgienv"
29 $ . "$TESTDIR/cgienv"
32 $ REQUEST_METHOD="POST"; export REQUEST_METHOD
30 $ REQUEST_METHOD="POST"; export REQUEST_METHOD
33 $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE
31 $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE
34 $ hg bundle --type v1 --all bundle.hg
32 $ hg bundle --type v1 --all bundle.hg
35 1 changesets found
33 1 changesets found
36 $ CONTENT_LENGTH=279; export CONTENT_LENGTH;
34 $ CONTENT_LENGTH=279; export CONTENT_LENGTH;
37
35
38 expect failure because heads doesn't match (formerly known as 'unsynced changes')
36 expect failure because heads doesn't match (formerly known as 'unsynced changes')
39
37
40 $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING
38 $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING
41 $ "$PYTHON" hgweb.cgi <bundle.hg >page1 2>&1
39 $ "$PYTHON" hgweb.cgi <bundle.hg >page1 2>&1
42 $ cat page1
40 $ cat page1
43 Status: 200 Script output follows\r (esc)
41 Status: 200 Script output follows\r (esc)
44 Content-Type: application/mercurial-0.1\r (esc)
42 Content-Type: application/mercurial-0.1\r (esc)
45 Content-Length: 64\r (esc)
43 Content-Length: 64\r (esc)
46 \r (esc)
44 \r (esc)
47 0
45 0
48 repository changed while preparing changes - please try again
46 repository changed while preparing changes - please try again
49
47
50 successful force push
48 successful force push
51
49
52 $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING
50 $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING
53 $ "$PYTHON" hgweb.cgi <bundle.hg >page2 2>&1
51 $ "$PYTHON" hgweb.cgi <bundle.hg >page2 2>&1
54 $ cat page2
52 $ cat page2
55 Status: 200 Script output follows\r (esc)
53 Status: 200 Script output follows\r (esc)
56 Content-Type: application/mercurial-0.1\r (esc)
54 Content-Type: application/mercurial-0.1\r (esc)
57 Content-Length: 102\r (esc)
55 Content-Length: 102\r (esc)
58 \r (esc)
56 \r (esc)
59 1
57 1
60 adding changesets
58 adding changesets
61 adding manifests
59 adding manifests
62 adding file changes
60 adding file changes
63 added 0 changesets with 0 changes to 1 files
61 added 0 changesets with 0 changes to 1 files
64
62
65 successful push, list of heads
63 successful push, list of heads
66
64
67 $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING
65 $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING
68 $ "$PYTHON" hgweb.cgi <bundle.hg >page3 2>&1
66 $ "$PYTHON" hgweb.cgi <bundle.hg >page3 2>&1
69 $ cat page3
67 $ cat page3
70 Status: 200 Script output follows\r (esc)
68 Status: 200 Script output follows\r (esc)
71 Content-Type: application/mercurial-0.1\r (esc)
69 Content-Type: application/mercurial-0.1\r (esc)
72 Content-Length: 102\r (esc)
70 Content-Length: 102\r (esc)
73 \r (esc)
71 \r (esc)
74 1
72 1
75 adding changesets
73 adding changesets
76 adding manifests
74 adding manifests
77 adding file changes
75 adding file changes
78 added 0 changesets with 0 changes to 1 files
76 added 0 changesets with 0 changes to 1 files
79
77
80 successful push, SHA1 hash of heads (unbundlehash capability)
78 successful push, SHA1 hash of heads (unbundlehash capability)
81
79
82 $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING
80 $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING
83 $ "$PYTHON" hgweb.cgi <bundle.hg >page4 2>&1
81 $ "$PYTHON" hgweb.cgi <bundle.hg >page4 2>&1
84 $ cat page4
82 $ cat page4
85 Status: 200 Script output follows\r (esc)
83 Status: 200 Script output follows\r (esc)
86 Content-Type: application/mercurial-0.1\r (esc)
84 Content-Type: application/mercurial-0.1\r (esc)
87 Content-Length: 102\r (esc)
85 Content-Length: 102\r (esc)
88 \r (esc)
86 \r (esc)
89 1
87 1
90 adding changesets
88 adding changesets
91 adding manifests
89 adding manifests
92 adding file changes
90 adding file changes
93 added 0 changesets with 0 changes to 1 files
91 added 0 changesets with 0 changes to 1 files
94
92
95 $ cd ..
93 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now