tests/test-convert-splicemap.t
author Patrick Mezard <pmezard@gmail.com>
Mon, 01 Aug 2011 23:58:50 +0200
branchstable
changeset 15005 4a43e23b8c55
parent 12531 a1cbcc1a21f6
child 15608 63ff8fe3a8f0
permissions -rw-r--r--
hgweb: do not ignore [auth] if url has a username (issue2822) The [auth] section was ignored when handling URLs like: http://user@example.com/foo Instead, we look in [auth] for an entry matching the URL and supplied user name. Entries without username can match URL with a username. Prefix length ties are resolved in favor of entries matching the username. With: foo.prefix = http://example.org foo.username = user foo.password = password bar.prefix = http://example.org/bar and the input URL: http://user@example.org/bar the 'bar' entry will be selected because of prefix length, therefore prompting for a password. This behaviour ensure that entries selection is consistent when looking for credentials or for certificates, and that certificates can be picked even if their entries do no define usernames while the URL does. Additionally, entries without a username matched against a username are returned as if they did have requested username set to avoid prompting again for a username if the password is not set. v2: reparse the URL in readauthforuri() to handle HTTP and HTTPS similarly. v3: allow unset usernames to match URL usernames to pick certificates. Resolve prefix length ties in favor of entries with usernames.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8047
04c62275cbc7 convert: better mapfile parsing errors (issue1581/1)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
12531
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     2
  $ echo "[extensions]" >> $HGRCPATH
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     3
  $ echo "convert=" >> $HGRCPATH
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     4
  $ echo 'graphlog =' >> $HGRCPATH
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     5
  $ glog()
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     6
  > {
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     7
  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     8
  > }
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     9
  $ hg init repo1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    10
  $ cd repo1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    11
  $ echo a > a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    12
  $ hg ci -Am adda
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    13
  adding a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    14
  $ echo b > b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    15
  $ echo a >> a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    16
  $ hg ci -Am addb
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    17
  adding b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    18
  $ PARENTID1=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    19
  $ echo c > c
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    20
  $ hg ci -Am addc
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    21
  adding c
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    22
  $ PARENTID2=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    23
  $ cd ..
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    24
  $ hg init repo2
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    25
  $ cd repo2
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    26
  $ echo b > a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    27
  $ echo d > d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    28
  $ hg ci -Am addaandd
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    29
  adding a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    30
  adding d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    31
  $ CHILDID1=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    32
  $ echo d >> d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    33
  $ hg ci -Am changed
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    34
  $ CHILDID2=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    35
  $ echo e > e
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    36
  $ hg ci -Am adde
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    37
  adding e
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    38
  $ cd ..
8047
04c62275cbc7 convert: better mapfile parsing errors (issue1581/1)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
12531
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    40
test invalid splicemap
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    41
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    42
  $ cat > splicemap <<EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    43
  > $CHILDID2
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    44
  > EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    45
  $ hg convert --splicemap splicemap repo2 repo1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    46
  abort: syntax error in splicemap(1): key/value pair expected
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    47
  [255]
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    48
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    49
splice repo2 on repo1
8047
04c62275cbc7 convert: better mapfile parsing errors (issue1581/1)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
12531
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    51
  $ cat > splicemap <<EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    52
  > $CHILDID1 $PARENTID1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    53
  > $CHILDID2 $PARENTID2,$CHILDID1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    54
  > EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    55
  $ hg clone repo1 target1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    56
  updating to branch default
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    57
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    58
  $ hg convert --splicemap splicemap repo2 target1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    59
  scanning source...
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    60
  sorting...
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    61
  converting...
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    62
  2 addaandd
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    63
  spliced in ['6d4c2037ddc2cb2627ac3a244ecce35283268f8e'] as parents of 527cdedf31fbd5ea708aa14eeecf53d4676f38db
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    64
  1 changed
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    65
  spliced in ['e55c719b85b60e5102fac26110ba626e7cb6b7dc', '527cdedf31fbd5ea708aa14eeecf53d4676f38db'] as parents of e4ea00df91897da3079a10fab658c1eddba6617b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    66
  0 adde
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    67
  $ glog -R target1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    68
  o  5 "adde" files: e
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    69
  |
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    70
  o    4 "changed" files: d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    71
  |\
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    72
  | o  3 "addaandd" files: a d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    73
  | |
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    74
  @ |  2 "addc" files: c
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    75
  |/
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    76
  o  1 "addb" files: a b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    77
  |
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    78
  o  0 "adda" files: a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    79