tests/test-pull.t
author Augie Fackler <augie@google.com>
Tue, 30 Jun 2015 19:19:17 -0400
changeset 25708 d3d32643c060
parent 24205 abcb1ee3b20a
child 26604 a3fcc8e3136b
permissions -rw-r--r--
wireproto: correctly escape batched args and responses (issue4739) This issue appears to be as old as wireproto batching itself: I can reproduce the failure as far back as 08ef6b5f3715 trivially by rebasing the test changes in this patch, which was back in the 1.9 era. I didn't test before that change, because prior to that the testfile has a different name and I'm lazy. Note that the test thought it was checking this case, but it actually wasn't: it put a literal ; in the arg and response for its greet command, but the mangle/unmangle step defined in the test meant that instead of "Fo, =;o" going over the wire, "Gp-!><p" went instead, which doesn't contain any special characters (those being [.=;]) and thus not exercising the escaping. The test has been updated to use pre-unmangled special characters, so the request is now "Fo+<:o", which mangles to "Gp,=;p". I have confirmed that the test fails without the adjustment to the escaping rules in wireproto.py. No existing clients of RPC batching were depending on the old behavior in any way. The only *actual* users of batchable RPCs in core were: 1) largefiles, wherein it batches up many statlfile calls. It sends hexlified hashes over the wire and gets a 0, 1, or 2 back as a response. No risk of special characters. 2) setdiscovery, which was using heads() and known(), both of which communicate via hexlified nodes. Again, no risk of special characters. Since the escaping functionality has been completely broken since it was introduced, we know that it has no users. As such, we can change the escaping mechanism without having to worry about backwards compatibility issues. For the curious, this was detected by chance: it happens that the lz4-compressed text of a test file for remotefilelog compressed to something containing a ;, which then caused the failure when I moved remotefilelog to using batching for file content fetching.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 17486
diff changeset
     1
#require serve
15446
c5c9ca3719f9 tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents: 13956
diff changeset
     2
13956
ffb5c09ba822 tests: remove redundant mkdir
Martin Geisler <mg@lazybytes.net>
parents: 13826
diff changeset
     3
  $ hg init test
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
     4
  $ cd test
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
     5
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
     6
  $ echo foo>foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
     7
  $ hg addremove
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
     8
  adding foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
     9
  $ hg commit -m 1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    10
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    11
  $ hg verify
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    12
  checking changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    13
  checking manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    14
  crosschecking files in changesets and manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    15
  checking files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    16
  1 files, 1 changesets, 1 total revisions
336
aa6cbde09f72 Add some more tests
mpm@selenic.com
parents:
diff changeset
    17
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    18
  $ hg serve -p $HGPORT -d --pid-file=hg.pid
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    19
  $ cat hg.pid >> $DAEMON_PIDS
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    20
  $ cd ..
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    21
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
    22
  $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    23
  requesting all changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    24
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    25
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    26
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    27
  added 1 changesets with 1 changes to 1 files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    28
  updating to branch default
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    29
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    30
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    31
  $ cd copy
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    32
  $ hg verify
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    33
  checking changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    34
  checking manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    35
  crosschecking files in changesets and manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    36
  checking files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    37
  1 files, 1 changesets, 1 total revisions
336
aa6cbde09f72 Add some more tests
mpm@selenic.com
parents:
diff changeset
    38
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    39
  $ hg co
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    40
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    41
  $ cat foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    42
  foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    43
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    44
  $ hg manifest --debug
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    45
  2ed2a3912a0b24502043eae84ee4b279c18b90dd 644   foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    46
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
    47
  $ hg pull
15552
62c9183a0bbb clone: don't save user's password in .hg/hgrc (Issue3122)
Augie Fackler <durin42@gmail.com>
parents: 13956
diff changeset
    48
  pulling from http://foo@localhost:$HGPORT/
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    49
  searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    50
  no changes found
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    51
12366
c01dc9087d9a tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents: 12328
diff changeset
    52
  $ hg rollback --dry-run --verbose
13446
1e497df514e2 rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents: 12643
diff changeset
    53
  repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    54
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12377
diff changeset
    55
Issue622: hg init && hg pull -u URL doesn't checkout default branch
4891
2d545b98a7bc issue 622: pull/unbundle -u updates to default branch if repo was empty
Bryan O'Sullivan <bos@serpentine.com>
parents: 3736
diff changeset
    56
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    57
  $ cd ..
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    58
  $ hg init empty
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    59
  $ cd empty
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    60
  $ hg pull -u ../test
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    61
  pulling from ../test
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    62
  requesting all changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    63
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    64
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    65
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    66
  added 1 changesets with 1 changes to 1 files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    67
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
9996
2770d03ae49f handle file URIs correctly, according to RFC 2396 (issue1153)
Sune Foldager <cryo@cyanite.org>
parents: 5384
diff changeset
    68
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    69
Test 'file:' uri handling:
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    70
17486
73e3e368bd42 spelling: doesn't/does not
timeless@mozdev.org
parents: 16913
diff changeset
    71
  $ hg pull -q file://../test-does-not-exist
13823
ad179644750f hg: look up schemes using url.url
Brodie Rao <brodie@bitheap.org>
parents: 13817
diff changeset
    72
  abort: file:// URLs can only refer to localhost
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12279
diff changeset
    73
  [255]
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    74
13826
e574207e3bcd url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents: 13823
diff changeset
    75
  $ hg pull -q file://../test
e574207e3bcd url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents: 13823
diff changeset
    76
  abort: file:// URLs can only refer to localhost
e574207e3bcd url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents: 13823
diff changeset
    77
  [255]
e574207e3bcd url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
Brodie Rao <brodie@bitheap.org>
parents: 13823
diff changeset
    78
24205
abcb1ee3b20a check-code: allow disabling msys path check
Matt Mackall <mpm@selenic.com>
parents: 22947
diff changeset
    79
  $ hg pull -q file:../test  # no-msys
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    80
12328
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
    81
It's tricky to make file:// URLs working on every platform with
b63f6422d2a7 tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
    82
regular shell commands.
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    83
22947
c63a09b6b337 tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents: 22046
diff changeset
    84
  $ URL=`$PYTHON -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    85
  $ hg pull -q "$URL"
13817
7f18bab2c0b0 url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents: 13446
diff changeset
    86
  abort: file:// URLs can only refer to localhost
7f18bab2c0b0 url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents: 13446
diff changeset
    87
  [255]
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 10886
diff changeset
    88
22947
c63a09b6b337 tests: use $PYTHON instead of hardcoding python
Augie Fackler <raf@durin42.com>
parents: 22046
diff changeset
    89
  $ URL=`$PYTHON -c "import os; print 'file://localhost' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
13817
7f18bab2c0b0 url: abort on file:// URLs with non-localhost hosts
Brodie Rao <brodie@bitheap.org>
parents: 13446
diff changeset
    90
  $ hg pull -q "$URL"
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16107
diff changeset
    91
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16107
diff changeset
    92
  $ cd ..