tests/test-flagprocessor.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 10 Mar 2018 10:20:51 -0800
changeset 36806 69b2d0900cd7
parent 35393 4441705b7111
child 37436 9d4f09bfe3ec
permissions -rw-r--r--
hgweb: parse WSGI request into a data structure Currently, our WSGI applications (hgweb_mod and hgwebdir_mod) process the raw WSGI request instance themselves. This means they have to talk in terms of system strings. And they need to know details about what's in the WSGI request. And in the case of hgweb_mod, it is doing some very funky things with URL parsing to impact dispatching. The code is difficult to read and maintain. This commit introduces parsing of the WSGI request into a higher-level and easier-to-reason-about data structure. To prove it works, we hook it up to hgweb_mod and use it for populating the relative URL on the request instance. We hold off on using it in more places because the logic in hgweb_mod is crazy and I don't want to involve those changes with review of the parsing code. The URL construction code has variations that use the HTTP: Host header (the canonical WSGI way of reconstructing the URL) and with the use of SERVER_NAME. We need to differentiate because hgweb is currently using SERVER_NAME for URL construction. Differential Revision: https://phab.mercurial-scm.org/D2734
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30745
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     1
# Create server
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     2
  $ hg init server
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     3
  $ cd server
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     4
  $ cat >> .hg/hgrc << EOF
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     5
  > [extensions]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     6
  > extension=$TESTDIR/flagprocessorext.py
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     7
  > EOF
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     8
  $ cd ../
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
     9
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    10
# Clone server and enable extensions
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    11
  $ hg clone -q server client
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    12
  $ cd client
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    13
  $ cat >> .hg/hgrc << EOF
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    14
  > [extensions]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    15
  > extension=$TESTDIR/flagprocessorext.py
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    16
  > EOF
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    17
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    18
# Commit file that will trigger the noop extension
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    19
  $ echo '[NOOP]' > noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    20
  $ hg commit -Aqm "noop"
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    21
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    22
# Commit file that will trigger the base64 extension
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    23
  $ echo '[BASE64]' > base64
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    24
  $ hg commit -Aqm 'base64'
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    25
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    26
# Commit file that will trigger the gzip extension
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    27
  $ echo '[GZIP]' > gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    28
  $ hg commit -Aqm 'gzip'
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    29
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    30
# Commit file that will trigger noop and base64
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    31
  $ echo '[NOOP][BASE64]' > noop-base64
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    32
  $ hg commit -Aqm 'noop+base64'
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    33
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    34
# Commit file that will trigger noop and gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    35
  $ echo '[NOOP][GZIP]' > noop-gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    36
  $ hg commit -Aqm 'noop+gzip'
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    37
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    38
# Commit file that will trigger base64 and gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    39
  $ echo '[BASE64][GZIP]' > base64-gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    40
  $ hg commit -Aqm 'base64+gzip'
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    41
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    42
# Commit file that will trigger base64, gzip and noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    43
  $ echo '[BASE64][GZIP][NOOP]' > base64-gzip-noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    44
  $ hg commit -Aqm 'base64+gzip+noop'
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    45
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    46
# TEST: ensure the revision data is consistent
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    47
  $ hg cat noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    48
  [NOOP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    49
  $ hg debugdata noop 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    50
  [NOOP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    51
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    52
  $ hg cat -r . base64
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    53
  [BASE64]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    54
  $ hg debugdata base64 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    55
  W0JBU0U2NF0K (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    56
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    57
  $ hg cat -r . gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    58
  [GZIP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    59
  $ hg debugdata gzip 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    60
  x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    61
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    62
  $ hg cat -r . noop-base64
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    63
  [NOOP][BASE64]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    64
  $ hg debugdata noop-base64 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    65
  W05PT1BdW0JBU0U2NF0K (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    66
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    67
  $ hg cat -r . noop-gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    68
  [NOOP][GZIP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    69
  $ hg debugdata noop-gzip 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    70
  x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    71
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    72
  $ hg cat -r . base64-gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    73
  [BASE64][GZIP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    74
  $ hg debugdata base64-gzip 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    75
  eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    76
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    77
  $ hg cat -r . base64-gzip-noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    78
  [BASE64][GZIP][NOOP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    79
  $ hg debugdata base64-gzip-noop 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    80
  eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    81
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    82
# Push to the server
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    83
  $ hg push
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34845
diff changeset
    84
  pushing to $TESTTMP/server
30745
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    85
  searching for changes
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    86
  adding changesets
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    87
  adding manifests
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    88
  adding file changes
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    89
  added 7 changesets with 7 changes to 7 files
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    90
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    91
# Initialize new client (not cloning) and setup extension
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    92
  $ cd ..
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    93
  $ hg init client2
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    94
  $ cd client2
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    95
  $ cat >> .hg/hgrc << EOF
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    96
  > [paths]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    97
  > default = $TESTTMP/server
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    98
  > [extensions]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
    99
  > extension=$TESTDIR/flagprocessorext.py
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   100
  > EOF
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   101
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   102
# Pull from server and update to latest revision
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   103
  $ hg pull default
35393
4441705b7111 tests: remove (glob) annotations that were only for '\' matches
Matt Harbison <matt_harbison@yahoo.com>
parents: 34845
diff changeset
   104
  pulling from $TESTTMP/server
30745
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   105
  requesting all changes
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   106
  adding changesets
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   107
  adding manifests
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   108
  adding file changes
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   109
  added 7 changesets with 7 changes to 7 files
34661
eb586ed5d8ce transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 33617
diff changeset
   110
  new changesets 07b1b9442c5b:6e48f4215d24
30745
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   111
  (run 'hg update' to get a working copy)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   112
  $ hg update
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   113
  7 files updated, 0 files merged, 0 files removed, 0 files unresolved
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   114
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   115
# TEST: ensure the revision data is consistent
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   116
  $ hg cat noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   117
  [NOOP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   118
  $ hg debugdata noop 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   119
  [NOOP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   120
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   121
  $ hg cat -r . base64
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   122
  [BASE64]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   123
  $ hg debugdata base64 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   124
  W0JBU0U2NF0K (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   125
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   126
  $ hg cat -r . gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   127
  [GZIP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   128
  $ hg debugdata gzip 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   129
  x\x9c\x8bv\x8f\xf2\x0c\x88\xe5\x02\x00\x08\xc8\x01\xfd (no-eol) (esc)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   130
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   131
  $ hg cat -r . noop-base64
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   132
  [NOOP][BASE64]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   133
  $ hg debugdata noop-base64 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   134
  W05PT1BdW0JBU0U2NF0K (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   135
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   136
  $ hg cat -r . noop-gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   137
  [NOOP][GZIP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   138
  $ hg debugdata noop-gzip 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   139
  x\x9c\x8b\xf6\xf3\xf7\x0f\x88\x8dv\x8f\xf2\x0c\x88\xe5\x02\x00\x1dH\x03\xf1 (no-eol) (esc)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   140
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   141
  $ hg cat -r . base64-gzip
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   142
  [BASE64][GZIP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   143
  $ hg debugdata base64-gzip 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   144
  eJyLdnIMdjUziY12j/IMiOUCACLBBDo= (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   145
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   146
  $ hg cat -r . base64-gzip-noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   147
  [BASE64][GZIP][NOOP]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   148
  $ hg debugdata base64-gzip-noop 0
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   149
  eJyLdnIMdjUziY12j/IMiI328/cPiOUCAESjBi4= (no-eol)
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   150
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   151
# TEST: ensure a missing processor is handled
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   152
  $ echo '[FAIL][BASE64][GZIP][NOOP]' > fail-base64-gzip-noop
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   153
  $ hg commit -Aqm 'fail+base64+gzip+noop'
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   154
  abort: missing processor for flag '0x1'!
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   155
  [255]
33614
41081364addb tests: clarify that duplicate flag processors is not an error
Martin von Zweigbergk <martinvonz@google.com>
parents: 32724
diff changeset
   156
  $ rm fail-base64-gzip-noop
30745
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   157
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   158
# TEST: ensure we cannot register several flag processors on the same flag
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   159
  $ cat >> .hg/hgrc << EOF
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   160
  > [extensions]
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   161
  > extension=$TESTDIR/flagprocessorext.py
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   162
  > duplicate=$TESTDIR/flagprocessorext.py
c1b7b2285522 revlog: flag processor
Remi Chaintron <remi@fb.com>
parents:
diff changeset
   163
  > EOF
33615
c6146dd10072 tests: fix test-flagprocessor.t flakiness
Martin von Zweigbergk <martinvonz@google.com>
parents: 33614
diff changeset
   164
  $ hg debugrebuilddirstate
34845
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   165
  Traceback (most recent call last):
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   166
    File "*/mercurial/extensions.py", line *, in _runextsetup (glob)
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   167
      extsetup(ui)
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   168
    File "*/tests/flagprocessorext.py", line *, in extsetup (glob)
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   169
      validatehash,
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   170
    File "*/mercurial/revlog.py", line *, in addflagprocessor (glob)
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   171
      raise error.Abort(msg)
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   172
  Abort: cannot register multiple processors on flag '0x8'.
32724
ea1c2eb7abd3 extensions: catch uisetup and extsetup failures and don't let them break hg
Augie Fackler <augie@google.com>
parents: 31856
diff changeset
   173
  *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
33615
c6146dd10072 tests: fix test-flagprocessor.t flakiness
Martin von Zweigbergk <martinvonz@google.com>
parents: 33614
diff changeset
   174
  $ hg st 2>&1 | egrep 'cannot register multiple processors|flagprocessorext'
34845
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   175
    File "*/tests/flagprocessorext.py", line *, in extsetup (glob)
78d9a7b7cdb6 extensions: always include traceback when extension setup fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 34661
diff changeset
   176
  Abort: cannot register multiple processors on flag '0x8'.
33615
c6146dd10072 tests: fix test-flagprocessor.t flakiness
Martin von Zweigbergk <martinvonz@google.com>
parents: 33614
diff changeset
   177
  *** failed to set up extension duplicate: cannot register multiple processors on flag '0x8'.
c6146dd10072 tests: fix test-flagprocessor.t flakiness
Martin von Zweigbergk <martinvonz@google.com>
parents: 33614
diff changeset
   178
    File "*/tests/flagprocessorext.py", line *, in b64decode (glob)
31833
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   179
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   180
  $ cd ..
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   181
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   182
# TEST: bundle repo
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   183
  $ hg init bundletest
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   184
  $ cd bundletest
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   185
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   186
  $ cat >> .hg/hgrc << EOF
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   187
  > [extensions]
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   188
  > flagprocessor=$TESTDIR/flagprocessorext.py
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   189
  > EOF
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   190
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   191
  $ for i in 0 single two three 4; do
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   192
  >   echo '[BASE64]a-bit-longer-'$i > base64
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   193
  >   hg commit -m base64-$i -A base64
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   194
  > done
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   195
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   196
  $ hg update 2 -q
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   197
  $ echo '[BASE64]a-bit-longer-branching' > base64
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   198
  $ hg commit -q -m branching
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   199
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   200
  $ hg bundle --base 1 bundle.hg
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   201
  4 changesets found
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   202
  $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
31838
c39e7c4b535c test-flagprocessor: remove unnecessary greps
Jun Wu <quark@fb.com>
parents: 31837
diff changeset
   203
  $ hg -R bundle.hg log --stat -T '{rev} {desc}\n' base64
31836
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   204
  5 branching
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   205
   base64 |  2 +-
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   206
   1 files changed, 1 insertions(+), 1 deletions(-)
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   207
  
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   208
  4 base64-4
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   209
   base64 |  2 +-
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   210
   1 files changed, 1 insertions(+), 1 deletions(-)
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   211
  
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   212
  3 base64-three
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   213
   base64 |  2 +-
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   214
   1 files changed, 1 insertions(+), 1 deletions(-)
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   215
  
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   216
  2 base64-two
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   217
   base64 |  2 +-
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   218
   1 files changed, 1 insertions(+), 1 deletions(-)
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   219
  
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   220
  1 base64-single
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   221
   base64 |  2 +-
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   222
   1 files changed, 1 insertions(+), 1 deletions(-)
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   223
  
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   224
  0 base64-0
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   225
   base64 |  1 +
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   226
   1 files changed, 1 insertions(+), 0 deletions(-)
4598e8f43e20 bundlerepo: fix raw handling in revision()
Jun Wu <quark@fb.com>
parents: 31835
diff changeset
   227
  
31833
723c1ab2f77e test-flagprocessor: add tests about bundlerepo
Jun Wu <quark@fb.com>
parents: 30745
diff changeset
   228
31838
c39e7c4b535c test-flagprocessor: remove unnecessary greps
Jun Wu <quark@fb.com>
parents: 31837
diff changeset
   229
  $ hg bundle -R bundle.hg --base 1 bundle-again.hg -q
c39e7c4b535c test-flagprocessor: remove unnecessary greps
Jun Wu <quark@fb.com>
parents: 31837
diff changeset
   230
  $ hg -R bundle-again.hg log --stat -T '{rev} {desc}\n' base64
31837
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   231
  5 branching
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   232
   base64 |  2 +-
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   233
   1 files changed, 1 insertions(+), 1 deletions(-)
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   234
  
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   235
  4 base64-4
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   236
   base64 |  2 +-
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   237
   1 files changed, 1 insertions(+), 1 deletions(-)
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   238
  
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   239
  3 base64-three
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   240
   base64 |  2 +-
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   241
   1 files changed, 1 insertions(+), 1 deletions(-)
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   242
  
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   243
  2 base64-two
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   244
   base64 |  2 +-
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   245
   1 files changed, 1 insertions(+), 1 deletions(-)
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   246
  
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   247
  1 base64-single
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   248
   base64 |  2 +-
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   249
   1 files changed, 1 insertions(+), 1 deletions(-)
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   250
  
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   251
  0 base64-0
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   252
   base64 |  1 +
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   253
   1 files changed, 1 insertions(+), 0 deletions(-)
37e793918c07 bundlerepo: use raw revision in revdiff()
Jun Wu <quark@fb.com>
parents: 31836
diff changeset
   254
  
31855
a418c5837bc0 test-flagprocessor: add a case about hg status
Jun Wu <quark@fb.com>
parents: 31838
diff changeset
   255
  $ rm bundle.hg bundle-again.hg
a418c5837bc0 test-flagprocessor: add a case about hg status
Jun Wu <quark@fb.com>
parents: 31838
diff changeset
   256
a418c5837bc0 test-flagprocessor: add a case about hg status
Jun Wu <quark@fb.com>
parents: 31838
diff changeset
   257
# TEST: hg status
a418c5837bc0 test-flagprocessor: add a case about hg status
Jun Wu <quark@fb.com>
parents: 31838
diff changeset
   258
a418c5837bc0 test-flagprocessor: add a case about hg status
Jun Wu <quark@fb.com>
parents: 31838
diff changeset
   259
  $ hg status
a418c5837bc0 test-flagprocessor: add a case about hg status
Jun Wu <quark@fb.com>
parents: 31838
diff changeset
   260
  $ hg diff