##// END OF EJS Templates
tests: export patches only once in test-impexp-branch
Nicolas Dumazet -
r14126:fbbe9239 default
parent child Browse files
Show More
@@ -1,50 +1,56
1 1 $ cat >findbranch.py <<EOF
2 2 > import re, sys
3 3 >
4 4 > head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$')
5 5 >
6 6 > for line in sys.stdin:
7 7 > hmatch = head_re.match(line)
8 8 > if not hmatch:
9 9 > sys.exit(1)
10 10 > if hmatch.group(1) == 'Branch':
11 11 > sys.exit(0)
12 12 > sys.exit(1)
13 13 > EOF
14
14 15 $ hg init a
15 16 $ cd a
16 17 $ echo "Rev 1" >rev
17 18 $ hg add rev
18 19 $ hg commit -m "No branch."
19 20 $ hg branch abranch
20 21 marked working directory as branch abranch
21 22 $ echo "Rev 2" >rev
22 23 $ hg commit -m "With branch."
23 $ if hg export 0 | python ../findbranch.py; then
24
25 $ hg export 0 > ../r0.patch
26 $ hg export 1 > ../r1.patch
27 $ cd ..
28
29 $ if python findbranch.py < r0.patch; then
24 30 > echo "Export of default branch revision has Branch header" 1>&2
25 31 > exit 1
26 32 > fi
27 $ if hg export 1 | python ../findbranch.py; then
33
34 $ if python findbranch.py < r1.patch; then
28 35 > : # Do nothing
29 36 > else
30 37 > echo "Export of branch revision is missing Branch header" 1>&2
31 38 > exit 1
32 39 > fi
33 40
34 41 Make sure import still works with branch information in patches.
35 42
36 $ cd ..
37 43 $ hg init b
38 44 $ 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
45 $ hg import ../r0.patch
46 applying ../r0.patch
47 $ hg import ../r1.patch
48 applying ../r1.patch
43 49 $ 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
50
51 $ hg init c
52 $ cd c
53 $ hg import --exact ../r0.patch
54 applying ../r0.patch
55 $ hg import --exact ../r1.patch
56 applying ../r1.patch
General Comments 0
You need to be logged in to leave comments. Login now