tests/test-push-hook-lock.t
author Gregory Szorc <gregory.szorc@gmail.com>
Tue, 13 Oct 2015 11:45:30 -0700
changeset 26644 74de1c59f71c
parent 25126 00e4c5601c74
child 29701 ac9b85079122
permissions -rw-r--r--
clonebundles: filter on bundle specification Not all clients are capable of reading every bundle. Currently, content negotiation to ensure a server sends a client a compatible bundle format is performed at request time. The response bundle is dynamically generated at request time, so this works fine. Clone bundles are statically generated *before* the request. This means that a modern server could produce bundles that a legacy client isn't capable of reading. Without some kind of "type hint" in the clone bundles manifest, a client may attempt to download an incompatible bundle. Furthermore, a client may not realize a bundle is incompatible until it has processed part of the bundle (imagine consuming a 1 GB changegroup bundle2 part only to discover the bundle2 part afterwards is incompatibl). This would waste time and resources. And it isn't very user friendly. Clone bundle manifests thus need to advertise the *exact* format of the hosted bundles so clients may filter out entries that they don't know how to read. This patch introduces that mechanism. We introduce the BUNDLESPEC attribute to declare the "bundle specification" of the entry. Bundle specifications are parsed using exchange.parsebundlespecification, which uses the same strings as the "--type" argument to `hg bundle`. The supported bundle specifications are well defined and backwards compatible. When a client encounters a BUNDLESPEC that is invalid or unsupported, it silently ignores the entry.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     1
  $ hg init 1
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     3
  $ echo '[ui]' >> 1/.hg/hgrc
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     4
  $ echo 'timeout = 10' >> 1/.hg/hgrc
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     5
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     6
  $ echo foo > 1/foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     7
  $ hg --cwd 1 ci -A -m foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     8
  adding foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
     9
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    10
  $ hg clone 1 2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    11
  updating to branch default
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    12
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    13
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    14
  $ hg clone 2 3
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    15
  updating to branch default
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    16
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    17
23349
7dd1870120b2 tests: move a multi-statement debuglocks hook into a shell script for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 22559
diff changeset
    18
  $ cat <<EOF > $TESTTMP/debuglocks-pretxn-hook.sh
7dd1870120b2 tests: move a multi-statement debuglocks hook into a shell script for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 22559
diff changeset
    19
  > hg debuglocks
7dd1870120b2 tests: move a multi-statement debuglocks hook into a shell script for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 22559
diff changeset
    20
  > true
7dd1870120b2 tests: move a multi-statement debuglocks hook into a shell script for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 22559
diff changeset
    21
  > EOF
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    22
  $ echo '[hooks]' >> 2/.hg/hgrc
23349
7dd1870120b2 tests: move a multi-statement debuglocks hook into a shell script for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 22559
diff changeset
    23
  $ echo "pretxnchangegroup.a = sh $TESTTMP/debuglocks-pretxn-hook.sh" >> 2/.hg/hgrc
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    24
  $ echo 'changegroup.push = hg push -qf ../1' >> 2/.hg/hgrc
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    25
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    26
  $ echo bar >> 3/foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    27
  $ hg --cwd 3 ci -m bar
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    28
25126
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    29
  $ hg --cwd 3 push ../2 --config experimental.bundle2-exp=False
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    30
  pushing to ../2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    31
  searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    32
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    33
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    34
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    35
  added 1 changesets with 1 changes to 1 files
22559
4e0b696a1cb3 commands: add debuglocks to report/clear lock state
Matt Mackall <mpm@selenic.com>
parents: 12279
diff changeset
    36
  lock:  user *, process * (*s) (glob)
4e0b696a1cb3 commands: add debuglocks to report/clear lock state
Matt Mackall <mpm@selenic.com>
parents: 12279
diff changeset
    37
  wlock: free
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 1839
diff changeset
    38
25126
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    39
  $ hg --cwd 1 --config extensions.strip= strip tip -q
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    40
  $ hg --cwd 2 --config extensions.strip= strip tip -q
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    41
  $ hg --cwd 3 push ../2 --config experimental.bundle2-exp=True
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    42
  pushing to ../2
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    43
  searching for changes
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    44
  adding changesets
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    45
  adding manifests
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    46
  adding file changes
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    47
  added 1 changesets with 1 changes to 1 files
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    48
  lock:  user *, process * (*s) (glob)
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    49
  wlock: user *, process * (*s) (glob)
00e4c5601c74 test: test both bundle1 and bundle2 paths in 'test-push-hook-lock.t'
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 23349
diff changeset
    50