##// END OF EJS Templates
tests: unify test-impexp-branch
Nicolas Dumazet -
r12119:46ab8c5d default
parent child Browse files
Show More
@@ -1,45 +1,50 b''
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*))$')
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
7 33
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 -
40 cd ..
41 rm -rf b
42 hg init b
43 cd b
44 hg -R ../a export 0 | hg import --exact -
45 hg -R ../a export 1 | hg import --exact -
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
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now