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