tests/test-http-branchmap.t
author Boris Feld <boris.feld@octobus.net>
Thu, 18 Jan 2018 00:48:56 +0100
changeset 35756 cfdccd560b66
parent 34661 eb586ed5d8ce
child 36312 1e0c9f9f6f36
permissions -rw-r--r--
streamclone: define first iteration of version 2 of stream format (This patch is based on a first draft from Gregory Szorc, with deeper rework) Version 1 of the stream clone format was invented many years ago and suffers from a few deficiencies: 1) Filenames are stored in store-encoded (on filesystem) form rather than in their internal form. This makes future compatibility with new store filename encodings more difficult. 2) File entry "headers" consist of a newline of the file name followed by the string file size. Converting strings to integers is avoidable overhead. We can't store filenames with newlines (manifests have this limitation as well, so it isn't a major concern). But the big concern here is the necessity for readline(). Scanning for newlines means reading ahead and that means extra buffer allocations and slicing (in Python) and this makes performance suffer. 3) Filenames aren't compressed optimally. Filenames should be compressed well since there is a lot of repeated data. However, since they are scattered all over the stream (with revlog data in between), they typically fall outside the window size of the compressor and don't compress. 4) It can only exchange stored based content, being able to exchange caches too would be nice. 5) It is limited to a stream-based protocol and isn't suitable for an on-disk format for general repository reading because the offset of individual file entries requires scanning the entire file to find file records. As part of enabling streaming clones to work in bundle2, #2 proved to have a significant negative impact on performance. Since bundle2 provides the opportunity to start fresh, Gregory Szorc figured he would take the opportunity to invent a new streaming clone data format. The new format devised in this series addresses #1, #2, and #4. It punts on #3 because it was complex without yielding a significant gain and on #5 because devising a new store format that "packs" multiple revlogs into a single "packed revlog" is massive scope bloat. However, this v2 format might be suitable for streaming into a "packed revlog" with minimal processing. If it works, great. If not, we can always invent stream format when it is needed. This patch only introduces the bases of the format. We'll get it usable through bundle2 first, then we'll extend the format in future patches to bring it to its full potential (especially #4).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 17467
diff changeset
     1
#require killdaemons
9879
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
     2
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
     3
  $ hgserve() {
17467
448d0c452140 test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
     4
  >     hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid \
448d0c452140 test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
     5
  >       -E errors.log -v $@ > startup.log
448d0c452140 test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
     6
  >     # Grepping hg serve stdout would hang on Windows
448d0c452140 test-http-branchmap: enable on Windows
Patrick Mezard <patrick@mezard.eu>
parents: 15623
diff changeset
     7
  >     grep -v 'listening at' startup.log
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
     8
  >     cat hg.pid >> "$DAEMON_PIDS"
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
     9
  > }
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    10
  $ hg init a
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    11
  $ hg --encoding utf-8 -R a branch æ
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12700
diff changeset
    12
  marked working directory as branch \xc3\xa6 (esc)
15615
41885892796e branch: warn on branching
Matt Mackall <mpm@selenic.com>
parents: 14647
diff changeset
    13
  (branches are permanent and global, did you want a bookmark?)
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    14
  $ echo foo > a/foo
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    15
  $ hg -R a ci -Am foo
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    16
  adding foo
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    17
  $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    18
  $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    19
  requesting all changes
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    20
  adding changesets
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    21
  adding manifests
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    22
  adding file changes
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    23
  added 1 changesets with 1 changes to 1 files
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33335
diff changeset
    24
  new changesets 867c11ce77b8
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12700
diff changeset
    25
  updating to branch \xc3\xa6 (esc)
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    26
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    27
  $ hg --encoding utf-8 -R b log
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    28
  changeset:   0:867c11ce77b8
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12700
diff changeset
    29
  branch:      \xc3\xa6 (esc)
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    30
  tag:         tip
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    31
  user:        test
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    32
  date:        Thu Jan 01 00:00:00 1970 +0000
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    33
  summary:     foo
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    34
  
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    35
  $ echo bar >> b/foo
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    36
  $ hg -R b ci -m bar
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    37
  $ hg --encoding utf-8 -R b push
