Debian Codegraph @

tests/test-mq-merge.t

raw
1 Setup extension:
2
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
5 > mq =
6 > [mq]
7 > git = keep
8 > EOF
9
10 Test merge with mq changeset as the second parent:
11
12 $ hg init m
13 $ cd m
14 $ touch a b c
15 $ hg add a
16 $ hg commit -m a
17 $ hg add b
18 $ hg qnew -d "0 0" b
19 $ hg update 0
20 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
21 $ hg add c
22 $ hg commit -m c
23 created new head
24 $ hg merge
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26 (branch merge, don't forget to commit)
27 $ hg commit -m merge
28 abort: cannot commit over an applied mq patch
29 [255]
30 $ cd ..
31
32 Issue529: mq aborts when merging patch deleting files
33
34 $ checkundo()
35 > {
36 > if [ -f .hg/store/undo ]; then
37 > echo ".hg/store/undo still exists"
38 > fi
39 > }
40
41 Commit two dummy files in "init" changeset:
42
43 $ hg init t
44 $ cd t
45 $ echo a > a
46 $ echo b > b
47 $ hg ci -Am init
48 adding a
49 adding b
50 $ hg tag -l init
51
52 Create a patch removing a:
53
54 $ hg qnew rm_a
55 $ hg rm a
56 $ hg qrefresh -m "rm a"
57
58 Save the patch queue so we can merge it later:
59
60 $ hg qsave -c -e
61 copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1
62 $ checkundo
63
64 Update b and commit in an "update" changeset:
65
66 $ hg up -C init
67 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 $ echo b >> b
69 $ hg st
70 M b
71 $ hg ci -m update
72 created new head
73
74 # Here, qpush used to abort with :
75 # The system cannot find the file specified => a
76 $ hg manifest
77 a
78 b
79
80 $ hg qpush -a -m
81 merging with queue at: $TESTTMP/t/.hg/patches.1
82 applying rm_a
83 now at: rm_a
84
85 $ checkundo
86 $ hg manifest
87 b
88
89 Ensure status is correct after merge:
90
91 $ hg qpop -a
92 popping rm_a
93 popping .hg.patches.merge.marker
94 patch queue now empty
95
96 $ cd ..
97
98 Classic MQ merge sequence *with an explicit named queue*:
99
100 $ hg init t2
101 $ cd t2
102 $ echo '[diff]' > .hg/hgrc
103 $ echo 'nodates = 1' >> .hg/hgrc
104 $ echo a > a
105 $ hg ci -Am init
106 adding a
107 $ echo b > a
108 $ hg ci -m changea
109 $ hg up -C 0
110 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
111 $ hg cp a aa
112 $ echo c >> a
113 $ hg qnew --git -f -e patcha
114 $ echo d >> a
115 $ hg qnew -d '0 0' -f -e patcha2
116
117 Create the reference queue:
118
119 $ hg qsave -c -e -n refqueue
120 copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue
121 $ hg up -C 1
122 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
123
124 Merge:
125
126 $ HGMERGE=internal:other hg qpush -a -m -n refqueue
127 merging with queue at: $TESTTMP/t2/.hg/refqueue
128 applying patcha
129 patching file a
130 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
131 fuzz found when applying patch, stopping
132 patch didn't work out, merging patcha
133 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
134 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
135 applying patcha2
136 now at: patcha2
137
138 Check patcha is still a git patch:
139
140 $ cat .hg/patches/patcha
141 # HG changeset patch
142 # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
143
144 diff --git a/a b/a
145 --- a/a
146 +++ b/a
147 @@ -1,1 +1,2 @@
148 -b
149 +a
150 +c
151 diff --git a/a b/aa
152 copy from a
153 copy to aa
154 --- a/a
155 +++ b/aa
156 @@ -1,1 +1,1 @@
157 -b
158 +a
159
160 Check patcha2 is still a regular patch:
161
162 $ cat .hg/patches/patcha2
163 # HG changeset patch
164 # Date 0 0
165 # Parent ???????????????????????????????????????? (glob)
166
167 diff -r ???????????? -r ???????????? a (glob)
168 --- a/a
169 +++ b/a
170 @@ -1,2 +1,3 @@
171 a
172 c
173 +d
174
175 $ cd ..
176