##// END OF EJS Templates
tests: show cache of audited paths is never invalidated
Yuya Nishihara -
r33704:0134d839 stable
parent child Browse files
Show More
@@ -1,131 +1,232 b''
1 $ hg init
1 $ hg init
2
2
3 audit of .hg
3 audit of .hg
4
4
5 $ hg add .hg/00changelog.i
5 $ hg add .hg/00changelog.i
6 abort: path contains illegal component: .hg/00changelog.i (glob)
6 abort: path contains illegal component: .hg/00changelog.i (glob)
7 [255]
7 [255]
8
8
9 #if symlink
9 #if symlink
10
10
11 Symlinks
11 Symlinks
12
12
13 $ mkdir a
13 $ mkdir a
14 $ echo a > a/a
14 $ echo a > a/a
15 $ hg ci -Ama
15 $ hg ci -Ama
16 adding a/a
16 adding a/a
17 $ ln -s a b
17 $ ln -s a b
18 $ echo b > a/b
18 $ echo b > a/b
19 $ hg add b/b
19 $ hg add b/b
20 abort: path 'b/b' traverses symbolic link 'b' (glob)
20 abort: path 'b/b' traverses symbolic link 'b' (glob)
21 [255]
21 [255]
22 $ hg add b
22 $ hg add b
23
23
24 should still fail - maybe
24 should still fail - maybe
25
25
26 $ hg add b/b
26 $ hg add b/b
27 abort: path 'b/b' traverses symbolic link 'b' (glob)
27 abort: path 'b/b' traverses symbolic link 'b' (glob)
28 [255]
28 [255]
29
29
30 $ hg commit -m 'add symlink b'
30 $ hg commit -m 'add symlink b'
31
31
32
32
33 Test symlink traversing when accessing history:
33 Test symlink traversing when accessing history:
34 -----------------------------------------------
34 -----------------------------------------------
35
35
36 (build a changeset where the path exists as a directory)
36 (build a changeset where the path exists as a directory)
37
37
38 $ hg up 0
38 $ hg up 0
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
39 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
40 $ mkdir b
40 $ mkdir b
41 $ echo c > b/a
41 $ echo c > b/a
42 $ hg add b/a
42 $ hg add b/a
43 $ hg ci -m 'add directory b'
43 $ hg ci -m 'add directory b'
44 created new head
44 created new head
45
45
46 Test that hg cat does not do anything wrong the working copy has 'b' as directory
46 Test that hg cat does not do anything wrong the working copy has 'b' as directory
47
47
48 $ hg cat b/a
48 $ hg cat b/a
49 c
49 c
50 $ hg cat -r "desc(directory)" b/a
50 $ hg cat -r "desc(directory)" b/a
51 c
51 c
52 $ hg cat -r "desc(symlink)" b/a
52 $ hg cat -r "desc(symlink)" b/a
53 b/a: no such file in rev bc151a1f53bd
53 b/a: no such file in rev bc151a1f53bd
54 [1]
54 [1]
55
55
56 Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749)
56 Test that hg cat does not do anything wrong the working copy has 'b' as a symlink (issue4749)
57
57
58 $ hg up 'desc(symlink)'
58 $ hg up 'desc(symlink)'
59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
60 $ hg cat b/a
60 $ hg cat b/a
61 b/a: no such file in rev bc151a1f53bd
61 b/a: no such file in rev bc151a1f53bd
62 [1]
62 [1]
63 $ hg cat -r "desc(directory)" b/a
63 $ hg cat -r "desc(directory)" b/a
64 c
64 c
65 $ hg cat -r "desc(symlink)" b/a
65 $ hg cat -r "desc(symlink)" b/a
66 b/a: no such file in rev bc151a1f53bd
66 b/a: no such file in rev bc151a1f53bd
67 [1]
67 [1]
68
68
69 #endif
69 #endif
70
70
71
71
72 unbundle tampered bundle
72 unbundle tampered bundle
73
73
74 $ hg init target
74 $ hg init target
75 $ cd target
75 $ cd target
76 $ hg unbundle "$TESTDIR/bundles/tampered.hg"
76 $ hg unbundle "$TESTDIR/bundles/tampered.hg"
77 adding changesets
77 adding changesets
78 adding manifests
78 adding manifests
79 adding file changes
79 adding file changes
80 added 5 changesets with 6 changes to 6 files (+4 heads)
80 added 5 changesets with 6 changes to 6 files (+4 heads)
81 (run 'hg heads' to see heads, 'hg merge' to merge)
81 (run 'hg heads' to see heads, 'hg merge' to merge)
82
82
83 attack .hg/test
83 attack .hg/test
84
84
85 $ hg manifest -r0
85 $ hg manifest -r0
86 .hg/test
86 .hg/test
87 $ hg update -Cr0
87 $ hg update -Cr0
88 abort: path contains illegal component: .hg/test (glob)
88 abort: path contains illegal component: .hg/test (glob)
89 [255]
89 [255]
90
90
91 attack foo/.hg/test
91 attack foo/.hg/test
92
92
93 $ hg manifest -r1
93 $ hg manifest -r1
94 foo/.hg/test
94 foo/.hg/test
95 $ hg update -Cr1
95 $ hg update -Cr1
96 abort: path 'foo/.hg/test' is inside nested repo 'foo' (glob)
96 abort: path 'foo/.hg/test' is inside nested repo 'foo' (glob)
97 [255]
97 [255]
98
98
99 attack back/test where back symlinks to ..
99 attack back/test where back symlinks to ..
100
100
101 $ hg manifest -r2
101 $ hg manifest -r2
102 back
102 back
103 back/test
103 back/test
104 #if symlink
104 #if symlink
105 $ hg update -Cr2
105 $ hg update -Cr2
106 abort: path 'back/test' traverses symbolic link 'back'
106 abort: path 'back/test' traverses symbolic link 'back'
107 [255]
107 [255]
108 #else
108 #else
109 ('back' will be a file and cause some other system specific error)
109 ('back' will be a file and cause some other system specific error)
110 $ hg update -Cr2
110 $ hg update -Cr2
111 abort: * (glob)
111 abort: * (glob)
112 [255]
112 [255]
113 #endif
113 #endif
114
114
115 attack ../test
115 attack ../test
116
116
117 $ hg manifest -r3
117 $ hg manifest -r3
118 ../test
118 ../test
119 $ hg update -Cr3
119 $ hg update -Cr3
120 abort: path contains illegal component: ../test (glob)
120 abort: path contains illegal component: ../test (glob)
121 [255]
121 [255]
122
122
123 attack /tmp/test
123 attack /tmp/test
124
124
125 $ hg manifest -r4
125 $ hg manifest -r4
126 /tmp/test
126 /tmp/test
127 $ hg update -Cr4
127 $ hg update -Cr4
128 abort: path contains illegal component: /tmp/test (glob)
128 abort: path contains illegal component: /tmp/test (glob)
129 [255]
129 [255]
130
130
131 $ cd ..
131 $ cd ..
132
133 Test symlink traversal on merge:
134 --------------------------------
135
136 #if symlink
137
138 set up symlink hell
139
140 $ mkdir merge-symlink-out
141 $ hg init merge-symlink
142 $ cd merge-symlink
143 $ touch base
144 $ hg commit -qAm base
145 $ ln -s ../merge-symlink-out a
146 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
147 $ hg up -q 0
148 $ mkdir a
149 $ touch a/poisoned
150 $ hg commit -qAm 'file a/poisoned'
151 $ hg log -G -T '{rev}: {desc}\n'
152 @ 2: file a/poisoned
153 |
154 | o 1: symlink a -> ../merge-symlink-out
155 |/
156 o 0: base
157
158
159 try trivial merge
160
161 $ hg up -qC 1
162 $ hg merge 2
163 abort: path 'a/poisoned' traverses symbolic link 'a'
164 [255]
165
166 try rebase onto other revision: cache of audited paths should be discarded,
167 and the rebase should fail (issue5628)
168
169 $ hg up -qC 2
170 $ hg rebase -s 2 -d 1 --config extensions.rebase=
171 rebasing 2:e73c21d6b244 "file a/poisoned" (tip)
172 saved backup bundle to * (glob)
173 $ ls ../merge-symlink-out
174 poisoned
175
176 $ cd ..
177
178 Test symlink traversal on update:
179 ---------------------------------
180
181 $ mkdir update-symlink-out
182 $ hg init update-symlink
183 $ cd update-symlink
184 $ ln -s ../update-symlink-out a
185 $ hg commit -qAm 'symlink a -> ../update-symlink-out'
186 $ hg rm a
187 $ mkdir a && touch a/b
188 $ hg ci -qAm 'file a/b' a/b
189 $ hg up -qC 0
190 $ hg rm a
191 $ mkdir a && touch a/c
192 $ hg ci -qAm 'rm a, file a/c'
193 $ hg log -G -T '{rev}: {desc}\n'
194 @ 2: rm a, file a/c
195 |
196 | o 1: file a/b
197 |/
198 o 0: symlink a -> ../update-symlink-out
199
200
201 try linear update where symlink already exists:
202
203 $ hg up -qC 0
204 $ hg up 1
205 abort: path 'a/b' traverses symbolic link 'a'
206 [255]
207
208 try linear update including symlinked directory and its content: paths are
209 audited first by calculateupdates(), where no symlink is created so both
210 'a' and 'a/b' are taken as good paths. still applyupdates() should fail.
211
212 $ hg up -qC null
213 $ hg up 1
214 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
215 $ ls ../update-symlink-out
216 b
217 $ rm ../update-symlink-out/b
218
219 try branch update replacing directory with symlink, and its content: the
220 path 'a' is audited as a directory first, which should be audited again as
221 a symlink.
222
223 $ rm -f a
224 $ hg up -qC 2
225 $ hg up 1
226 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
227 $ ls ../update-symlink-out
228 b
229
230 $ cd ..
231
232 #endif
@@ -1,913 +1,990 b''
1 #if windows
1 #if windows
2 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
2 $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
3 #else
3 #else
4 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
4 $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
5 #endif
5 #endif
6 $ export PYTHONPATH
6 $ export PYTHONPATH
7
7
8 typical client does not want echo-back messages, so test without it:
8 typical client does not want echo-back messages, so test without it:
9
9
10 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
10 $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
11 $ mv $HGRCPATH.new $HGRCPATH
11 $ mv $HGRCPATH.new $HGRCPATH
12
12
13 $ hg init repo
13 $ hg init repo
14 $ cd repo
14 $ cd repo
15
15
16 >>> from __future__ import print_function
16 >>> from __future__ import print_function
17 >>> from hgclient import readchannel, runcommand, check
17 >>> from hgclient import readchannel, runcommand, check
18 >>> @check
18 >>> @check
19 ... def hellomessage(server):
19 ... def hellomessage(server):
20 ... ch, data = readchannel(server)
20 ... ch, data = readchannel(server)
21 ... print('%c, %r' % (ch, data))
21 ... print('%c, %r' % (ch, data))
22 ... # run an arbitrary command to make sure the next thing the server
22 ... # run an arbitrary command to make sure the next thing the server
23 ... # sends isn't part of the hello message
23 ... # sends isn't part of the hello message
24 ... runcommand(server, ['id'])
24 ... runcommand(server, ['id'])
25 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
25 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
26 *** runcommand id
26 *** runcommand id
27 000000000000 tip
27 000000000000 tip
28
28
29 >>> from hgclient import check
29 >>> from hgclient import check
30 >>> @check
30 >>> @check
31 ... def unknowncommand(server):
31 ... def unknowncommand(server):
32 ... server.stdin.write('unknowncommand\n')
32 ... server.stdin.write('unknowncommand\n')
33 abort: unknown command unknowncommand
33 abort: unknown command unknowncommand
34
34
35 >>> from hgclient import readchannel, runcommand, check
35 >>> from hgclient import readchannel, runcommand, check
36 >>> @check
36 >>> @check
37 ... def checkruncommand(server):
37 ... def checkruncommand(server):
38 ... # hello block
38 ... # hello block
39 ... readchannel(server)
39 ... readchannel(server)
40 ...
40 ...
41 ... # no args
41 ... # no args
42 ... runcommand(server, [])
42 ... runcommand(server, [])
43 ...
43 ...
44 ... # global options
44 ... # global options
45 ... runcommand(server, ['id', '--quiet'])
45 ... runcommand(server, ['id', '--quiet'])
46 ...
46 ...
47 ... # make sure global options don't stick through requests
47 ... # make sure global options don't stick through requests
48 ... runcommand(server, ['id'])
48 ... runcommand(server, ['id'])
49 ...
49 ...
50 ... # --config
50 ... # --config
51 ... runcommand(server, ['id', '--config', 'ui.quiet=True'])
51 ... runcommand(server, ['id', '--config', 'ui.quiet=True'])
52 ...
52 ...
53 ... # make sure --config doesn't stick
53 ... # make sure --config doesn't stick
54 ... runcommand(server, ['id'])
54 ... runcommand(server, ['id'])
55 ...
55 ...
56 ... # negative return code should be masked
56 ... # negative return code should be masked
57 ... runcommand(server, ['id', '-runknown'])
57 ... runcommand(server, ['id', '-runknown'])
58 *** runcommand
58 *** runcommand
59 Mercurial Distributed SCM
59 Mercurial Distributed SCM
60
60
61 basic commands:
61 basic commands:
62
62
63 add add the specified files on the next commit
63 add add the specified files on the next commit
64 annotate show changeset information by line for each file
64 annotate show changeset information by line for each file
65 clone make a copy of an existing repository
65 clone make a copy of an existing repository
66 commit commit the specified files or all outstanding changes
66 commit commit the specified files or all outstanding changes
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 forget forget the specified files on the next commit
69 forget forget the specified files on the next commit
70 init create a new repository in the given directory
70 init create a new repository in the given directory
71 log show revision history of entire repository or files
71 log show revision history of entire repository or files
72 merge merge another revision into working directory
72 merge merge another revision into working directory
73 pull pull changes from the specified source
73 pull pull changes from the specified source
74 push push changes to the specified destination
74 push push changes to the specified destination
75 remove remove the specified files on the next commit
75 remove remove the specified files on the next commit
76 serve start stand-alone webserver
76 serve start stand-alone webserver
77 status show changed files in the working directory
77 status show changed files in the working directory
78 summary summarize working directory state
78 summary summarize working directory state
79 update update working directory (or switch revisions)
79 update update working directory (or switch revisions)
80
80
81 (use 'hg help' for the full list of commands or 'hg -v' for details)
81 (use 'hg help' for the full list of commands or 'hg -v' for details)
82 *** runcommand id --quiet
82 *** runcommand id --quiet
83 000000000000
83 000000000000
84 *** runcommand id
84 *** runcommand id
85 000000000000 tip
85 000000000000 tip
86 *** runcommand id --config ui.quiet=True
86 *** runcommand id --config ui.quiet=True
87 000000000000
87 000000000000
88 *** runcommand id
88 *** runcommand id
89 000000000000 tip
89 000000000000 tip
90 *** runcommand id -runknown
90 *** runcommand id -runknown
91 abort: unknown revision 'unknown'!
91 abort: unknown revision 'unknown'!
92 [255]
92 [255]
93
93
94 >>> from hgclient import readchannel, check
94 >>> from hgclient import readchannel, check
95 >>> @check
95 >>> @check
96 ... def inputeof(server):
96 ... def inputeof(server):
97 ... readchannel(server)
97 ... readchannel(server)
98 ... server.stdin.write('runcommand\n')
98 ... server.stdin.write('runcommand\n')
99 ... # close stdin while server is waiting for input
99 ... # close stdin while server is waiting for input
100 ... server.stdin.close()
100 ... server.stdin.close()
101 ...
101 ...
102 ... # server exits with 1 if the pipe closed while reading the command
102 ... # server exits with 1 if the pipe closed while reading the command
103 ... print('server exit code =', server.wait())
103 ... print('server exit code =', server.wait())
104 server exit code = 1
104 server exit code = 1
105
105
106 >>> from hgclient import readchannel, runcommand, check, stringio
106 >>> from hgclient import readchannel, runcommand, check, stringio
107 >>> @check
107 >>> @check
108 ... def serverinput(server):
108 ... def serverinput(server):
109 ... readchannel(server)
109 ... readchannel(server)
110 ...
110 ...
111 ... patch = """
111 ... patch = """
112 ... # HG changeset patch
112 ... # HG changeset patch
113 ... # User test
113 ... # User test
114 ... # Date 0 0
114 ... # Date 0 0
115 ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
115 ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
116 ... # Parent 0000000000000000000000000000000000000000
116 ... # Parent 0000000000000000000000000000000000000000
117 ... 1
117 ... 1
118 ...
118 ...
119 ... diff -r 000000000000 -r c103a3dec114 a
119 ... diff -r 000000000000 -r c103a3dec114 a
120 ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000
120 ... --- /dev/null Thu Jan 01 00:00:00 1970 +0000
121 ... +++ b/a Thu Jan 01 00:00:00 1970 +0000
121 ... +++ b/a Thu Jan 01 00:00:00 1970 +0000
122 ... @@ -0,0 +1,1 @@
122 ... @@ -0,0 +1,1 @@
123 ... +1
123 ... +1
124 ... """
124 ... """
125 ...
125 ...
126 ... runcommand(server, ['import', '-'], input=stringio(patch))
126 ... runcommand(server, ['import', '-'], input=stringio(patch))
127 ... runcommand(server, ['log'])
127 ... runcommand(server, ['log'])
128 *** runcommand import -
128 *** runcommand import -
129 applying patch from stdin
129 applying patch from stdin
130 *** runcommand log
130 *** runcommand log
131 changeset: 0:eff892de26ec
131 changeset: 0:eff892de26ec
132 tag: tip
132 tag: tip
133 user: test
133 user: test
134 date: Thu Jan 01 00:00:00 1970 +0000
134 date: Thu Jan 01 00:00:00 1970 +0000
135 summary: 1
135 summary: 1
136
136
137
137
138 check that "histedit --commands=-" can read rules from the input channel:
138 check that "histedit --commands=-" can read rules from the input channel:
139
139
140 >>> import cStringIO
140 >>> import cStringIO
141 >>> from hgclient import readchannel, runcommand, check
141 >>> from hgclient import readchannel, runcommand, check
142 >>> @check
142 >>> @check
143 ... def serverinput(server):
143 ... def serverinput(server):
144 ... readchannel(server)
144 ... readchannel(server)
145 ... rules = 'pick eff892de26ec\n'
145 ... rules = 'pick eff892de26ec\n'
146 ... runcommand(server, ['histedit', '0', '--commands=-',
146 ... runcommand(server, ['histedit', '0', '--commands=-',
147 ... '--config', 'extensions.histedit='],
147 ... '--config', 'extensions.histedit='],
148 ... input=cStringIO.StringIO(rules))
148 ... input=cStringIO.StringIO(rules))
149 *** runcommand histedit 0 --commands=- --config extensions.histedit=
149 *** runcommand histedit 0 --commands=- --config extensions.histedit=
150
150
151 check that --cwd doesn't persist between requests:
151 check that --cwd doesn't persist between requests:
152
152
153 $ mkdir foo
153 $ mkdir foo
154 $ touch foo/bar
154 $ touch foo/bar
155 >>> from hgclient import readchannel, runcommand, check
155 >>> from hgclient import readchannel, runcommand, check
156 >>> @check
156 >>> @check
157 ... def cwd(server):
157 ... def cwd(server):
158 ... readchannel(server)
158 ... readchannel(server)
159 ... runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
159 ... runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
160 ... runcommand(server, ['st', 'foo/bar'])
160 ... runcommand(server, ['st', 'foo/bar'])
161 *** runcommand --cwd foo st bar
161 *** runcommand --cwd foo st bar
162 ? bar
162 ? bar
163 *** runcommand st foo/bar
163 *** runcommand st foo/bar
164 ? foo/bar
164 ? foo/bar
165
165
166 $ rm foo/bar
166 $ rm foo/bar
167
167
168
168
169 check that local configs for the cached repo aren't inherited when -R is used:
169 check that local configs for the cached repo aren't inherited when -R is used:
170
170
171 $ cat <<EOF >> .hg/hgrc
171 $ cat <<EOF >> .hg/hgrc
172 > [ui]
172 > [ui]
173 > foo = bar
173 > foo = bar
174 > EOF
174 > EOF
175
175
176 >>> from hgclient import readchannel, sep, runcommand, check
176 >>> from hgclient import readchannel, sep, runcommand, check
177 >>> @check
177 >>> @check
178 ... def localhgrc(server):
178 ... def localhgrc(server):
179 ... readchannel(server)
179 ... readchannel(server)
180 ...
180 ...
181 ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should
181 ... # the cached repo local hgrc contains ui.foo=bar, so showconfig should
182 ... # show it
182 ... # show it
183 ... runcommand(server, ['showconfig'], outfilter=sep)
183 ... runcommand(server, ['showconfig'], outfilter=sep)
184 ...
184 ...
185 ... # but not for this repo
185 ... # but not for this repo
186 ... runcommand(server, ['init', 'foo'])
186 ... runcommand(server, ['init', 'foo'])
187 ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
187 ... runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
188 *** runcommand showconfig
188 *** runcommand showconfig
189 bundle.mainreporoot=$TESTTMP/repo
189 bundle.mainreporoot=$TESTTMP/repo
190 defaults.backout=-d "0 0"
190 defaults.backout=-d "0 0"
191 defaults.commit=-d "0 0"
191 defaults.commit=-d "0 0"
192 defaults.shelve=--date "0 0"
192 defaults.shelve=--date "0 0"
193 defaults.tag=-d "0 0"
193 defaults.tag=-d "0 0"
194 devel.all-warnings=true
194 devel.all-warnings=true
195 largefiles.usercache=$TESTTMP/.cache/largefiles
195 largefiles.usercache=$TESTTMP/.cache/largefiles
196 ui.slash=True
196 ui.slash=True
197 ui.interactive=False
197 ui.interactive=False
198 ui.mergemarkers=detailed
198 ui.mergemarkers=detailed
199 ui.usehttp2=true (?)
199 ui.usehttp2=true (?)
200 ui.foo=bar
200 ui.foo=bar
201 ui.nontty=true
201 ui.nontty=true
202 web.address=localhost
202 web.address=localhost
203 web\.ipv6=(?:True|False) (re)
203 web\.ipv6=(?:True|False) (re)
204 *** runcommand init foo
204 *** runcommand init foo
205 *** runcommand -R foo showconfig ui defaults
205 *** runcommand -R foo showconfig ui defaults
206 defaults.backout=-d "0 0"
206 defaults.backout=-d "0 0"
207 defaults.commit=-d "0 0"
207 defaults.commit=-d "0 0"
208 defaults.shelve=--date "0 0"
208 defaults.shelve=--date "0 0"
209 defaults.tag=-d "0 0"
209 defaults.tag=-d "0 0"
210 ui.slash=True
210 ui.slash=True
211 ui.interactive=False
211 ui.interactive=False
212 ui.mergemarkers=detailed
212 ui.mergemarkers=detailed
213 ui.usehttp2=true (?)
213 ui.usehttp2=true (?)
214 ui.nontty=true
214 ui.nontty=true
215
215
216 $ rm -R foo
216 $ rm -R foo
217
217
218 #if windows
218 #if windows
219 $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
219 $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
220 #else
220 #else
221 $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
221 $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
222 #endif
222 #endif
223
223
224 $ cat <<EOF > hook.py
224 $ cat <<EOF > hook.py
225 > from __future__ import print_function
225 > from __future__ import print_function
226 > import sys
226 > import sys
227 > def hook(**args):
227 > def hook(**args):
228 > print('hook talking')
228 > print('hook talking')
229 > print('now try to read something: %r' % sys.stdin.read())
229 > print('now try to read something: %r' % sys.stdin.read())
230 > EOF
230 > EOF
231
231
232 >>> from hgclient import readchannel, runcommand, check, stringio
232 >>> from hgclient import readchannel, runcommand, check, stringio
233 >>> @check
233 >>> @check
234 ... def hookoutput(server):
234 ... def hookoutput(server):
235 ... readchannel(server)
235 ... readchannel(server)
236 ... runcommand(server, ['--config',
236 ... runcommand(server, ['--config',
237 ... 'hooks.pre-identify=python:hook.hook',
237 ... 'hooks.pre-identify=python:hook.hook',
238 ... 'id'],
238 ... 'id'],
239 ... input=stringio('some input'))
239 ... input=stringio('some input'))
240 *** runcommand --config hooks.pre-identify=python:hook.hook id
240 *** runcommand --config hooks.pre-identify=python:hook.hook id
241 eff892de26ec tip
241 eff892de26ec tip
242
242
243 $ rm hook.py*
243 $ rm hook.py*
244
244
245 $ echo a >> a
245 $ echo a >> a
246 >>> import os
246 >>> import os
247 >>> from hgclient import readchannel, runcommand, check
247 >>> from hgclient import readchannel, runcommand, check
248 >>> @check
248 >>> @check
249 ... def outsidechanges(server):
249 ... def outsidechanges(server):
250 ... readchannel(server)
250 ... readchannel(server)
251 ... runcommand(server, ['status'])
251 ... runcommand(server, ['status'])
252 ... os.system('hg ci -Am2')
252 ... os.system('hg ci -Am2')
253 ... runcommand(server, ['tip'])
253 ... runcommand(server, ['tip'])
254 ... runcommand(server, ['status'])
254 ... runcommand(server, ['status'])
255 *** runcommand status
255 *** runcommand status
256 M a
256 M a
257 *** runcommand tip
257 *** runcommand tip
258 changeset: 1:d3a0a68be6de
258 changeset: 1:d3a0a68be6de
259 tag: tip
259 tag: tip
260 user: test
260 user: test
261 date: Thu Jan 01 00:00:00 1970 +0000
261 date: Thu Jan 01 00:00:00 1970 +0000
262 summary: 2
262 summary: 2
263
263
264 *** runcommand status
264 *** runcommand status
265
265
266 >>> import os
266 >>> import os
267 >>> from hgclient import readchannel, runcommand, check
267 >>> from hgclient import readchannel, runcommand, check
268 >>> @check
268 >>> @check
269 ... def bookmarks(server):
269 ... def bookmarks(server):
270 ... readchannel(server)
270 ... readchannel(server)
271 ... runcommand(server, ['bookmarks'])
271 ... runcommand(server, ['bookmarks'])
272 ...
272 ...
273 ... # changes .hg/bookmarks
273 ... # changes .hg/bookmarks
274 ... os.system('hg bookmark -i bm1')
274 ... os.system('hg bookmark -i bm1')
275 ... os.system('hg bookmark -i bm2')
275 ... os.system('hg bookmark -i bm2')
276 ... runcommand(server, ['bookmarks'])
276 ... runcommand(server, ['bookmarks'])
277 ...
277 ...
278 ... # changes .hg/bookmarks.current
278 ... # changes .hg/bookmarks.current
279 ... os.system('hg upd bm1 -q')
279 ... os.system('hg upd bm1 -q')
280 ... runcommand(server, ['bookmarks'])
280 ... runcommand(server, ['bookmarks'])
281 ...
281 ...
282 ... runcommand(server, ['bookmarks', 'bm3'])
282 ... runcommand(server, ['bookmarks', 'bm3'])
283 ... f = open('a', 'ab')
283 ... f = open('a', 'ab')
284 ... f.write('a\n')
284 ... f.write('a\n')
285 ... f.close()
285 ... f.close()
286 ... runcommand(server, ['commit', '-Amm'])
286 ... runcommand(server, ['commit', '-Amm'])
287 ... runcommand(server, ['bookmarks'])
287 ... runcommand(server, ['bookmarks'])
288 *** runcommand bookmarks
288 *** runcommand bookmarks
289 no bookmarks set
289 no bookmarks set
290 *** runcommand bookmarks
290 *** runcommand bookmarks
291 bm1 1:d3a0a68be6de
291 bm1 1:d3a0a68be6de
292 bm2 1:d3a0a68be6de
292 bm2 1:d3a0a68be6de
293 *** runcommand bookmarks
293 *** runcommand bookmarks
294 * bm1 1:d3a0a68be6de
294 * bm1 1:d3a0a68be6de
295 bm2 1:d3a0a68be6de
295 bm2 1:d3a0a68be6de
296 *** runcommand bookmarks bm3
296 *** runcommand bookmarks bm3
297 *** runcommand commit -Amm
297 *** runcommand commit -Amm
298 *** runcommand bookmarks
298 *** runcommand bookmarks
299 bm1 1:d3a0a68be6de
299 bm1 1:d3a0a68be6de
300 bm2 1:d3a0a68be6de
300 bm2 1:d3a0a68be6de
301 * bm3 2:aef17e88f5f0
301 * bm3 2:aef17e88f5f0
302
302
303 >>> import os
303 >>> import os
304 >>> from hgclient import readchannel, runcommand, check
304 >>> from hgclient import readchannel, runcommand, check
305 >>> @check
305 >>> @check
306 ... def tagscache(server):
306 ... def tagscache(server):
307 ... readchannel(server)
307 ... readchannel(server)
308 ... runcommand(server, ['id', '-t', '-r', '0'])
308 ... runcommand(server, ['id', '-t', '-r', '0'])
309 ... os.system('hg tag -r 0 foo')
309 ... os.system('hg tag -r 0 foo')
310 ... runcommand(server, ['id', '-t', '-r', '0'])
310 ... runcommand(server, ['id', '-t', '-r', '0'])
311 *** runcommand id -t -r 0
311 *** runcommand id -t -r 0
312
312
313 *** runcommand id -t -r 0
313 *** runcommand id -t -r 0
314 foo
314 foo
315
315
316 >>> import os
316 >>> import os
317 >>> from hgclient import readchannel, runcommand, check
317 >>> from hgclient import readchannel, runcommand, check
318 >>> @check
318 >>> @check
319 ... def setphase(server):
319 ... def setphase(server):
320 ... readchannel(server)
320 ... readchannel(server)
321 ... runcommand(server, ['phase', '-r', '.'])
321 ... runcommand(server, ['phase', '-r', '.'])
322 ... os.system('hg phase -r . -p')
322 ... os.system('hg phase -r . -p')
323 ... runcommand(server, ['phase', '-r', '.'])
323 ... runcommand(server, ['phase', '-r', '.'])
324 *** runcommand phase -r .
324 *** runcommand phase -r .
325 3: draft
325 3: draft
326 *** runcommand phase -r .
326 *** runcommand phase -r .
327 3: public
327 3: public
328
328
329 $ echo a >> a
329 $ echo a >> a
330 >>> from hgclient import readchannel, runcommand, check
330 >>> from hgclient import readchannel, runcommand, check
331 >>> @check
331 >>> @check
332 ... def rollback(server):
332 ... def rollback(server):
333 ... readchannel(server)
333 ... readchannel(server)
334 ... runcommand(server, ['phase', '-r', '.', '-p'])
334 ... runcommand(server, ['phase', '-r', '.', '-p'])
335 ... runcommand(server, ['commit', '-Am.'])
335 ... runcommand(server, ['commit', '-Am.'])
336 ... runcommand(server, ['rollback'])
336 ... runcommand(server, ['rollback'])
337 ... runcommand(server, ['phase', '-r', '.'])
337 ... runcommand(server, ['phase', '-r', '.'])
338 *** runcommand phase -r . -p
338 *** runcommand phase -r . -p
339 no phases changed
339 no phases changed
340 *** runcommand commit -Am.
340 *** runcommand commit -Am.
341 *** runcommand rollback
341 *** runcommand rollback
342 repository tip rolled back to revision 3 (undo commit)
342 repository tip rolled back to revision 3 (undo commit)
343 working directory now based on revision 3
343 working directory now based on revision 3
344 *** runcommand phase -r .
344 *** runcommand phase -r .
345 3: public
345 3: public
346
346
347 >>> import os
347 >>> import os
348 >>> from hgclient import readchannel, runcommand, check
348 >>> from hgclient import readchannel, runcommand, check
349 >>> @check
349 >>> @check
350 ... def branch(server):
350 ... def branch(server):
351 ... readchannel(server)
351 ... readchannel(server)
352 ... runcommand(server, ['branch'])
352 ... runcommand(server, ['branch'])
353 ... os.system('hg branch foo')
353 ... os.system('hg branch foo')
354 ... runcommand(server, ['branch'])
354 ... runcommand(server, ['branch'])
355 ... os.system('hg branch default')
355 ... os.system('hg branch default')
356 *** runcommand branch
356 *** runcommand branch
357 default
357 default
358 marked working directory as branch foo
358 marked working directory as branch foo
359 (branches are permanent and global, did you want a bookmark?)
359 (branches are permanent and global, did you want a bookmark?)
360 *** runcommand branch
360 *** runcommand branch
361 foo
361 foo
362 marked working directory as branch default
362 marked working directory as branch default
363 (branches are permanent and global, did you want a bookmark?)
363 (branches are permanent and global, did you want a bookmark?)
364
364
365 $ touch .hgignore
365 $ touch .hgignore
366 >>> import os
366 >>> import os
367 >>> from hgclient import readchannel, runcommand, check
367 >>> from hgclient import readchannel, runcommand, check
368 >>> @check
368 >>> @check
369 ... def hgignore(server):
369 ... def hgignore(server):
370 ... readchannel(server)
370 ... readchannel(server)
371 ... runcommand(server, ['commit', '-Am.'])
371 ... runcommand(server, ['commit', '-Am.'])
372 ... f = open('ignored-file', 'ab')
372 ... f = open('ignored-file', 'ab')
373 ... f.write('')
373 ... f.write('')
374 ... f.close()
374 ... f.close()
375 ... f = open('.hgignore', 'ab')
375 ... f = open('.hgignore', 'ab')
376 ... f.write('ignored-file')
376 ... f.write('ignored-file')
377 ... f.close()
377 ... f.close()
378 ... runcommand(server, ['status', '-i', '-u'])
378 ... runcommand(server, ['status', '-i', '-u'])
379 *** runcommand commit -Am.
379 *** runcommand commit -Am.
380 adding .hgignore
380 adding .hgignore
381 *** runcommand status -i -u
381 *** runcommand status -i -u
382 I ignored-file
382 I ignored-file
383
383
384 cache of non-public revisions should be invalidated on repository change
384 cache of non-public revisions should be invalidated on repository change
385 (issue4855):
385 (issue4855):
386
386
387 >>> import os
387 >>> import os
388 >>> from hgclient import readchannel, runcommand, check
388 >>> from hgclient import readchannel, runcommand, check
389 >>> @check
389 >>> @check
390 ... def phasesetscacheaftercommit(server):
390 ... def phasesetscacheaftercommit(server):
391 ... readchannel(server)
391 ... readchannel(server)
392 ... # load _phasecache._phaserevs and _phasesets
392 ... # load _phasecache._phaserevs and _phasesets
393 ... runcommand(server, ['log', '-qr', 'draft()'])
393 ... runcommand(server, ['log', '-qr', 'draft()'])
394 ... # create draft commits by another process
394 ... # create draft commits by another process
395 ... for i in xrange(5, 7):
395 ... for i in xrange(5, 7):
396 ... f = open('a', 'ab')
396 ... f = open('a', 'ab')
397 ... f.seek(0, os.SEEK_END)
397 ... f.seek(0, os.SEEK_END)
398 ... f.write('a\n')
398 ... f.write('a\n')
399 ... f.close()
399 ... f.close()
400 ... os.system('hg commit -Aqm%d' % i)
400 ... os.system('hg commit -Aqm%d' % i)
401 ... # new commits should be listed as draft revisions
401 ... # new commits should be listed as draft revisions
402 ... runcommand(server, ['log', '-qr', 'draft()'])
402 ... runcommand(server, ['log', '-qr', 'draft()'])
403 *** runcommand log -qr draft()
403 *** runcommand log -qr draft()
404 4:7966c8e3734d
404 4:7966c8e3734d
405 *** runcommand log -qr draft()
405 *** runcommand log -qr draft()
406 4:7966c8e3734d
406 4:7966c8e3734d
407 5:41f6602d1c4f
407 5:41f6602d1c4f
408 6:10501e202c35
408 6:10501e202c35
409
409
410 >>> import os
410 >>> import os
411 >>> from hgclient import readchannel, runcommand, check
411 >>> from hgclient import readchannel, runcommand, check
412 >>> @check
412 >>> @check
413 ... def phasesetscacheafterstrip(server):
413 ... def phasesetscacheafterstrip(server):
414 ... readchannel(server)
414 ... readchannel(server)
415 ... # load _phasecache._phaserevs and _phasesets
415 ... # load _phasecache._phaserevs and _phasesets
416 ... runcommand(server, ['log', '-qr', 'draft()'])
416 ... runcommand(server, ['log', '-qr', 'draft()'])
417 ... # strip cached revisions by another process
417 ... # strip cached revisions by another process
418 ... os.system('hg --config extensions.strip= strip -q 5')
418 ... os.system('hg --config extensions.strip= strip -q 5')
419 ... # shouldn't abort by "unknown revision '6'"
419 ... # shouldn't abort by "unknown revision '6'"
420 ... runcommand(server, ['log', '-qr', 'draft()'])
420 ... runcommand(server, ['log', '-qr', 'draft()'])
421 *** runcommand log -qr draft()
421 *** runcommand log -qr draft()
422 4:7966c8e3734d
422 4:7966c8e3734d
423 5:41f6602d1c4f
423 5:41f6602d1c4f
424 6:10501e202c35
424 6:10501e202c35
425 *** runcommand log -qr draft()
425 *** runcommand log -qr draft()
426 4:7966c8e3734d
426 4:7966c8e3734d
427
427
428 cache of phase roots should be invalidated on strip (issue3827):
428 cache of phase roots should be invalidated on strip (issue3827):
429
429
430 >>> import os
430 >>> import os
431 >>> from hgclient import readchannel, sep, runcommand, check
431 >>> from hgclient import readchannel, sep, runcommand, check
432 >>> @check
432 >>> @check
433 ... def phasecacheafterstrip(server):
433 ... def phasecacheafterstrip(server):
434 ... readchannel(server)
434 ... readchannel(server)
435 ...
435 ...
436 ... # create new head, 5:731265503d86
436 ... # create new head, 5:731265503d86
437 ... runcommand(server, ['update', '-C', '0'])
437 ... runcommand(server, ['update', '-C', '0'])
438 ... f = open('a', 'ab')
438 ... f = open('a', 'ab')
439 ... f.write('a\n')
439 ... f.write('a\n')
440 ... f.close()
440 ... f.close()
441 ... runcommand(server, ['commit', '-Am.', 'a'])
441 ... runcommand(server, ['commit', '-Am.', 'a'])
442 ... runcommand(server, ['log', '-Gq'])
442 ... runcommand(server, ['log', '-Gq'])
443 ...
443 ...
444 ... # make it public; draft marker moves to 4:7966c8e3734d
444 ... # make it public; draft marker moves to 4:7966c8e3734d
445 ... runcommand(server, ['phase', '-p', '.'])
445 ... runcommand(server, ['phase', '-p', '.'])
446 ... # load _phasecache.phaseroots
446 ... # load _phasecache.phaseroots
447 ... runcommand(server, ['phase', '.'], outfilter=sep)
447 ... runcommand(server, ['phase', '.'], outfilter=sep)
448 ...
448 ...
449 ... # strip 1::4 outside server
449 ... # strip 1::4 outside server
450 ... os.system('hg -q --config extensions.mq= strip 1')
450 ... os.system('hg -q --config extensions.mq= strip 1')
451 ...
451 ...
452 ... # shouldn't raise "7966c8e3734d: no node!"
452 ... # shouldn't raise "7966c8e3734d: no node!"
453 ... runcommand(server, ['branches'])
453 ... runcommand(server, ['branches'])
454 *** runcommand update -C 0
454 *** runcommand update -C 0
455 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
455 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
456 (leaving bookmark bm3)
456 (leaving bookmark bm3)
457 *** runcommand commit -Am. a
457 *** runcommand commit -Am. a
458 created new head
458 created new head
459 *** runcommand log -Gq
459 *** runcommand log -Gq
460 @ 5:731265503d86
460 @ 5:731265503d86
461 |
461 |
462 | o 4:7966c8e3734d
462 | o 4:7966c8e3734d
463 | |
463 | |
464 | o 3:b9b85890c400
464 | o 3:b9b85890c400
465 | |
465 | |
466 | o 2:aef17e88f5f0
466 | o 2:aef17e88f5f0
467 | |
467 | |
468 | o 1:d3a0a68be6de
468 | o 1:d3a0a68be6de
469 |/
469 |/
470 o 0:eff892de26ec
470 o 0:eff892de26ec
471
471
472 *** runcommand phase -p .
472 *** runcommand phase -p .
473 *** runcommand phase .
473 *** runcommand phase .
474 5: public
474 5: public
475 *** runcommand branches
475 *** runcommand branches
476 default 1:731265503d86
476 default 1:731265503d86
477
477
478 in-memory cache must be reloaded if transaction is aborted. otherwise
478 in-memory cache must be reloaded if transaction is aborted. otherwise
479 changelog and manifest would have invalid node:
479 changelog and manifest would have invalid node:
480
480
481 $ echo a >> a
481 $ echo a >> a
482 >>> from hgclient import readchannel, runcommand, check
482 >>> from hgclient import readchannel, runcommand, check
483 >>> @check
483 >>> @check
484 ... def txabort(server):
484 ... def txabort(server):
485 ... readchannel(server)
485 ... readchannel(server)
486 ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false',
486 ... runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false',
487 ... '-mfoo'])
487 ... '-mfoo'])
488 ... runcommand(server, ['verify'])
488 ... runcommand(server, ['verify'])
489 *** runcommand commit --config hooks.pretxncommit=false -mfoo
489 *** runcommand commit --config hooks.pretxncommit=false -mfoo
490 transaction abort!
490 transaction abort!
491 rollback completed
491 rollback completed
492 abort: pretxncommit hook exited with status 1
492 abort: pretxncommit hook exited with status 1
493 [255]
493 [255]
494 *** runcommand verify
494 *** runcommand verify
495 checking changesets
495 checking changesets
496 checking manifests
496 checking manifests
497 crosschecking files in changesets and manifests
497 crosschecking files in changesets and manifests
498 checking files
498 checking files
499 1 files, 2 changesets, 2 total revisions
499 1 files, 2 changesets, 2 total revisions
500 $ hg revert --no-backup -aq
500 $ hg revert --no-backup -aq
501
501
502 $ cat >> .hg/hgrc << EOF
502 $ cat >> .hg/hgrc << EOF
503 > [experimental]
503 > [experimental]
504 > evolution=createmarkers
504 > evolution=createmarkers
505 > EOF
505 > EOF
506
506
507 >>> import os
507 >>> import os
508 >>> from hgclient import readchannel, runcommand, check
508 >>> from hgclient import readchannel, runcommand, check
509 >>> @check
509 >>> @check
510 ... def obsolete(server):
510 ... def obsolete(server):
511 ... readchannel(server)
511 ... readchannel(server)
512 ...
512 ...
513 ... runcommand(server, ['up', 'null'])
513 ... runcommand(server, ['up', 'null'])
514 ... runcommand(server, ['phase', '-df', 'tip'])
514 ... runcommand(server, ['phase', '-df', 'tip'])
515 ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
515 ... cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
516 ... if os.name == 'nt':
516 ... if os.name == 'nt':
517 ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
517 ... cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
518 ... os.system(cmd)
518 ... os.system(cmd)
519 ... runcommand(server, ['log', '--hidden'])
519 ... runcommand(server, ['log', '--hidden'])
520 ... runcommand(server, ['log'])
520 ... runcommand(server, ['log'])
521 *** runcommand up null
521 *** runcommand up null
522 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
522 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
523 *** runcommand phase -df tip
523 *** runcommand phase -df tip
524 *** runcommand log --hidden
524 *** runcommand log --hidden
525 changeset: 1:731265503d86
525 changeset: 1:731265503d86
526 tag: tip
526 tag: tip
527 user: test
527 user: test
528 date: Thu Jan 01 00:00:00 1970 +0000
528 date: Thu Jan 01 00:00:00 1970 +0000
529 summary: .
529 summary: .
530
530
531 changeset: 0:eff892de26ec
531 changeset: 0:eff892de26ec
532 bookmark: bm1
532 bookmark: bm1
533 bookmark: bm2
533 bookmark: bm2
534 bookmark: bm3
534 bookmark: bm3
535 user: test
535 user: test
536 date: Thu Jan 01 00:00:00 1970 +0000
536 date: Thu Jan 01 00:00:00 1970 +0000
537 summary: 1
537 summary: 1
538
538
539 *** runcommand log
539 *** runcommand log
540 changeset: 0:eff892de26ec
540 changeset: 0:eff892de26ec
541 bookmark: bm1
541 bookmark: bm1
542 bookmark: bm2
542 bookmark: bm2
543 bookmark: bm3
543 bookmark: bm3
544 tag: tip
544 tag: tip
545 user: test
545 user: test
546 date: Thu Jan 01 00:00:00 1970 +0000
546 date: Thu Jan 01 00:00:00 1970 +0000
547 summary: 1
547 summary: 1
548
548
549
549
550 $ cat <<EOF >> .hg/hgrc
550 $ cat <<EOF >> .hg/hgrc
551 > [extensions]
551 > [extensions]
552 > mq =
552 > mq =
553 > EOF
553 > EOF
554
554
555 >>> import os
555 >>> import os
556 >>> from hgclient import readchannel, runcommand, check
556 >>> from hgclient import readchannel, runcommand, check
557 >>> @check
557 >>> @check
558 ... def mqoutsidechanges(server):
558 ... def mqoutsidechanges(server):
559 ... readchannel(server)
559 ... readchannel(server)
560 ...
560 ...
561 ... # load repo.mq
561 ... # load repo.mq
562 ... runcommand(server, ['qapplied'])
562 ... runcommand(server, ['qapplied'])
563 ... os.system('hg qnew 0.diff')
563 ... os.system('hg qnew 0.diff')
564 ... # repo.mq should be invalidated
564 ... # repo.mq should be invalidated
565 ... runcommand(server, ['qapplied'])
565 ... runcommand(server, ['qapplied'])
566 ...
566 ...
567 ... runcommand(server, ['qpop', '--all'])
567 ... runcommand(server, ['qpop', '--all'])
568 ... os.system('hg qqueue --create foo')
568 ... os.system('hg qqueue --create foo')
569 ... # repo.mq should be recreated to point to new queue
569 ... # repo.mq should be recreated to point to new queue
570 ... runcommand(server, ['qqueue', '--active'])
570 ... runcommand(server, ['qqueue', '--active'])
571 *** runcommand qapplied
571 *** runcommand qapplied
572 *** runcommand qapplied
572 *** runcommand qapplied
573 0.diff
573 0.diff
574 *** runcommand qpop --all
574 *** runcommand qpop --all
575 popping 0.diff
575 popping 0.diff
576 patch queue now empty
576 patch queue now empty
577 *** runcommand qqueue --active
577 *** runcommand qqueue --active
578 foo
578 foo
579
579
580 $ cat <<EOF > dbgui.py
580 $ cat <<EOF > dbgui.py
581 > import os, sys
581 > import os, sys
582 > from mercurial import cmdutil, commands
582 > from mercurial import cmdutil, commands
583 > cmdtable = {}
583 > cmdtable = {}
584 > command = cmdutil.command(cmdtable)
584 > command = cmdutil.command(cmdtable)
585 > @command("debuggetpass", norepo=True)
585 > @command("debuggetpass", norepo=True)
586 > def debuggetpass(ui):
586 > def debuggetpass(ui):
587 > ui.write("%s\\n" % ui.getpass())
587 > ui.write("%s\\n" % ui.getpass())
588 > @command("debugprompt", norepo=True)
588 > @command("debugprompt", norepo=True)
589 > def debugprompt(ui):
589 > def debugprompt(ui):
590 > ui.write("%s\\n" % ui.prompt("prompt:"))
590 > ui.write("%s\\n" % ui.prompt("prompt:"))
591 > @command("debugreadstdin", norepo=True)
591 > @command("debugreadstdin", norepo=True)
592 > def debugreadstdin(ui):
592 > def debugreadstdin(ui):
593 > ui.write("read: %r\n" % sys.stdin.read(1))
593 > ui.write("read: %r\n" % sys.stdin.read(1))
594 > @command("debugwritestdout", norepo=True)
594 > @command("debugwritestdout", norepo=True)
595 > def debugwritestdout(ui):
595 > def debugwritestdout(ui):
596 > os.write(1, "low-level stdout fd and\n")
596 > os.write(1, "low-level stdout fd and\n")
597 > sys.stdout.write("stdout should be redirected to /dev/null\n")
597 > sys.stdout.write("stdout should be redirected to /dev/null\n")
598 > sys.stdout.flush()
598 > sys.stdout.flush()
599 > EOF
599 > EOF
600 $ cat <<EOF >> .hg/hgrc
600 $ cat <<EOF >> .hg/hgrc
601 > [extensions]
601 > [extensions]
602 > dbgui = dbgui.py
602 > dbgui = dbgui.py
603 > EOF
603 > EOF
604
604
605 >>> from hgclient import readchannel, runcommand, check, stringio
605 >>> from hgclient import readchannel, runcommand, check, stringio
606 >>> @check
606 >>> @check
607 ... def getpass(server):
607 ... def getpass(server):
608 ... readchannel(server)
608 ... readchannel(server)
609 ... runcommand(server, ['debuggetpass', '--config',
609 ... runcommand(server, ['debuggetpass', '--config',
610 ... 'ui.interactive=True'],
610 ... 'ui.interactive=True'],
611 ... input=stringio('1234\n'))
611 ... input=stringio('1234\n'))
612 ... runcommand(server, ['debuggetpass', '--config',
612 ... runcommand(server, ['debuggetpass', '--config',
613 ... 'ui.interactive=True'],
613 ... 'ui.interactive=True'],
614 ... input=stringio('\n'))
614 ... input=stringio('\n'))
615 ... runcommand(server, ['debuggetpass', '--config',
615 ... runcommand(server, ['debuggetpass', '--config',
616 ... 'ui.interactive=True'],
616 ... 'ui.interactive=True'],
617 ... input=stringio(''))
617 ... input=stringio(''))
618 ... runcommand(server, ['debugprompt', '--config',
618 ... runcommand(server, ['debugprompt', '--config',
619 ... 'ui.interactive=True'],
619 ... 'ui.interactive=True'],
620 ... input=stringio('5678\n'))
620 ... input=stringio('5678\n'))
621 ... runcommand(server, ['debugreadstdin'])
621 ... runcommand(server, ['debugreadstdin'])
622 ... runcommand(server, ['debugwritestdout'])
622 ... runcommand(server, ['debugwritestdout'])
623 *** runcommand debuggetpass --config ui.interactive=True
623 *** runcommand debuggetpass --config ui.interactive=True
624 password: 1234
624 password: 1234
625 *** runcommand debuggetpass --config ui.interactive=True
625 *** runcommand debuggetpass --config ui.interactive=True
626 password:
626 password:
627 *** runcommand debuggetpass --config ui.interactive=True
627 *** runcommand debuggetpass --config ui.interactive=True
628 password: abort: response expected
628 password: abort: response expected
629 [255]
629 [255]
630 *** runcommand debugprompt --config ui.interactive=True
630 *** runcommand debugprompt --config ui.interactive=True
631 prompt: 5678
631 prompt: 5678
632 *** runcommand debugreadstdin
632 *** runcommand debugreadstdin
633 read: ''
633 read: ''
634 *** runcommand debugwritestdout
634 *** runcommand debugwritestdout
635
635
636
636
637 run commandserver in commandserver, which is silly but should work:
637 run commandserver in commandserver, which is silly but should work:
638
638
639 >>> from __future__ import print_function
639 >>> from __future__ import print_function
640 >>> from hgclient import readchannel, runcommand, check, stringio
640 >>> from hgclient import readchannel, runcommand, check, stringio
641 >>> @check
641 >>> @check
642 ... def nested(server):
642 ... def nested(server):
643 ... print('%c, %r' % readchannel(server))
643 ... print('%c, %r' % readchannel(server))
644 ... class nestedserver(object):
644 ... class nestedserver(object):
645 ... stdin = stringio('getencoding\n')
645 ... stdin = stringio('getencoding\n')
646 ... stdout = stringio()
646 ... stdout = stringio()
647 ... runcommand(server, ['serve', '--cmdserver', 'pipe'],
647 ... runcommand(server, ['serve', '--cmdserver', 'pipe'],
648 ... output=nestedserver.stdout, input=nestedserver.stdin)
648 ... output=nestedserver.stdout, input=nestedserver.stdin)
649 ... nestedserver.stdout.seek(0)
649 ... nestedserver.stdout.seek(0)
650 ... print('%c, %r' % readchannel(nestedserver)) # hello
650 ... print('%c, %r' % readchannel(nestedserver)) # hello
651 ... print('%c, %r' % readchannel(nestedserver)) # getencoding
651 ... print('%c, %r' % readchannel(nestedserver)) # getencoding
652 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
652 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
653 *** runcommand serve --cmdserver pipe
653 *** runcommand serve --cmdserver pipe
654 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
654 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
655 r, '*' (glob)
655 r, '*' (glob)
656
656
657
657
658 start without repository:
658 start without repository:
659
659
660 $ cd ..
660 $ cd ..
661
661
662 >>> from __future__ import print_function
662 >>> from __future__ import print_function
663 >>> from hgclient import readchannel, runcommand, check
663 >>> from hgclient import readchannel, runcommand, check
664 >>> @check
664 >>> @check
665 ... def hellomessage(server):
665 ... def hellomessage(server):
666 ... ch, data = readchannel(server)
666 ... ch, data = readchannel(server)
667 ... print('%c, %r' % (ch, data))
667 ... print('%c, %r' % (ch, data))
668 ... # run an arbitrary command to make sure the next thing the server
668 ... # run an arbitrary command to make sure the next thing the server
669 ... # sends isn't part of the hello message
669 ... # sends isn't part of the hello message
670 ... runcommand(server, ['id'])
670 ... runcommand(server, ['id'])
671 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
671 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
672 *** runcommand id
672 *** runcommand id
673 abort: there is no Mercurial repository here (.hg not found)
673 abort: there is no Mercurial repository here (.hg not found)
674 [255]
674 [255]
675
675
676 >>> from hgclient import readchannel, runcommand, check
676 >>> from hgclient import readchannel, runcommand, check
677 >>> @check
677 >>> @check
678 ... def startwithoutrepo(server):
678 ... def startwithoutrepo(server):
679 ... readchannel(server)
679 ... readchannel(server)
680 ... runcommand(server, ['init', 'repo2'])
680 ... runcommand(server, ['init', 'repo2'])
681 ... runcommand(server, ['id', '-R', 'repo2'])
681 ... runcommand(server, ['id', '-R', 'repo2'])
682 *** runcommand init repo2
682 *** runcommand init repo2
683 *** runcommand id -R repo2
683 *** runcommand id -R repo2
684 000000000000 tip
684 000000000000 tip
685
685
686
686
687 don't fall back to cwd if invalid -R path is specified (issue4805):
687 don't fall back to cwd if invalid -R path is specified (issue4805):
688
688
689 $ cd repo
689 $ cd repo
690 $ hg serve --cmdserver pipe -R ../nonexistent
690 $ hg serve --cmdserver pipe -R ../nonexistent
691 abort: repository ../nonexistent not found!
691 abort: repository ../nonexistent not found!
692 [255]
692 [255]
693 $ cd ..
693 $ cd ..
694
694
695
695
696 unix domain socket:
696 unix domain socket:
697
697
698 $ cd repo
698 $ cd repo
699 $ hg update -q
699 $ hg update -q
700
700
701 #if unix-socket unix-permissions
701 #if unix-socket unix-permissions
702
702
703 >>> from __future__ import print_function
703 >>> from __future__ import print_function
704 >>> from hgclient import unixserver, readchannel, runcommand, check, stringio
704 >>> from hgclient import unixserver, readchannel, runcommand, check, stringio
705 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
705 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
706 >>> def hellomessage(conn):
706 >>> def hellomessage(conn):
707 ... ch, data = readchannel(conn)
707 ... ch, data = readchannel(conn)
708 ... print('%c, %r' % (ch, data))
708 ... print('%c, %r' % (ch, data))
709 ... runcommand(conn, ['id'])
709 ... runcommand(conn, ['id'])
710 >>> check(hellomessage, server.connect)
710 >>> check(hellomessage, server.connect)
711 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
711 o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
712 *** runcommand id
712 *** runcommand id
713 eff892de26ec tip bm1/bm2/bm3
713 eff892de26ec tip bm1/bm2/bm3
714 >>> def unknowncommand(conn):
714 >>> def unknowncommand(conn):
715 ... readchannel(conn)
715 ... readchannel(conn)
716 ... conn.stdin.write('unknowncommand\n')
716 ... conn.stdin.write('unknowncommand\n')
717 >>> check(unknowncommand, server.connect) # error sent to server.log
717 >>> check(unknowncommand, server.connect) # error sent to server.log
718 >>> def serverinput(conn):
718 >>> def serverinput(conn):
719 ... readchannel(conn)
719 ... readchannel(conn)
720 ... patch = """
720 ... patch = """
721 ... # HG changeset patch
721 ... # HG changeset patch
722 ... # User test
722 ... # User test
723 ... # Date 0 0
723 ... # Date 0 0
724 ... 2
724 ... 2
725 ...
725 ...
726 ... diff -r eff892de26ec -r 1ed24be7e7a0 a
726 ... diff -r eff892de26ec -r 1ed24be7e7a0 a
727 ... --- a/a
727 ... --- a/a
728 ... +++ b/a
728 ... +++ b/a
729 ... @@ -1,1 +1,2 @@
729 ... @@ -1,1 +1,2 @@
730 ... 1
730 ... 1
731 ... +2
731 ... +2
732 ... """
732 ... """
733 ... runcommand(conn, ['import', '-'], input=stringio(patch))
733 ... runcommand(conn, ['import', '-'], input=stringio(patch))
734 ... runcommand(conn, ['log', '-rtip', '-q'])
734 ... runcommand(conn, ['log', '-rtip', '-q'])
735 >>> check(serverinput, server.connect)
735 >>> check(serverinput, server.connect)
736 *** runcommand import -
736 *** runcommand import -
737 applying patch from stdin
737 applying patch from stdin
738 *** runcommand log -rtip -q
738 *** runcommand log -rtip -q
739 2:1ed24be7e7a0
739 2:1ed24be7e7a0
740 >>> server.shutdown()
740 >>> server.shutdown()
741
741
742 $ cat .hg/server.log
742 $ cat .hg/server.log
743 listening at .hg/server.sock
743 listening at .hg/server.sock
744 abort: unknown command unknowncommand
744 abort: unknown command unknowncommand
745 killed!
745 killed!
746 $ rm .hg/server.log
746 $ rm .hg/server.log
747
747
748 if server crashed before hello, traceback will be sent to 'e' channel as
748 if server crashed before hello, traceback will be sent to 'e' channel as
749 last ditch:
749 last ditch:
750
750
751 $ cat <<EOF >> .hg/hgrc
751 $ cat <<EOF >> .hg/hgrc
752 > [cmdserver]
752 > [cmdserver]
753 > log = inexistent/path.log
753 > log = inexistent/path.log
754 > EOF
754 > EOF
755 >>> from __future__ import print_function
755 >>> from __future__ import print_function
756 >>> from hgclient import unixserver, readchannel, check
756 >>> from hgclient import unixserver, readchannel, check
757 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
757 >>> server = unixserver('.hg/server.sock', '.hg/server.log')
758 >>> def earlycrash(conn):
758 >>> def earlycrash(conn):
759 ... while True:
759 ... while True:
760 ... try:
760 ... try:
761 ... ch, data = readchannel(conn)
761 ... ch, data = readchannel(conn)
762 ... if not data.startswith(' '):
762 ... if not data.startswith(' '):
763 ... print('%c, %r' % (ch, data))
763 ... print('%c, %r' % (ch, data))
764 ... except EOFError:
764 ... except EOFError:
765 ... break
765 ... break
766 >>> check(earlycrash, server.connect)
766 >>> check(earlycrash, server.connect)
767 e, 'Traceback (most recent call last):\n'
767 e, 'Traceback (most recent call last):\n'
768 e, "IOError: *" (glob)
768 e, "IOError: *" (glob)
769 >>> server.shutdown()
769 >>> server.shutdown()
770
770
771 $ cat .hg/server.log | grep -v '^ '
771 $ cat .hg/server.log | grep -v '^ '
772 listening at .hg/server.sock
772 listening at .hg/server.sock
773 Traceback (most recent call last):
773 Traceback (most recent call last):
774 IOError: * (glob)
774 IOError: * (glob)
775 killed!
775 killed!
776 #endif
776 #endif
777 #if no-unix-socket
777 #if no-unix-socket
778
778
779 $ hg serve --cmdserver unix -a .hg/server.sock
779 $ hg serve --cmdserver unix -a .hg/server.sock
780 abort: unsupported platform
780 abort: unsupported platform
781 [255]
781 [255]
782
782
783 #endif
783 #endif
784
784
785 $ cd ..
785 $ cd ..
786
786
787 Test that accessing to invalid changelog cache is avoided at
787 Test that accessing to invalid changelog cache is avoided at
788 subsequent operations even if repo object is reused even after failure
788 subsequent operations even if repo object is reused even after failure
789 of transaction (see 0a7610758c42 also)
789 of transaction (see 0a7610758c42 also)
790
790
791 "hg log" after failure of transaction is needed to detect invalid
791 "hg log" after failure of transaction is needed to detect invalid
792 cache in repoview: this can't detect by "hg verify" only.
792 cache in repoview: this can't detect by "hg verify" only.
793
793
794 Combination of "finalization" and "empty-ness of changelog" (2 x 2 =
794 Combination of "finalization" and "empty-ness of changelog" (2 x 2 =
795 4) are tested, because '00changelog.i' are differently changed in each
795 4) are tested, because '00changelog.i' are differently changed in each
796 cases.
796 cases.
797
797
798 $ cat > $TESTTMP/failafterfinalize.py <<EOF
798 $ cat > $TESTTMP/failafterfinalize.py <<EOF
799 > # extension to abort transaction after finalization forcibly
799 > # extension to abort transaction after finalization forcibly
800 > from mercurial import commands, error, extensions, lock as lockmod
800 > from mercurial import commands, error, extensions, lock as lockmod
801 > def fail(tr):
801 > def fail(tr):
802 > raise error.Abort('fail after finalization')
802 > raise error.Abort('fail after finalization')
803 > def reposetup(ui, repo):
803 > def reposetup(ui, repo):
804 > class failrepo(repo.__class__):
804 > class failrepo(repo.__class__):
805 > def commitctx(self, ctx, error=False):
805 > def commitctx(self, ctx, error=False):
806 > if self.ui.configbool('failafterfinalize', 'fail'):
806 > if self.ui.configbool('failafterfinalize', 'fail'):
807 > # 'sorted()' by ASCII code on category names causes
807 > # 'sorted()' by ASCII code on category names causes
808 > # invoking 'fail' after finalization of changelog
808 > # invoking 'fail' after finalization of changelog
809 > # using "'cl-%i' % id(self)" as category name
809 > # using "'cl-%i' % id(self)" as category name
810 > self.currenttransaction().addfinalize('zzzzzzzz', fail)
810 > self.currenttransaction().addfinalize('zzzzzzzz', fail)
811 > return super(failrepo, self).commitctx(ctx, error)
811 > return super(failrepo, self).commitctx(ctx, error)
812 > repo.__class__ = failrepo
812 > repo.__class__ = failrepo
813 > EOF
813 > EOF
814
814
815 $ hg init repo3
815 $ hg init repo3
816 $ cd repo3
816 $ cd repo3
817
817
818 $ cat <<EOF >> $HGRCPATH
818 $ cat <<EOF >> $HGRCPATH
819 > [ui]
819 > [ui]
820 > logtemplate = {rev} {desc|firstline} ({files})\n
820 > logtemplate = {rev} {desc|firstline} ({files})\n
821 >
821 >
822 > [extensions]
822 > [extensions]
823 > failafterfinalize = $TESTTMP/failafterfinalize.py
823 > failafterfinalize = $TESTTMP/failafterfinalize.py
824 > EOF
824 > EOF
825
825
826 - test failure with "empty changelog"
826 - test failure with "empty changelog"
827
827
828 $ echo foo > foo
828 $ echo foo > foo
829 $ hg add foo
829 $ hg add foo
830
830
831 (failure before finalization)
831 (failure before finalization)
832
832
833 >>> from hgclient import readchannel, runcommand, check
833 >>> from hgclient import readchannel, runcommand, check
834 >>> @check
834 >>> @check
835 ... def abort(server):
835 ... def abort(server):
836 ... readchannel(server)
836 ... readchannel(server)
837 ... runcommand(server, ['commit',
837 ... runcommand(server, ['commit',
838 ... '--config', 'hooks.pretxncommit=false',
838 ... '--config', 'hooks.pretxncommit=false',
839 ... '-mfoo'])
839 ... '-mfoo'])
840 ... runcommand(server, ['log'])
840 ... runcommand(server, ['log'])
841 ... runcommand(server, ['verify', '-q'])
841 ... runcommand(server, ['verify', '-q'])
842 *** runcommand commit --config hooks.pretxncommit=false -mfoo
842 *** runcommand commit --config hooks.pretxncommit=false -mfoo
843 transaction abort!
843 transaction abort!
844 rollback completed
844 rollback completed
845 abort: pretxncommit hook exited with status 1
845 abort: pretxncommit hook exited with status 1
846 [255]
846 [255]
847 *** runcommand log
847 *** runcommand log
848 *** runcommand verify -q
848 *** runcommand verify -q
849
849
850 (failure after finalization)
850 (failure after finalization)
851
851
852 >>> from hgclient import readchannel, runcommand, check
852 >>> from hgclient import readchannel, runcommand, check
853 >>> @check
853 >>> @check
854 ... def abort(server):
854 ... def abort(server):
855 ... readchannel(server)
855 ... readchannel(server)
856 ... runcommand(server, ['commit',
856 ... runcommand(server, ['commit',
857 ... '--config', 'failafterfinalize.fail=true',
857 ... '--config', 'failafterfinalize.fail=true',
858 ... '-mfoo'])
858 ... '-mfoo'])
859 ... runcommand(server, ['log'])
859 ... runcommand(server, ['log'])
860 ... runcommand(server, ['verify', '-q'])
860 ... runcommand(server, ['verify', '-q'])
861 *** runcommand commit --config failafterfinalize.fail=true -mfoo
861 *** runcommand commit --config failafterfinalize.fail=true -mfoo
862 transaction abort!
862 transaction abort!
863 rollback completed
863 rollback completed
864 abort: fail after finalization
864 abort: fail after finalization
865 [255]
865 [255]
866 *** runcommand log
866 *** runcommand log
867 *** runcommand verify -q
867 *** runcommand verify -q
868
868
869 - test failure with "not-empty changelog"
869 - test failure with "not-empty changelog"
870
870
871 $ echo bar > bar
871 $ echo bar > bar
872 $ hg add bar
872 $ hg add bar
873 $ hg commit -mbar bar
873 $ hg commit -mbar bar
874
874
875 (failure before finalization)
875 (failure before finalization)
876
876
877 >>> from hgclient import readchannel, runcommand, check
877 >>> from hgclient import readchannel, runcommand, check
878 >>> @check
878 >>> @check
879 ... def abort(server):
879 ... def abort(server):
880 ... readchannel(server)
880 ... readchannel(server)
881 ... runcommand(server, ['commit',
881 ... runcommand(server, ['commit',
882 ... '--config', 'hooks.pretxncommit=false',
882 ... '--config', 'hooks.pretxncommit=false',
883 ... '-mfoo', 'foo'])
883 ... '-mfoo', 'foo'])
884 ... runcommand(server, ['log'])
884 ... runcommand(server, ['log'])
885 ... runcommand(server, ['verify', '-q'])
885 ... runcommand(server, ['verify', '-q'])
886 *** runcommand commit --config hooks.pretxncommit=false -mfoo foo
886 *** runcommand commit --config hooks.pretxncommit=false -mfoo foo
887 transaction abort!
887 transaction abort!
888 rollback completed
888 rollback completed
889 abort: pretxncommit hook exited with status 1
889 abort: pretxncommit hook exited with status 1
890 [255]
890 [255]
891 *** runcommand log
891 *** runcommand log
892 0 bar (bar)
892 0 bar (bar)
893 *** runcommand verify -q
893 *** runcommand verify -q
894
894
895 (failure after finalization)
895 (failure after finalization)
896
896
897 >>> from hgclient import readchannel, runcommand, check
897 >>> from hgclient import readchannel, runcommand, check
898 >>> @check
898 >>> @check
899 ... def abort(server):
899 ... def abort(server):
900 ... readchannel(server)
900 ... readchannel(server)
901 ... runcommand(server, ['commit',
901 ... runcommand(server, ['commit',
902 ... '--config', 'failafterfinalize.fail=true',
902 ... '--config', 'failafterfinalize.fail=true',
903 ... '-mfoo', 'foo'])
903 ... '-mfoo', 'foo'])
904 ... runcommand(server, ['log'])
904 ... runcommand(server, ['log'])
905 ... runcommand(server, ['verify', '-q'])
905 ... runcommand(server, ['verify', '-q'])
906 *** runcommand commit --config failafterfinalize.fail=true -mfoo foo
906 *** runcommand commit --config failafterfinalize.fail=true -mfoo foo
907 transaction abort!
907 transaction abort!
908 rollback completed
908 rollback completed
909 abort: fail after finalization
909 abort: fail after finalization
910 [255]
910 [255]
911 *** runcommand log
911 *** runcommand log
912 0 bar (bar)
912 0 bar (bar)
913 *** runcommand verify -q
913 *** runcommand verify -q
914
915 $ cd ..
916
917 Test symlink traversal over cached audited paths:
918 -------------------------------------------------
919
920 #if symlink
921
922 set up symlink hell
923
924 $ mkdir merge-symlink-out
925 $ hg init merge-symlink
926 $ cd merge-symlink
927 $ touch base
928 $ hg commit -qAm base
929 $ ln -s ../merge-symlink-out a
930 $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
931 $ hg up -q 0
932 $ mkdir a
933 $ touch a/poisoned
934 $ hg commit -qAm 'file a/poisoned'
935 $ hg log -G -T '{rev}: {desc}\n'
936 @ 2: file a/poisoned
937 |
938 | o 1: symlink a -> ../merge-symlink-out
939 |/
940 o 0: base
941
942
943 try trivial merge after update: cache of audited paths should be discarded,
944 and the merge should fail (issue5628)
945
946 $ hg up -q null
947 >>> from hgclient import readchannel, runcommand, check
948 >>> @check
949 ... def merge(server):
950 ... readchannel(server)
951 ... # audit a/poisoned as a good path
952 ... runcommand(server, ['up', '-qC', '2'])
953 ... runcommand(server, ['up', '-qC', '1'])
954 ... # here a is a symlink, so a/poisoned is bad
955 ... runcommand(server, ['merge', '2'])
956 *** runcommand up -qC 2
957 *** runcommand up -qC 1
958 *** runcommand merge 2
959 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
960 (branch merge, don't forget to commit)
961 $ ls ../merge-symlink-out
962 poisoned
963
964 cache of repo.auditor should be discarded, so matcher would never traverse
965 symlinks:
966
967 $ hg up -qC 0
968 $ touch ../merge-symlink-out/poisoned
969 >>> from hgclient import readchannel, runcommand, check
970 >>> @check
971 ... def files(server):
972 ... readchannel(server)
973 ... runcommand(server, ['up', '-qC', '2'])
974 ... # audit a/poisoned as a good path
975 ... runcommand(server, ['files', 'a/poisoned'])
976 ... runcommand(server, ['up', '-qC', '0'])
977 ... runcommand(server, ['up', '-qC', '1'])
978 ... # here 'a' is a symlink, so a/poisoned should be warned
979 ... runcommand(server, ['files', 'a/poisoned'])
980 *** runcommand up -qC 2
981 *** runcommand files a/poisoned
982 a/poisoned
983 *** runcommand up -qC 0
984 *** runcommand up -qC 1
985 *** runcommand files a/poisoned
986 [1]
987
988 $ cd ..
989
990 #endif
General Comments 0
You need to be logged in to leave comments. Login now