Show More
@@ -1,100 +1,105 b'' | |||||
1 | $ cat > patchtool.py <<EOF |
|
1 | $ cat > patchtool.py <<EOF | |
2 | > from __future__ import absolute_import, print_function |
|
2 | > from __future__ import absolute_import, print_function | |
3 | > import sys |
|
3 | > import sys | |
4 | > print('Using custom patch') |
|
4 | > print('Using custom patch') | |
5 | > if '--binary' in sys.argv: |
|
5 | > if '--binary' in sys.argv: | |
6 | > print('--binary found !') |
|
6 | > print('--binary found !') | |
7 | > EOF |
|
7 | > EOF | |
8 |
|
8 | |||
9 | $ echo "[ui]" >> $HGRCPATH |
|
9 | $ echo "[ui]" >> $HGRCPATH | |
10 | $ echo "patch=$PYTHON ../patchtool.py" >> $HGRCPATH |
|
10 | $ echo "patch=$PYTHON ../patchtool.py" >> $HGRCPATH | |
11 |
|
11 | |||
12 | $ hg init a |
|
12 | $ hg init a | |
13 | $ cd a |
|
13 | $ cd a | |
14 | $ echo a > a |
|
14 | $ echo a > a | |
15 | $ hg commit -Ama -d '1 0' |
|
15 | $ hg commit -Ama -d '1 0' | |
16 | adding a |
|
16 | adding a | |
17 | $ echo b >> a |
|
17 | $ echo b >> a | |
18 | $ hg commit -Amb -d '2 0' |
|
18 | $ hg commit -Amb -d '2 0' | |
19 | $ cd .. |
|
19 | $ cd .. | |
20 |
|
20 | |||
21 | This test checks that: |
|
21 | This test checks that: | |
22 | - custom patch commands with arguments actually work |
|
22 | - custom patch commands with arguments actually work | |
23 | - patch code does not try to add weird arguments like |
|
23 | - patch code does not try to add weird arguments like | |
24 | --binary when custom patch commands are used. For instance |
|
24 | --binary when custom patch commands are used. For instance | |
25 | --binary is added by default under win32. |
|
25 | --binary is added by default under win32. | |
26 |
|
26 | |||
27 | check custom patch options are honored |
|
27 | check custom patch options are honored | |
28 |
|
28 | |||
29 | $ hg --cwd a export -o ../a.diff tip |
|
29 | $ hg --cwd a export -o ../a.diff tip | |
30 | $ hg clone -r 0 a b |
|
30 | $ hg clone -r 0 a b | |
31 | adding changesets |
|
31 | adding changesets | |
32 | adding manifests |
|
32 | adding manifests | |
33 | adding file changes |
|
33 | adding file changes | |
34 | added 1 changesets with 1 changes to 1 files |
|
34 | added 1 changesets with 1 changes to 1 files | |
35 | new changesets 8580ff50825a |
|
35 | new changesets 8580ff50825a | |
36 | updating to branch default |
|
36 | updating to branch default | |
37 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
37 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
38 |
|
38 | |||
39 | $ hg --cwd b import -v ../a.diff |
|
39 | $ hg --cwd b import -v ../a.diff | |
40 | applying ../a.diff |
|
40 | applying ../a.diff | |
41 | Using custom patch |
|
41 | Using custom patch | |
42 | applied to working directory |
|
42 | applied to working directory | |
43 |
|
43 | |||
44 | Issue2417: hg import with # comments in description |
|
44 | Issue2417: hg import with # comments in description | |
45 |
|
45 | |||
46 | Prepare source repo and patch: |
|
46 | Prepare source repo and patch: | |
47 |
|
47 | |||
48 | $ rm $HGRCPATH |
|
48 | $ rm $HGRCPATH | |
49 | $ hg init c |
|
49 | $ hg init c | |
50 | $ cd c |
|
50 | $ cd c | |
51 | $ printf "a\rc" > a |
|
51 | $ printf "a\rc" > a | |
52 | $ hg ci -A -m 0 a -d '0 0' |
|
52 | $ hg ci -A -m 0 a -d '0 0' | |
53 | $ printf "a\rb\rc" > a |
|
53 | $ printf "a\rb\rc" > a | |
54 | $ cat << eof > log |
|
54 | $ cat << eof > log | |
55 | > first line which can't start with '# ' |
|
55 | > first line which can't start with '# ' | |
56 | > # second line is a comment but that shouldn't be a problem. |
|
56 | > # second line is a comment but that shouldn't be a problem. | |
57 | > A patch marker like this was more problematic even after d7452292f9d3: |
|
57 | > A patch marker like this was more problematic even after d7452292f9d3: | |
58 | > # HG changeset patch |
|
58 | > # HG changeset patch | |
59 | > # User lines looks like this - but it _is_ just a comment |
|
59 | > # User lines looks like this - but it _is_ just a comment | |
60 | > eof |
|
60 | > eof | |
61 | $ hg ci -l log -d '0 0' |
|
61 | $ hg ci -l log -d '0 0' | |
62 | $ hg export -o p 1 |
|
62 | $ hg export -o p 1 | |
63 | $ cd .. |
|
63 | $ cd .. | |
64 |
|
64 | |||
65 | Clone and apply patch: |
|
65 | Clone and apply patch: | |
66 |
|
66 | |||
67 | $ hg clone -r 0 c d |
|
67 | $ hg clone -r 0 c d | |
68 | adding changesets |
|
68 | adding changesets | |
69 | adding manifests |
|
69 | adding manifests | |
70 | adding file changes |
|
70 | adding file changes | |
71 | added 1 changesets with 1 changes to 1 files |
|
71 | added 1 changesets with 1 changes to 1 files | |
72 | new changesets 7fadb901d403 |
|
72 | new changesets 7fadb901d403 | |
73 | updating to branch default |
|
73 | updating to branch default | |
74 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
74 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
75 | $ cd d |
|
75 | $ cd d | |
76 | $ hg import ../c/p |
|
76 | $ hg import ../c/p | |
77 | applying ../c/p |
|
77 | applying ../c/p | |
78 | $ hg log -v -r 1 |
|
78 | $ hg log -v -r 1 | |
79 | changeset: 1:cd0bde79c428 |
|
79 | changeset: 1:cd0bde79c428 | |
80 | tag: tip |
|
80 | tag: tip | |
81 | user: test |
|
81 | user: test | |
82 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
82 | date: Thu Jan 01 00:00:00 1970 +0000 | |
83 | files: a |
|
83 | files: a | |
84 | description: |
|
84 | description: | |
85 | first line which can't start with '# ' |
|
85 | first line which can't start with '# ' | |
86 | # second line is a comment but that shouldn't be a problem. |
|
86 | # second line is a comment but that shouldn't be a problem. | |
87 | A patch marker like this was more problematic even after d7452292f9d3: |
|
87 | A patch marker like this was more problematic even after d7452292f9d3: | |
88 | # HG changeset patch |
|
88 | # HG changeset patch | |
89 | # User lines looks like this - but it _is_ just a comment |
|
89 | # User lines looks like this - but it _is_ just a comment | |
90 |
|
90 | |||
91 |
|
91 | |||
92 |
|
92 | |||
93 | Error exit (issue4746) |
|
93 | Error exit (issue4746) | |
94 |
|
94 | |||
95 | $ hg import ../c/p --config ui.patch='sh -c "exit 1"' |
|
95 | $ cat >> exit1.py <<EOF | |
|
96 | > import sys | |||
|
97 | > sys.exit(1) | |||
|
98 | > EOF | |||
|
99 | ||||
|
100 | $ hg import ../c/p --config ui.patch="$PYTHON '`pwd`/exit1.py'" | |||
96 | applying ../c/p |
|
101 | applying ../c/p | |
97 | abort: patch command failed: exited with status 1 |
|
102 | abort: patch command failed: exited with status 1 | |
98 | [255] |
|
103 | [255] | |
99 |
|
104 | |||
100 | $ cd .. |
|
105 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now