tests/test-clone-update-order.t
author Augie Fackler <augie@google.com>
Tue, 30 Jun 2015 19:19:17 -0400
changeset 25708 d3d32643c060
parent 25295 701df761aa94
child 34661 eb586ed5d8ce
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.

  $ hg init
  $ echo foo > bar
  $ hg commit -Am default
  adding bar
  $ hg up -r null
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg branch mine
  marked working directory as branch mine
  (branches are permanent and global, did you want a bookmark?)
  $ echo hello > world
  $ hg commit -Am hello
  adding world
  $ hg up -r null
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg branch other
  marked working directory as branch other
  $ echo good > bye
  $ hg commit -Am other
  adding bye
  $ hg up -r mine
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved

  $ hg clone -U -u . .#other ../b -r 0 -r 1 -r 2 -b other
  abort: cannot specify both --noupdate and --updaterev
  [255]

  $ hg clone -U .#other ../b -r 0 -r 1 -r 2 -b other
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 3 files (+2 heads)
  $ rm -rf ../b

  $ hg clone -u . .#other ../b -r 0 -r 1 -r 2 -b other
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 3 files (+2 heads)
  updating to branch mine
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b

  $ hg clone -u 0 .#other ../b -r 0 -r 1 -r 2 -b other
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 3 files (+2 heads)
  updating to branch default
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b

  $ hg clone -u 1 .#other ../b -r 0 -r 1 -r 2 -b other
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 3 files (+2 heads)
  updating to branch mine
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b

  $ hg clone -u 2 .#other ../b -r 0 -r 1 -r 2 -b other
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 3 files (+2 heads)
  updating to branch other
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b

Test -r mine ... mine is ignored:

  $ hg clone -u 2 .#other ../b -r mine -r 0 -r 1 -r 2 -b other
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 3 files (+2 heads)
  updating to branch other
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b

  $ hg clone .#other ../b -b default -b mine
  adding changesets
  adding manifests
  adding file changes
  added 3 changesets with 3 changes to 3 files (+2 heads)
  updating to branch default
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b

  $ hg clone .#other ../b
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files
  updating to branch other
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b

  $ hg clone -U . ../c -r 1 -r 2 > /dev/null
  $ hg clone ../c ../b
  updating to branch other
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ rm -rf ../b ../c