| 1 |
================================== |
| 2 |
Basic testing for the push command |
| 3 |
================================== |
| 4 |
|
| 5 |
Testing of the '--rev' flag |
| 6 |
=========================== |
| 7 |
|
| 8 |
$ hg init test-revflag |
| 9 |
$ hg -R test-revflag unbundle "$TESTDIR/bundles/remote.hg" |
| 10 |
adding changesets |
| 11 |
adding manifests |
| 12 |
adding file changes |
| 13 |
added 9 changesets with 7 changes to 4 files (+1 heads) |
| 14 |
new changesets bfaf4b5cbf01:916f1afdef90 (9 drafts) |
| 15 |
(run 'hg heads' to see heads, 'hg merge' to merge) |
| 16 |
|
| 17 |
$ for i in 0 1 2 3 4 5 6 7 8; do |
| 18 |
> echo |
| 19 |
> hg init test-revflag-"$i" |
| 20 |
> hg -R test-revflag push -r "$i" test-revflag-"$i" |
| 21 |
> hg -R test-revflag-"$i" verify -q |
| 22 |
> done |
| 23 |
|
| 24 |
pushing to test-revflag-0 |
| 25 |
searching for changes |
| 26 |
adding changesets |
| 27 |
adding manifests |
| 28 |
adding file changes |
| 29 |
added 1 changesets with 1 changes to 1 files |
| 30 |
|
| 31 |
pushing to test-revflag-1 |
| 32 |
searching for changes |
| 33 |
adding changesets |
| 34 |
adding manifests |
| 35 |
adding file changes |
| 36 |
added 2 changesets with 2 changes to 1 files |
| 37 |
|
| 38 |
pushing to test-revflag-2 |
| 39 |
searching for changes |
| 40 |
adding changesets |
| 41 |
adding manifests |
| 42 |
adding file changes |
| 43 |
added 3 changesets with 3 changes to 1 files |
| 44 |
|
| 45 |
pushing to test-revflag-3 |
| 46 |
searching for changes |
| 47 |
adding changesets |
| 48 |
adding manifests |
| 49 |
adding file changes |
| 50 |
added 4 changesets with 4 changes to 1 files |
| 51 |
|
| 52 |
pushing to test-revflag-4 |
| 53 |
searching for changes |
| 54 |
adding changesets |
| 55 |
adding manifests |
| 56 |
adding file changes |
| 57 |
added 2 changesets with 2 changes to 1 files |
| 58 |
|
| 59 |
pushing to test-revflag-5 |
| 60 |
searching for changes |
| 61 |
adding changesets |
| 62 |
adding manifests |
| 63 |
adding file changes |
| 64 |
added 3 changesets with 3 changes to 1 files |
| 65 |
|
| 66 |
pushing to test-revflag-6 |
| 67 |
searching for changes |
| 68 |
adding changesets |
| 69 |
adding manifests |
| 70 |
adding file changes |
| 71 |
added 4 changesets with 5 changes to 2 files |
| 72 |
|
| 73 |
pushing to test-revflag-7 |
| 74 |
searching for changes |
| 75 |
adding changesets |
| 76 |
adding manifests |
| 77 |
adding file changes |
| 78 |
added 5 changesets with 6 changes to 3 files |
| 79 |
|
| 80 |
pushing to test-revflag-8 |
| 81 |
searching for changes |
| 82 |
adding changesets |
| 83 |
adding manifests |
| 84 |
adding file changes |
| 85 |
added 5 changesets with 5 changes to 2 files |
| 86 |
|
| 87 |
$ cd test-revflag-8 |
| 88 |
|
| 89 |
$ hg pull ../test-revflag-7 |
| 90 |
pulling from ../test-revflag-7 |
| 91 |
searching for changes |
| 92 |
adding changesets |
| 93 |
adding manifests |
| 94 |
adding file changes |
| 95 |
added 4 changesets with 2 changes to 3 files (+1 heads) |
| 96 |
new changesets c70afb1ee985:faa2e4234c7a |
| 97 |
(run 'hg heads' to see heads, 'hg merge' to merge) |
| 98 |
|
| 99 |
$ hg verify -q |
| 100 |
|
| 101 |
$ cd .. |
| 102 |
|
| 103 |
Test server side validation during push |
| 104 |
======================================= |
| 105 |
|
| 106 |
$ hg init test-validation |
| 107 |
$ cd test-validation |
| 108 |
|
| 109 |
$ cat > .hg/hgrc <<EOF |
| 110 |
> [server] |
| 111 |
> validate=1 |
| 112 |
> EOF |
| 113 |
|
| 114 |
$ echo alpha > alpha |
| 115 |
$ echo beta > beta |
| 116 |
$ hg addr |
| 117 |
adding alpha |
| 118 |
adding beta |
| 119 |
$ hg ci -m 1 |
| 120 |
|
| 121 |
$ cd .. |
| 122 |
$ hg clone test-validation test-validation-clone |
| 123 |
updating to branch default |
| 124 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 125 |
|
| 126 |
|
| 127 |
Test spurious filelog entries: |
| 128 |
|
| 129 |
$ cd test-validation-clone |
| 130 |
$ echo blah >> beta |
| 131 |
$ cp .hg/store/data/beta.i tmp1 |
| 132 |
$ hg ci -m 2 |
| 133 |
$ cp .hg/store/data/beta.i tmp2 |
| 134 |
$ hg -q rollback |
| 135 |
$ mv tmp2 .hg/store/data/beta.i |
| 136 |
$ echo blah >> beta |
| 137 |
$ hg ci -m '2 (corrupt)' |
| 138 |
|
| 139 |
Expected to fail: |
| 140 |
|
| 141 |
$ hg verify -q |
| 142 |
beta@1: dddc47b3ba30 not in manifests |
| 143 |
not checking dirstate because of previous errors |
| 144 |
1 integrity errors encountered! |
| 145 |
(first damaged changeset appears to be 1) |
| 146 |
[1] |
| 147 |
|
| 148 |
$ hg push |
| 149 |
pushing to $TESTTMP/test-validation |
| 150 |
searching for changes |
| 151 |
adding changesets |
| 152 |
adding manifests |
| 153 |
adding file changes |
| 154 |
transaction abort! |
| 155 |
rollback completed |
| 156 |
abort: received spurious file revlog entry |
| 157 |
[255] |
| 158 |
|
| 159 |
$ hg -q rollback |
| 160 |
$ mv tmp1 .hg/store/data/beta.i |
| 161 |
$ echo beta > beta |
| 162 |
|
| 163 |
Test missing filelog entries: |
| 164 |
|
| 165 |
$ cp .hg/store/data/beta.i tmp |
| 166 |
$ echo blah >> beta |
| 167 |
$ hg ci -m '2 (corrupt)' |
| 168 |
$ mv tmp .hg/store/data/beta.i |
| 169 |
|
| 170 |
Expected to fail: |
| 171 |
|
| 172 |
$ hg verify -q |
| 173 |
beta@1: manifest refers to unknown revision dddc47b3ba30 |
| 174 |
not checking dirstate because of previous errors |
| 175 |
1 integrity errors encountered! |
| 176 |
(first damaged changeset appears to be 1) |
| 177 |
[1] |
| 178 |
|
| 179 |
$ hg push |
| 180 |
pushing to $TESTTMP/test-validation |
| 181 |
searching for changes |
| 182 |
adding changesets |
| 183 |
adding manifests |
| 184 |
adding file changes |
| 185 |
transaction abort! |
| 186 |
rollback completed |
| 187 |
abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify |
| 188 |
[255] |
| 189 |
|
| 190 |
$ cd .. |
| 191 |
|
| 192 |
Test push hook locking |
| 193 |
===================== |
| 194 |
|
| 195 |
$ hg init 1 |
| 196 |
|
| 197 |
$ echo '[ui]' >> 1/.hg/hgrc |
| 198 |
$ echo 'timeout = 10' >> 1/.hg/hgrc |
| 199 |
|
| 200 |
$ echo foo > 1/foo |
| 201 |
$ hg --cwd 1 ci -A -m foo |
| 202 |
adding foo |
| 203 |
|
| 204 |
$ hg clone 1 2 |
| 205 |
updating to branch default |
| 206 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 207 |
|
| 208 |
$ hg clone 2 3 |
| 209 |
updating to branch default |
| 210 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 211 |
|
| 212 |
$ cat <<EOF > $TESTTMP/debuglocks-pretxn-hook.sh |
| 213 |
> hg debuglocks |
| 214 |
> true |
| 215 |
> EOF |
| 216 |
$ echo '[hooks]' >> 2/.hg/hgrc |
| 217 |
$ echo "pretxnchangegroup.a = sh $TESTTMP/debuglocks-pretxn-hook.sh" >> 2/.hg/hgrc |
| 218 |
$ echo 'changegroup.push = hg push -qf ../1' >> 2/.hg/hgrc |
| 219 |
|
| 220 |
$ echo bar >> 3/foo |
| 221 |
$ hg --cwd 3 ci -m bar |
| 222 |
|
| 223 |
$ hg --cwd 3 push ../2 --config devel.legacy.exchange=bundle1 |
| 224 |
pushing to ../2 |
| 225 |
searching for changes |
| 226 |
adding changesets |
| 227 |
adding manifests |
| 228 |
adding file changes |
| 229 |
lock: user *, process * (*s) (glob) |
| 230 |
wlock: free |
| 231 |
added 1 changesets with 1 changes to 1 files |
| 232 |
|
| 233 |
$ hg --cwd 1 --config extensions.strip= strip tip -q |
| 234 |
$ hg --cwd 2 --config extensions.strip= strip tip -q |
| 235 |
$ hg --cwd 3 push ../2 # bundle2+ |
| 236 |
pushing to ../2 |
| 237 |
searching for changes |
| 238 |
adding changesets |
| 239 |
adding manifests |
| 240 |
adding file changes |
| 241 |
lock: user *, process * (*s) (glob) |
| 242 |
wlock: user *, process * (*s) (glob) |
| 243 |
added 1 changesets with 1 changes to 1 files |
| 244 |
|
| 245 |
Test bare push with multiple race checking options |
| 246 |
-------------------------------------------------- |
| 247 |
|
| 248 |
$ hg init test-bare-push-no-concurrency |
| 249 |
$ hg init test-bare-push-unrelated-concurrency |
| 250 |
$ hg -R test-revflag push -r 0 test-bare-push-no-concurrency --config server.concurrent-push-mode=strict |
| 251 |
pushing to test-bare-push-no-concurrency |
| 252 |
searching for changes |
| 253 |
adding changesets |
| 254 |
adding manifests |
| 255 |
adding file changes |
| 256 |
added 1 changesets with 1 changes to 1 files |
| 257 |
$ hg -R test-revflag push -r 0 test-bare-push-unrelated-concurrency --config server.concurrent-push-mode=check-related |
| 258 |
pushing to test-bare-push-unrelated-concurrency |
| 259 |
searching for changes |
| 260 |
adding changesets |
| 261 |
adding manifests |
| 262 |
adding file changes |
| 263 |
added 1 changesets with 1 changes to 1 files |
| 264 |
|
| 265 |
SEC: check for unsafe ssh url |
| 266 |
|
| 267 |
$ cat >> $HGRCPATH << EOF |
| 268 |
> [ui] |
| 269 |
> ssh = sh -c "read l; read l; read l" |
| 270 |
> EOF |
| 271 |
|
| 272 |
$ hg -R test-revflag push 'ssh://-oProxyCommand=touch${IFS}owned/path' |
| 273 |
pushing to ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path |
| 274 |
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
| 275 |
[255] |
| 276 |
$ hg -R test-revflag push 'ssh://%2DoProxyCommand=touch${IFS}owned/path' |
| 277 |
pushing to ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path |
| 278 |
abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path' |
| 279 |
[255] |
| 280 |
$ hg -R test-revflag push 'ssh://fakehost|touch${IFS}owned/path' |
| 281 |
pushing to ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path |
| 282 |
abort: no suitable response from remote hg |
| 283 |
[255] |
| 284 |
$ hg -R test-revflag push 'ssh://fakehost%7Ctouch%20owned/path' |
| 285 |
pushing to ssh://fakehost%7Ctouch%20owned/path |
| 286 |
abort: no suitable response from remote hg |
| 287 |
[255] |
| 288 |
|
| 289 |
$ [ ! -f owned ] || echo 'you got owned' |
| 290 |
|
| 291 |
Test `commands.push.require-revs` |
| 292 |
--------------------------------- |
| 293 |
|
| 294 |
$ hg clone -q test-revflag test-require-revs-source |
| 295 |
$ hg init test-require-revs-dest |
| 296 |
$ cd test-require-revs-source |
| 297 |
$ cat >> .hg/hgrc << EOF |
| 298 |
> [paths] |
| 299 |
> default = ../test-require-revs-dest |
| 300 |
> [commands] |
| 301 |
> push.require-revs=1 |
| 302 |
> EOF |
| 303 |
$ hg push |
| 304 |
pushing to $TESTTMP/test-require-revs-dest |
| 305 |
abort: no revisions specified to push |
| 306 |
(did you mean "hg push -r ."?) |
| 307 |
[10] |
| 308 |
$ hg push -r 0 |
| 309 |
pushing to $TESTTMP/test-require-revs-dest |
| 310 |
searching for changes |
| 311 |
adding changesets |
| 312 |
adding manifests |
| 313 |
adding file changes |
| 314 |
added 1 changesets with 1 changes to 1 files |
| 315 |
$ hg bookmark -r 0 push-this-bookmark |
| 316 |
(test that -B (bookmark) works for specifying "revs") |
| 317 |
$ hg push -B push-this-bookmark |
| 318 |
pushing to $TESTTMP/test-require-revs-dest |
| 319 |
searching for changes |
| 320 |
no changes found |
| 321 |
exporting bookmark push-this-bookmark |
| 322 |
[1] |
| 323 |
(test that -b (branch) works for specifying "revs") |
| 324 |
$ hg push -b default |
| 325 |
pushing to $TESTTMP/test-require-revs-dest |
| 326 |
searching for changes |
| 327 |
abort: push creates new remote head [0-9a-f]+ (re) |
| 328 |
(merge or see 'hg help push' for details about pushing new heads) |
| 329 |
[20] |
| 330 |
(demonstrate that even though we don't have anything to exchange, we're still |
| 331 |
showing the error) |
| 332 |
$ hg push |
| 333 |
pushing to $TESTTMP/test-require-revs-dest |
| 334 |
abort: no revisions specified to push |
| 335 |
(did you mean "hg push -r ."?) |
| 336 |
[10] |
| 337 |
$ hg push --config paths.default:pushrev=0 |
| 338 |
pushing to $TESTTMP/test-require-revs-dest |
| 339 |
searching for changes |
| 340 |
no changes found |
| 341 |
[1] |