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