##// END OF EJS Templates
rebase: add a test for committed MQ patches (59bd20451ab6)
Giorgos Keramidas -
r11536:92342fa9 stable
parent child Browse files
Show More
@@ -1,123 +1,133 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 . $TESTDIR/helpers.sh
3 . $TESTDIR/helpers.sh
4
4
5 echo "[extensions]" >> $HGRCPATH
5 echo "[extensions]" >> $HGRCPATH
6 echo "graphlog=" >> $HGRCPATH
6 echo "graphlog=" >> $HGRCPATH
7 echo "rebase=" >> $HGRCPATH
7 echo "rebase=" >> $HGRCPATH
8 echo "mq=" >> $HGRCPATH
8 echo "mq=" >> $HGRCPATH
9
9
10 echo "[mq]" >> $HGRCPATH
10 echo "[mq]" >> $HGRCPATH
11 echo "plain=true" >> $HGRCPATH
11 echo "plain=true" >> $HGRCPATH
12
12
13 filterpatch()
13 filterpatch()
14 {
14 {
15 sed -e "s/^\(# Date\).*/\1/" \
15 sed -e "s/^\(# Date\).*/\1/" \
16 -e "s/^\(# Node ID\).*/\1/" \
16 -e "s/^\(# Node ID\).*/\1/" \
17 -e "s/^\(# Parent\).*/\1/" \
17 -e "s/^\(# Parent\).*/\1/" \
18 -e "s/^\(diff -r \)\([a-f0-9]* \)\(-r \)\([a-f0-9]* \)/\1x \3y /" \
18 -e "s/^\(diff -r \)\([a-f0-9]* \)\(-r \)\([a-f0-9]* \)/\1x \3y /" \
19 -e "s/^\(diff -r \)\([a-f0-9]* \)/\1x /" \
19 -e "s/^\(diff -r \)\([a-f0-9]* \)/\1x /" \
20 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
20 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/" \
21 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/"
21 -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/"
22 }
22 }
23
23
24 hg init a
24 hg init a
25 cd a
25 cd a
26 hg qinit -c # This must work even with a managed mq queue
26 hg qinit -c # This must work even with a managed mq queue
27
27
28 echo 'c1' > f
28 echo 'c1' > f
29 hg add f
29 hg add f
30 hg commit -d '0 0' -m "C1"
30 hg commit -d '0 0' -m "C1"
31
31
32 echo 'r1' > f
32 echo 'r1' > f
33 hg commit -d '2 0' -m "R1"
33 hg commit -d '2 0' -m "R1"
34
34
35 hg up 0
35 hg up 0
36 hg qnew f.patch
36 hg qnew f.patch
37 echo 'mq1' > f
37 echo 'mq1' > f
38 hg qref -m 'P0'
38 hg qref -m 'P0'
39
39
40 hg qnew f2.patch
40 hg qnew f2.patch
41 echo 'mq2' > f
41 echo 'mq2' > f
42 hg qref -m 'P1'
42 hg qref -m 'P1'
43 hg glog --template '{rev} {desc} tags: {tags}\n'
43 hg glog --template '{rev} {desc} tags: {tags}\n'
44
44
45 echo
45 echo
46 echo '% Rebase - try to rebase on an applied mq patch'
46 echo '% Rebase - try to rebase on an applied mq patch'
47 hg rebase -s 1 -d 3
47 hg rebase -s 1 -d 3
48
48
49 echo
49 echo
50 echo '% Rebase - same thing, but mq patch is default dest'
50 echo '% Rebase - same thing, but mq patch is default dest'
51 hg update -q 1
51 hg update -q 1
52 hg rebase
52 hg rebase
53 hg update -q qtip
53 hg update -q qtip
54
54
55 echo
55 echo
56 echo '% Rebase - generate a conflict'
56 echo '% Rebase - generate a conflict'
57 hg rebase -s 2 -d 1
57 hg rebase -s 2 -d 1
58
58
59 echo
59 echo
60 echo '% Fix the 1st conflict'
60 echo '% Fix the 1st conflict'
61 echo 'mq1r1' > f
61 echo 'mq1r1' > f
62 hg resolve -m f
62 hg resolve -m f
63 hg rebase -c | hidebackup
63 hg rebase -c | hidebackup
64
64
65 echo
65 echo
66 echo '% Fix the 2nd conflict'
66 echo '% Fix the 2nd conflict'
67 echo 'mq1r1mq2' > f
67 echo 'mq1r1mq2' > f
68 hg resolve -m f
68 hg resolve -m f
69 hg rebase -c | hidebackup
69 hg rebase -c | hidebackup
70
70
71 hg glog --template '{rev} {desc} tags: {tags}\n'
71 hg glog --template '{rev} {desc} tags: {tags}\n'
72
72
73 echo
73 echo
74 echo '% Update to qbase'
74 echo '% Update to qbase'
75 hg up qbase
75 hg up qbase
76 echo '% f correctly reflects the merge result'
76 echo '% f correctly reflects the merge result'
77 cat f
77 cat f
78 echo '% And the patch is correct'
78 echo '% And the patch is correct'
79 cat .hg/patches/f.patch | filterpatch
79 cat .hg/patches/f.patch | filterpatch
80
80
81 echo
81 echo
82 echo '% Update to qtip'
82 echo '% Update to qtip'
83 hg up qtip
83 hg up qtip
84 echo '% f correctly reflects the merge result'
84 echo '% f correctly reflects the merge result'
85 cat f
85 cat f
86 echo '% And the patch is correct'
86 echo '% And the patch is correct'
87 cat .hg/patches/f2.patch | filterpatch
87 cat .hg/patches/f2.patch | filterpatch
88
88
89 echo
89 echo
90 echo '% Adding one git-style patch and one normal'
90 echo '% Adding one git-style patch and one normal'
91 hg qpop -a
91 hg qpop -a
92 rm -fr .hg/patches
92 rm -fr .hg/patches
93 hg qinit -c
93 hg qinit -c
94
94
95 hg up 0
95 hg up 0
96 hg qnew --git f_git.patch
96 hg qnew --git f_git.patch
97 echo 'mq1' > p
97 echo 'mq1' > p
98 hg add p
98 hg add p
99 hg qref --git -m 'P0 (git)'
99 hg qref --git -m 'P0 (git)'
100
100
101 hg qnew f.patch
101 hg qnew f.patch
102 echo 'mq2' > p
102 echo 'mq2' > p
103 hg qref -m 'P1'
103 hg qref -m 'P1'
104 hg qcommit -m 'save patch state'
105 echo '% patch series step 1/2'
106 hg qseries -s
107 echo '% patch queue manifest step 1/2'
108 hg -R .hg/patches manifest
104
109
105 echo '% Git patch'
110 echo '% Git patch'
106 cat .hg/patches/f_git.patch | filterpatch
111 cat .hg/patches/f_git.patch | filterpatch
107
112
108 echo
113 echo
109 echo '% Normal patch'
114 echo '% Normal patch'
110 cat .hg/patches/f.patch | filterpatch
115 cat .hg/patches/f.patch | filterpatch
111
116
112 echo
117 echo
113 echo '% Rebase the applied mq patches'
118 echo '% Rebase the applied mq patches'
114 hg rebase -s 2 -d 1 --quiet
119 hg rebase -s 2 -d 1 --quiet
120 hg qcommit -m 'save patch state'
121 echo '% patch series step 2/2'
122 hg qseries -s
123 echo '% patch queue manifest step 2/2'
124 hg -R .hg/patches manifest
115
125
116 echo '% And the patches are correct'
126 echo '% And the patches are correct'
117 echo '% Git patch'
127 echo '% Git patch'
118 cat .hg/patches/f_git.patch | filterpatch
128 cat .hg/patches/f_git.patch | filterpatch
119
129
120 echo
130 echo
121 echo '% Normal patch'
131 echo '% Normal patch'
122 cat .hg/patches/f.patch | filterpatch
132 cat .hg/patches/f.patch | filterpatch
123
133
@@ -1,132 +1,148 b''
1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
2 @ 3 P1 tags: f2.patch qtip tip
2 @ 3 P1 tags: f2.patch qtip tip
3 |
3 |
4 o 2 P0 tags: f.patch qbase
4 o 2 P0 tags: f.patch qbase
5 |
5 |
6 | o 1 R1 tags:
6 | o 1 R1 tags:
7 |/
7 |/
8 o 0 C1 tags: qparent
8 o 0 C1 tags: qparent
9
9
10
10
11 % Rebase - try to rebase on an applied mq patch
11 % Rebase - try to rebase on an applied mq patch
12 abort: cannot rebase onto an applied mq patch
12 abort: cannot rebase onto an applied mq patch
13
13
14 % Rebase - same thing, but mq patch is default dest
14 % Rebase - same thing, but mq patch is default dest
15 abort: cannot rebase onto an applied mq patch
15 abort: cannot rebase onto an applied mq patch
16
16
17 % Rebase - generate a conflict
17 % Rebase - generate a conflict
18 merging f
18 merging f
19 warning: conflicts during merge.
19 warning: conflicts during merge.
20 merging f failed!
20 merging f failed!
21 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
21 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
22
22
23 % Fix the 1st conflict
23 % Fix the 1st conflict
24 warning: conflicts during merge.
24 warning: conflicts during merge.
25 merging f failed!
25 merging f failed!
26 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
26 abort: fix unresolved conflicts with hg resolve then run hg rebase --continue
27 merging f
27 merging f
28
28
29 % Fix the 2nd conflict
29 % Fix the 2nd conflict
30 saved backup bundle to
30 saved backup bundle to
31 @ 3 P1 tags: f2.patch qtip tip
31 @ 3 P1 tags: f2.patch qtip tip
32 |
32 |
33 o 2 P0 tags: f.patch qbase
33 o 2 P0 tags: f.patch qbase
34 |
34 |
35 o 1 R1 tags: qparent
35 o 1 R1 tags: qparent
36 |
36 |
37 o 0 C1 tags:
37 o 0 C1 tags:
38
38
39
39
40 % Update to qbase
40 % Update to qbase
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 % f correctly reflects the merge result
42 % f correctly reflects the merge result
43 mq1r1
43 mq1r1
44 % And the patch is correct
44 % And the patch is correct
45 # HG changeset patch
45 # HG changeset patch
46 # User test
46 # User test
47 # Date
47 # Date
48 # Node ID
48 # Node ID
49 # Parent
49 # Parent
50 P0
50 P0
51
51
52 diff -r x -r y f
52 diff -r x -r y f
53 --- a/f
53 --- a/f
54 +++ b/f
54 +++ b/f
55 @@ -1,1 +1,1 @@
55 @@ -1,1 +1,1 @@
56 -r1
56 -r1
57 +mq1r1
57 +mq1r1
58
58
59 % Update to qtip
59 % Update to qtip
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 % f correctly reflects the merge result
61 % f correctly reflects the merge result
62 mq1r1mq2
62 mq1r1mq2
63 % And the patch is correct
63 % And the patch is correct
64 # HG changeset patch
64 # HG changeset patch
65 # User test
65 # User test
66 # Date
66 # Date
67 # Node ID
67 # Node ID
68 # Parent
68 # Parent
69 P1
69 P1
70
70
71 diff -r x -r y f
71 diff -r x -r y f
72 --- a/f
72 --- a/f
73 +++ b/f
73 +++ b/f
74 @@ -1,1 +1,1 @@
74 @@ -1,1 +1,1 @@
75 -mq1r1
75 -mq1r1
76 +mq1r1mq2
76 +mq1r1mq2
77
77
78 % Adding one git-style patch and one normal
78 % Adding one git-style patch and one normal
79 popping f2.patch
79 popping f2.patch
80 popping f.patch
80 popping f.patch
81 patch queue now empty
81 patch queue now empty
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 % patch series step 1/2
84 f_git.patch: P0 (git)
85 f.patch: P1
86 % patch queue manifest step 1/2
87 .hgignore
88 f.patch
89 f_git.patch
90 series
83 % Git patch
91 % Git patch
84 P0 (git)
92 P0 (git)
85
93
86 diff --git a/p b/p
94 diff --git a/p b/p
87 new file mode 100644
95 new file mode 100644
88 --- /dev/null
96 --- /dev/null
89 +++ b/p
97 +++ b/p
90 @@ -0,0 +1,1 @@
98 @@ -0,0 +1,1 @@
91 +mq1
99 +mq1
92
100
93 % Normal patch
101 % Normal patch
94 P1
102 P1
95
103
96 diff -r x p
104 diff -r x p
97 --- a/p
105 --- a/p
98 +++ b/p
106 +++ b/p
99 @@ -1,1 +1,1 @@
107 @@ -1,1 +1,1 @@
100 -mq1
108 -mq1
101 +mq2
109 +mq2
102
110
103 % Rebase the applied mq patches
111 % Rebase the applied mq patches
112 % patch series step 2/2
113 f_git.patch: P0 (git)
114 f.patch: P1
115 % patch queue manifest step 2/2
116 .hgignore
117 f.patch
118 f_git.patch
119 series
104 % And the patches are correct
120 % And the patches are correct
105 % Git patch
121 % Git patch
106 # HG changeset patch
122 # HG changeset patch
107 # User test
123 # User test
108 # Date
124 # Date
109 # Node ID
125 # Node ID
110 # Parent
126 # Parent
111 P0 (git)
127 P0 (git)
112
128
113 diff --git a/p b/p
129 diff --git a/p b/p
114 new file mode 100644
130 new file mode 100644
115 --- /dev/null
131 --- /dev/null
116 +++ b/p
132 +++ b/p
117 @@ -0,0 +1,1 @@
133 @@ -0,0 +1,1 @@
118 +mq1
134 +mq1
119
135
120 % Normal patch
136 % Normal patch
121 # HG changeset patch
137 # HG changeset patch
122 # User test
138 # User test
123 # Date
139 # Date
124 # Node ID
140 # Node ID
125 # Parent
141 # Parent
126 P1
142 P1
127
143
128 --- a/p
144 --- a/p
129 +++ b/p
145 +++ b/p
130 @@ -1,1 +1,1 @@
146 @@ -1,1 +1,1 @@
131 -mq1
147 -mq1
132 +mq2
148 +mq2
General Comments 0
You need to be logged in to leave comments. Login now