##// END OF EJS Templates
tests: show cache of audited paths is never invalidated
Yuya Nishihara -
r33704:0134d839 stable
parent child Browse files
Show More
@@ -129,3 +129,104 b' attack /tmp/test'
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
@@ -911,3 +911,80 b' cases.'
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