Show More
@@ -1,83 +1,83 b'' | |||||
1 | $ echo '[extensions]' >> $HGRCPATH |
|
1 | $ echo '[extensions]' >> $HGRCPATH | |
2 | $ echo 'strip =' >> $HGRCPATH |
|
2 | $ echo 'strip =' >> $HGRCPATH | |
3 |
|
3 | |||
4 | $ cat >findbranch.py <<EOF |
|
4 | $ cat >findbranch.py <<EOF | |
5 | > from __future__ import absolute_import |
|
5 | > from __future__ import absolute_import | |
6 | > import re |
|
6 | > import re | |
7 | > import sys |
|
7 | > import sys | |
8 | > |
|
8 | > | |
9 | > head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$') |
|
9 | > head_re = re.compile('^#(?:(?:\\s+([A-Za-z][A-Za-z0-9_]*)(?:\\s.*)?)|(?:\\s*))$') | |
10 | > |
|
10 | > | |
11 | > for line in sys.stdin: |
|
11 | > for line in sys.stdin: | |
12 | > hmatch = head_re.match(line) |
|
12 | > hmatch = head_re.match(line) | |
13 | > if not hmatch: |
|
13 | > if not hmatch: | |
14 | > sys.exit(1) |
|
14 | > sys.exit(1) | |
15 | > if hmatch.group(1) == 'Branch': |
|
15 | > if hmatch.group(1) == 'Branch': | |
16 | > sys.exit(0) |
|
16 | > sys.exit(0) | |
17 | > sys.exit(1) |
|
17 | > sys.exit(1) | |
18 | > EOF |
|
18 | > EOF | |
19 |
|
19 | |||
20 | $ hg init a |
|
20 | $ hg init a | |
21 | $ cd a |
|
21 | $ cd a | |
22 | $ echo "Rev 1" >rev |
|
22 | $ echo "Rev 1" >rev | |
23 | $ hg add rev |
|
23 | $ hg add rev | |
24 | $ hg commit -m "No branch." |
|
24 | $ hg commit -m "No branch." | |
25 | $ hg branch abranch |
|
25 | $ hg branch abranch | |
26 | marked working directory as branch abranch |
|
26 | marked working directory as branch abranch | |
27 | (branches are permanent and global, did you want a bookmark?) |
|
27 | (branches are permanent and global, did you want a bookmark?) | |
28 | $ echo "Rev 2" >rev |
|
28 | $ echo "Rev 2" >rev | |
29 | $ hg commit -m "With branch." |
|
29 | $ hg commit -m "With branch." | |
30 |
|
30 | |||
31 | $ hg export 0 > ../r0.patch |
|
31 | $ hg export 0 > ../r0.patch | |
32 | $ hg export 1 > ../r1.patch |
|
32 | $ hg export 1 > ../r1.patch | |
33 | $ cd .. |
|
33 | $ cd .. | |
34 |
|
34 | |||
35 | $ if $PYTHON findbranch.py < r0.patch; then |
|
35 | $ if $PYTHON findbranch.py < r0.patch; then | |
36 | > echo "Export of default branch revision has Branch header" 1>&2 |
|
36 | > echo "Export of default branch revision has Branch header" 1>&2 | |
37 | > exit 1 |
|
37 | > exit 1 | |
38 | > fi |
|
38 | > fi | |
39 |
|
39 | |||
40 | $ if $PYTHON findbranch.py < r1.patch; then |
|
40 | $ if $PYTHON findbranch.py < r1.patch; then | |
41 | > : # Do nothing |
|
41 | > : # Do nothing | |
42 | > else |
|
42 | > else | |
43 | > echo "Export of branch revision is missing Branch header" 1>&2 |
|
43 | > echo "Export of branch revision is missing Branch header" 1>&2 | |
44 | > exit 1 |
|
44 | > exit 1 | |
45 | > fi |
|
45 | > fi | |
46 |
|
46 | |||
47 | Make sure import still works with branch information in patches. |
|
47 | Make sure import still works with branch information in patches. | |
48 |
|
48 | |||
49 | $ hg init b |
|
49 | $ hg init b | |
50 | $ cd b |
|
50 | $ cd b | |
51 | $ hg import ../r0.patch |
|
51 | $ hg import ../r0.patch | |
52 | applying ../r0.patch |
|
52 | applying ../r0.patch | |
53 | $ hg import ../r1.patch |
|
53 | $ hg import ../r1.patch | |
54 | applying ../r1.patch |
|
54 | applying ../r1.patch | |
55 | $ cd .. |
|
55 | $ cd .. | |
56 |
|
56 | |||
57 | $ hg init c |
|
57 | $ hg init c | |
58 | $ cd c |
|
58 | $ cd c | |
59 | $ hg import --exact --no-commit ../r0.patch |
|
59 | $ hg import --exact --no-commit ../r0.patch | |
60 | applying ../r0.patch |
|
60 | applying ../r0.patch | |
61 | warning: can't check exact import with --no-commit |
|
61 | warning: can't check exact import with --no-commit | |
62 | $ hg st |
|
62 | $ hg st | |
63 | A rev |
|
63 | A rev | |
64 | $ hg revert -a |
|
64 | $ hg revert -a | |
65 | forgetting rev |
|
65 | forgetting rev | |
66 | $ rm rev |
|
66 | $ rm rev | |
67 | $ hg import --exact ../r0.patch |
|
67 | $ hg import --exact ../r0.patch | |
68 | applying ../r0.patch |
|
68 | applying ../r0.patch | |
69 | $ hg import --exact ../r1.patch |
|
69 | $ hg import --exact ../r1.patch | |
70 | applying ../r1.patch |
|
70 | applying ../r1.patch | |
71 |
|
71 | |||
72 | Test --exact and patch header separators (issue3356) |
|
72 | Test --exact and patch header separators (issue3356) | |
73 |
|
73 | |||
74 | $ hg strip --no-backup . |
|
74 | $ hg strip --no-backup . | |
75 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
76 | >>> import re |
|
76 | >>> import re | |
77 | >>> p = open('../r1.patch', 'rb').read() |
|
77 | >>> p = open('../r1.patch', 'rb').read() | |
78 | >>> p = re.sub(r'Parent\s+', 'Parent ', p) |
|
78 | >>> p = re.sub(br'Parent\s+', b'Parent ', p) | |
79 | >>> open('../r1-ws.patch', 'wb').write(p) |
|
79 | >>> open('../r1-ws.patch', 'wb').write(p) and None | |
80 | $ hg import --exact ../r1-ws.patch |
|
80 | $ hg import --exact ../r1-ws.patch | |
81 | applying ../r1-ws.patch |
|
81 | applying ../r1-ws.patch | |
82 |
|
82 | |||
83 | $ cd .. |
|
83 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now