tests/test-convert-bzr-ghosts.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sun, 26 Jun 2016 19:34:48 -0700
branchstable
changeset 29452 26a5d605b868
parent 26066 89872688893f
child 32940 75be14993fda
permissions -rw-r--r--
sslutil: synchronize hostname matching logic with CPython sslutil contains its own hostname matching logic. CPython has code for the same intent. However, it is only available to Python 2.7.9+ (or distributions that have backported 2.7.9's ssl module improvements). This patch effectively imports CPython's hostname matching code from its ssl.py into sslutil.py. The hostname matching code itself is pretty similar. However, the DNS name matching code is much more robust and spec conformant. As the test changes show, this changes some behavior around wildcard handling and IDNA matching. The new behavior allows wildcards in the middle of words (e.g. 'f*.com' matches 'foo.com') This is spec compliant according to RFC 6125 Section 6.5.3 item 3. There is one test where the matcher is more strict. Before, '*.a.com' matched '.a.com'. Now it doesn't match. Strictly speaking this is a security vulnerability.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26066
89872688893f tests: move '#require bzr' into .t files
Gregory Szorc <gregory.szorc@gmail.com>
parents: 16913
diff changeset
     1
#require bzr
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
     2
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     3
  $ . "$TESTDIR/bzr-definitions"
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     4
  $ cat > ghostcreator.py <<EOF
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     5
  > import sys
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     6
  > from bzrlib import workingtree
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     7
  > wt = workingtree.WorkingTree.open('.')
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     8
  > 
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
     9
  > message, ghostrev = sys.argv[1:]
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    10
  > wt.set_parent_ids(wt.get_parent_ids() + [ghostrev])
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    11
  > wt.commit(message)
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    12
  > EOF
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
    13
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    14
ghost revisions
7053
209ef5f3534c convert: add bzr source
Marek Kubica <marek@xivilization.net>
parents:
diff changeset
    15
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    16
  $ mkdir test-ghost-revisions
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    17
  $ cd test-ghost-revisions
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    18
  $ bzr init -q source
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    19
  $ cd source
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    20
  $ echo content > somefile
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    21
  $ bzr add -q somefile
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    22
  $ bzr commit -q -m 'Initial layout setup'
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    23
  $ echo morecontent >> somefile
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    24
  $ python ../../ghostcreator.py 'Commit with ghost revision' ghostrev
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    25
  $ cd ..
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    26
  $ hg convert source source-hg
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    27
  initializing destination source-hg repository
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    28
  scanning source...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    29
  sorting...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    30
  converting...
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    31
  1 Initial layout setup
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    32
  0 Commit with ghost revision
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    33
  $ glog -R source-hg
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12515
diff changeset
    34
  o  1@source "Commit with ghost revision" files: somefile
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    35
  |
16060
f84dda152a55 convert/bzr: convert all branches (issue3229) (BC)
Patrick Mezard <pmezard@gmail.com>
parents: 12515
diff changeset
    36
  o  0@source "Initial layout setup" files: somefile
12515
b6a784e39ad4 tests: unify test-convert-bzr-ghosts
Matt Mackall <mpm@selenic.com>
parents: 7058
diff changeset
    37
  
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    38
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16060
diff changeset
    39
  $ cd ..