tests/test-impexp-branch
changeset 4442 871ff96a86cc
child 4444 32ea809e5bd1
equal deleted inserted replaced
4438:3900f684a150 4442:871ff96a86cc
       
     1 #!/bin/sh
       
     2 
       
     3 cat >findbranch.py <<EOF
       
     4 import re, sys
       
     5 
       
     6 head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$')
       
     7 
       
     8 for line in sys.stdin:
       
     9     hmatch = head_re.match(line)
       
    10     if not hmatch:
       
    11         sys.exit(1)
       
    12     if hmatch.group(1) == 'Branch':
       
    13         sys.exit(0)
       
    14 sys.exit(1)
       
    15 EOF
       
    16 hg init a
       
    17 cd a
       
    18 echo "Rev 1" >rev
       
    19 hg add rev
       
    20 hg commit -m "No branch."
       
    21 hg branch abranch
       
    22 echo "Rev  2" >rev
       
    23 hg commit -m "With branch."
       
    24 if hg export 0 | python ../findbranch.py; then
       
    25     echo "Export of default branch revision has Branch header" 1>&2
       
    26     exit 1
       
    27 fi
       
    28 if hg export 1 | python ../findbranch.py; then
       
    29     :  # Do nothing
       
    30 else
       
    31     echo "Export of branch revision is missing Branch header" 1>&2
       
    32     exit 1
       
    33 fi
       
    34 # Make sure import still works with branch information in patches.
       
    35 cd ..
       
    36 hg init b
       
    37 cd b
       
    38 hg -R ../a export 0 | hg import -
       
    39 hg -R ../a export 1 | hg import -