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