comparison tests/test-impexp-branch.t @ 12119:46ab8c5dd99a

tests: unify test-impexp-branch
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Mon, 30 Aug 2010 14:13:36 +0900
parents tests/test-impexp-branch@32ea809e5bd1
children fbbe9239574a
comparison
equal deleted inserted replaced
12118:ab2ccdce985d 12119:46ab8c5dd99a
1 $ cat >findbranch.py <<EOF
2 > import re, sys
3 >
4 > head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$')
5 >
6 > for line in sys.stdin:
7 > hmatch = head_re.match(line)
8 > if not hmatch:
9 > sys.exit(1)
10 > if hmatch.group(1) == 'Branch':
11 > sys.exit(0)
12 > sys.exit(1)
13 > EOF
14 $ hg init a
15 $ cd a
16 $ echo "Rev 1" >rev
17 $ hg add rev
18 $ hg commit -m "No branch."
19 $ hg branch abranch
20 marked working directory as branch abranch
21 $ echo "Rev 2" >rev
22 $ hg commit -m "With branch."
23 $ if hg export 0 | python ../findbranch.py; then
24 > echo "Export of default branch revision has Branch header" 1>&2
25 > exit 1
26 > fi
27 $ if hg export 1 | python ../findbranch.py; then
28 > : # Do nothing
29 > else
30 > echo "Export of branch revision is missing Branch header" 1>&2
31 > exit 1
32 > fi
33
34 Make sure import still works with branch information in patches.
35
36 $ cd ..
37 $ hg init b
38 $ cd b
39 $ hg -R ../a export 0 | hg import -
40 applying patch from stdin
41 $ hg -R ../a export 1 | hg import -
42 applying patch from stdin
43 $ cd ..
44 $ rm -rf b
45 $ hg init b
46 $ cd b
47 $ hg -R ../a export 0 | hg import --exact -
48 applying patch from stdin
49 $ hg -R ../a export 1 | hg import --exact -
50 applying patch from stdin