##// 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
1 $ cat >findbranch.py <<EOF
2
2 > import re, sys
3 cat >findbranch.py <<EOF
3 >
4 import re, sys
4 > head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$')
5
5 >
6 head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$')
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:
34 Make sure import still works with branch information in patches.
9 hmatch = head_re.match(line)
35
10 if not hmatch:
36 $ cd ..
11 sys.exit(1)
37 $ hg init b
12 if hmatch.group(1) == 'Branch':
38 $ cd b
13 sys.exit(0)
39 $ hg -R ../a export 0 | hg import -
14 sys.exit(1)
40 applying patch from stdin
15 EOF
41 $ hg -R ../a export 1 | hg import -
16 hg init a
42 applying patch from stdin
17 cd a
43 $ cd ..
18 echo "Rev 1" >rev
44 $ rm -rf b
19 hg add rev
45 $ hg init b
20 hg commit -m "No branch."
46 $ cd b
21 hg branch abranch
47 $ hg -R ../a export 0 | hg import --exact -
22 echo "Rev 2" >rev
48 applying patch from stdin
23 hg commit -m "With branch."
49 $ hg -R ../a export 1 | hg import --exact -
24 if hg export 0 | python ../findbranch.py; then
50 applying patch from stdin
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 -
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now