13815
d066d8d652c8 url: add trailing slashes to URLs with hostnames that don't have one
Brodie Rao <brodie@bitheap.org>
parents: 12942
diff changeset
    38
  pushing to http://localhost:$HGPORT1/
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    39
  searching for changes
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    40
  remote: adding changesets
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    41
  remote: adding manifests
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    42
  remote: adding file changes
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    43
  remote: added 1 changesets with 1 changes to 1 files
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    44
  $ hg -R a --encoding utf-8 log
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    45
  changeset:   1:58e7c90d67cb
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12700
diff changeset
    46
  branch:      \xc3\xa6 (esc)
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    47
  tag:         tip
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    48
  user:        test
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    49
  date:        Thu Jan 01 00:00:00 1970 +0000
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    50
  summary:     bar
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    51
  
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    52
  changeset:   0:867c11ce77b8
12942
05fffd665170 tests: use (esc) for all non-ASCII test output
Mads Kiilerich <mads@kiilerich.com>
parents: 12700
diff changeset
    53
  branch:      \xc3\xa6 (esc)
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    54
  user:        test
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    55
  date:        Thu Jan 01 00:00:00 1970 +0000
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    56
  summary:     foo
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    57
  
25472
4d2b9b304ad0 tests: drop explicit $TESTDIR from executables
Matt Mackall <mpm@selenic.com>
parents: 22046
diff changeset
    58
  $ killdaemons.py hg.pid
9879
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    59
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    60
verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
9879
7bb004fc14ec Extend test-branchmap to test c51494c53841
Thomas Arendsen Hein <thomas@intevation.de>
parents: 9789
diff changeset
    61
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    62
  $ cat <<EOF > oldhg
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    63
  > import sys
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    64
  > from mercurial import ui, hg, commands
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    65
  > 
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    66
  > class StdoutWrapper(object):
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    67
  >     def __init__(self, stdout):
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    68
  >         self._file = stdout
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    69
  > 
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    70
  >     def write(self, data):
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    71
  >         if data == '47\n':
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    72
  >             # latin1 encoding is one %xx (3 bytes) shorter
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    73
  >             data = '44\n'
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    74
  >         elif data.startswith('%C3%A6 '):
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    75
  >             # translate to latin1 encoding
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    76
  >             data = '%%E6 %s' % data[7:]
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    77
  >         self._file.write(data)
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    78
  > 
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    79
  >     def __getattr__(self, name):
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    80
  >         return getattr(self._file, name)
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    81
  > 
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    82
  > sys.stdout = StdoutWrapper(sys.stdout)
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    83
  > sys.stderr = StdoutWrapper(sys.stderr)
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    84
  > 
30564
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 25472
diff changeset
    85
  > myui = ui.ui.load()
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    86
  > repo = hg.repository(myui, 'a')
14647
2e9f379de0ac serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents: 13815
diff changeset
    87
  > commands.serve(myui, repo, stdio=True, cmdserver=False)
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    88
  > EOF
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    89
  $ echo baz >> b/foo
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    90
  $ hg -R b ci -m baz
33335
72f051f9a7d8 tests: quote $PYTHON for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 33286
diff changeset
    91
  $ hg push -R b -e "\"$PYTHON\" oldhg" ssh://dummy/ --encoding latin1
12447
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    92
  pushing to ssh://dummy/
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    93
  searching for changes
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    94
  remote: adding changesets
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    95
  remote: adding manifests
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    96
  remote: adding file changes
f5f90d3808e2 tests: unify test-http-branchmap
Matt Mackall <mpm@selenic.com>
parents: 11617
diff changeset
    97
  remote: added 1 changesets with 1 changes to 1 files