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