| 1 |
$ cat >> $HGRCPATH <<EOF |
| 2 |
> [extensions] |
| 3 |
> rebase= |
| 4 |
> mq= |
| 5 |
> |
| 6 |
> [mq] |
| 7 |
> plain=true |
| 8 |
> |
| 9 |
> [alias] |
| 10 |
> tglog = log -G --template "{rev}: {node|short} '{desc}' tags: {tags}\n" |
| 11 |
> EOF |
| 12 |
|
| 13 |
|
| 14 |
$ hg init a |
| 15 |
$ cd a |
| 16 |
$ hg qinit -c |
| 17 |
|
| 18 |
$ echo c1 > f |
| 19 |
$ hg add f |
| 20 |
$ hg ci -m C1 |
| 21 |
|
| 22 |
$ echo r1 > f |
| 23 |
$ hg ci -m R1 |
| 24 |
|
| 25 |
$ hg up -q 0 |
| 26 |
|
| 27 |
$ hg qnew f.patch -d '1 0' |
| 28 |
$ echo mq1 > f |
| 29 |
$ hg qref -m P0 |
| 30 |
|
| 31 |
$ hg qnew f2.patch |
| 32 |
$ echo mq2 > f |
| 33 |
$ hg qref -m P1 -d '2 0' |
| 34 |
|
| 35 |
$ hg tglog |
| 36 |
@ 3: 929394423cd3 'P1' tags: f2.patch qtip tip |
| 37 |
| |
| 38 |
o 2: 3504f44bffc0 'P0' tags: f.patch qbase |
| 39 |
| |
| 40 |
| o 1: bac9ed9960d8 'R1' tags: |
| 41 |
|/ |
| 42 |
o 0: 36f36ddbca61 'C1' tags: qparent |
| 43 |
|
| 44 |
|
| 45 |
Rebase - try to rebase on an applied mq patch: |
| 46 |
|
| 47 |
$ hg rebase -s 1 -d 3 |
| 48 |
abort: cannot rebase onto an applied mq patch |
| 49 |
[20] |
| 50 |
|
| 51 |
Rebase - same thing, but mq patch is default dest: |
| 52 |
|
| 53 |
$ hg up -q 1 |
| 54 |
$ hg rebase |
| 55 |
abort: cannot rebase onto an applied mq patch |
| 56 |
[20] |
| 57 |
$ hg up -q qtip |
| 58 |
|
| 59 |
Rebase - generate a conflict: |
| 60 |
|
| 61 |
$ hg rebase -s 2 -d 1 |
| 62 |
rebasing 2:3504f44bffc0 f.patch qbase "P0" |
| 63 |
merging f |
| 64 |
warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
| 65 |
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
| 66 |
[240] |
| 67 |
|
| 68 |
Fix the 1st conflict: |
| 69 |
|
| 70 |
$ echo mq1r1 > f |
| 71 |
$ hg resolve -m f |
| 72 |
(no more unresolved files) |
| 73 |
continue: hg rebase --continue |
| 74 |
$ hg rebase -c |
| 75 |
rebasing 2:3504f44bffc0 f.patch qbase "P0" |
| 76 |
rebasing 3:929394423cd3 f2.patch qtip tip "P1" |
| 77 |
merging f |
| 78 |
warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
| 79 |
unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
| 80 |
[240] |
| 81 |
|
| 82 |
Fix the 2nd conflict: |
| 83 |
|
| 84 |
$ echo mq1r1mq2 > f |
| 85 |
$ hg resolve -m f |
| 86 |
(no more unresolved files) |
| 87 |
continue: hg rebase --continue |
| 88 |
$ hg rebase -c |
| 89 |
already rebased 2:3504f44bffc0 f.patch qbase "P0" as ebe9914c0d1c |
| 90 |
rebasing 3:929394423cd3 f2.patch qtip "P1" |
| 91 |
saved backup bundle to $TESTTMP/a/.hg/strip-backup/3504f44bffc0-30595b40-rebase.hg |
| 92 |
|
| 93 |
$ hg tglog |
| 94 |
@ 3: 462012cf340c 'P1' tags: f2.patch qtip tip |
| 95 |
| |
| 96 |
o 2: ebe9914c0d1c 'P0' tags: f.patch qbase |
| 97 |
| |
| 98 |
o 1: bac9ed9960d8 'R1' tags: qparent |
| 99 |
| |
| 100 |
o 0: 36f36ddbca61 'C1' tags: |
| 101 |
|
| 102 |
$ hg up -q qbase |
| 103 |
|
| 104 |
$ cat f |
| 105 |
mq1r1 |
| 106 |
|
| 107 |
$ cat .hg/patches/f.patch |
| 108 |
# HG changeset patch |
| 109 |
# User test |
| 110 |
# Date 1 0 |
| 111 |
# Thu Jan 01 00:00:01 1970 +0000 |
| 112 |
# Node ID ebe9914c0d1c3f60096e952fa4dbb3d377dea3ab |
| 113 |
# Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0 |
| 114 |
P0 |
| 115 |
|
| 116 |
diff -r bac9ed9960d8 -r ebe9914c0d1c f |
| 117 |
--- a/f Thu Jan 01 00:00:00 1970 +0000 |
| 118 |
+++ b/f Thu Jan 01 00:00:01 1970 +0000 |
| 119 |
@@ -1,1 +1,1 @@ |
| 120 |
-r1 |
| 121 |
+mq1r1 |
| 122 |
|
| 123 |
Update to qtip: |
| 124 |
|
| 125 |
$ hg up -q qtip |
| 126 |
|
| 127 |
$ cat f |
| 128 |
mq1r1mq2 |
| 129 |
|
| 130 |
$ cat .hg/patches/f2.patch |
| 131 |
# HG changeset patch |
| 132 |
# User test |
| 133 |
# Date 2 0 |
| 134 |
# Thu Jan 01 00:00:02 1970 +0000 |
| 135 |
# Node ID 462012cf340c97d44d62377c985a423f6bb82f07 |
| 136 |
# Parent ebe9914c0d1c3f60096e952fa4dbb3d377dea3ab |
| 137 |
P1 |
| 138 |
|
| 139 |
diff -r ebe9914c0d1c -r 462012cf340c f |
| 140 |
--- a/f Thu Jan 01 00:00:01 1970 +0000 |
| 141 |
+++ b/f Thu Jan 01 00:00:02 1970 +0000 |
| 142 |
@@ -1,1 +1,1 @@ |
| 143 |
-mq1r1 |
| 144 |
+mq1r1mq2 |
| 145 |
|
| 146 |
Adding one git-style patch and one normal: |
| 147 |
|
| 148 |
$ hg qpop -a |
| 149 |
popping f2.patch |
| 150 |
popping f.patch |
| 151 |
patch queue now empty |
| 152 |
|
| 153 |
$ rm -fr .hg/patches |
| 154 |
$ hg qinit -c |
| 155 |
|
| 156 |
$ hg up -q 0 |
| 157 |
|
| 158 |
$ hg qnew --git f_git.patch -d '3 0' |
| 159 |
$ echo mq1 > p |
| 160 |
$ hg add p |
| 161 |
$ hg qref --git -m 'P0 (git)' |
| 162 |
|
| 163 |
$ hg qnew f.patch -d '4 0' |
| 164 |
$ echo mq2 > p |
| 165 |
$ hg qref -m P1 |
| 166 |
$ hg qci -m 'save patch state' |
| 167 |
|
| 168 |
$ hg qseries -s |
| 169 |
f_git.patch: P0 (git) |
| 170 |
f.patch: P1 |
| 171 |
|
| 172 |
$ hg -R .hg/patches manifest |
| 173 |
.hgignore |
| 174 |
f.patch |
| 175 |
f_git.patch |
| 176 |
series |
| 177 |
|
| 178 |
$ cat .hg/patches/f_git.patch |
| 179 |
Date: 3 0 |
| 180 |
|
| 181 |
P0 (git) |
| 182 |
|
| 183 |
diff --git a/p b/p |
| 184 |
new file mode 100644 |
| 185 |
--- /dev/null |
| 186 |
+++ b/p |
| 187 |
@@ -0,0 +1,1 @@ |
| 188 |
+mq1 |
| 189 |
|
| 190 |
$ cat .hg/patches/f.patch |
| 191 |
Date: 4 0 |
| 192 |
|
| 193 |
P1 |
| 194 |
|
| 195 |
diff -r ???????????? p (glob) |
| 196 |
--- a/p ??? ??? ?? ??:??:?? ???? ????? (glob) |
| 197 |
+++ b/p ??? ??? ?? ??:??:?? ???? ????? (glob) |
| 198 |
@@ -1,1 +1,1 @@ |
| 199 |
-mq1 |
| 200 |
+mq2 |
| 201 |
|
| 202 |
|
| 203 |
Rebase the applied mq patches: |
| 204 |
|
| 205 |
$ hg rebase -s 2 -d 1 |
| 206 |
rebasing 2:0c587ffcb480 f_git.patch qbase "P0 (git)" |
| 207 |
rebasing 3:c7f18665e4bc f.patch qtip tip "P1" |
| 208 |
saved backup bundle to $TESTTMP/a/.hg/strip-backup/0c587ffcb480-0ea5695f-rebase.hg |
| 209 |
|
| 210 |
$ hg qci -m 'save patch state' |
| 211 |
|
| 212 |
$ hg qseries -s |
| 213 |
f_git.patch: P0 (git) |
| 214 |
f.patch: P1 |
| 215 |
|
| 216 |
$ hg -R .hg/patches manifest |
| 217 |
.hgignore |
| 218 |
f.patch |
| 219 |
f_git.patch |
| 220 |
series |
| 221 |
|
| 222 |
$ cat .hg/patches/f_git.patch |
| 223 |
# HG changeset patch |
| 224 |
# User test |
| 225 |
# Date 3 0 |
| 226 |
# Thu Jan 01 00:00:03 1970 +0000 |
| 227 |
# Node ID 12d9f6a3bbe560dee50c7c454d434add7fb8e837 |
| 228 |
# Parent bac9ed9960d8992bcad75864a879fa76cadaf1b0 |
| 229 |
P0 (git) |
| 230 |
|
| 231 |
diff --git a/p b/p |
| 232 |
new file mode 100644 |
| 233 |
--- /dev/null |
| 234 |
+++ b/p |
| 235 |
@@ -0,0 +1,1 @@ |
| 236 |
+mq1 |
| 237 |
|
| 238 |
$ cat .hg/patches/f.patch |
| 239 |
# HG changeset patch |
| 240 |
# User test |
| 241 |
# Date 4 0 |
| 242 |
# Thu Jan 01 00:00:04 1970 +0000 |
| 243 |
# Node ID c77a2661c64c60d82f63c4f7aefd95b3a948a557 |
| 244 |
# Parent 12d9f6a3bbe560dee50c7c454d434add7fb8e837 |
| 245 |
P1 |
| 246 |
|
| 247 |
diff -r 12d9f6a3bbe5 -r c77a2661c64c p |
| 248 |
--- a/p Thu Jan 01 00:00:03 1970 +0000 |
| 249 |
+++ b/p Thu Jan 01 00:00:04 1970 +0000 |
| 250 |
@@ -1,1 +1,1 @@ |
| 251 |
-mq1 |
| 252 |
+mq2 |
| 253 |
|
| 254 |
$ cd .. |
| 255 |
|
| 256 |
Rebase with guards |
| 257 |
|
| 258 |
$ hg init foo |
| 259 |
$ cd foo |
| 260 |
$ echo a > a |
| 261 |
$ hg ci -Am a |
| 262 |
adding a |
| 263 |
|
| 264 |
Create mq repo with guarded patches foo and bar and empty patch: |
| 265 |
|
| 266 |
$ hg qinit |
| 267 |
$ echo guarded > guarded |
| 268 |
$ hg add guarded |
| 269 |
$ hg qnew guarded |
| 270 |
$ hg qnew empty-important -m 'important commit message' -d '1 0' |
| 271 |
$ echo bar > bar |
| 272 |
$ hg add bar |
| 273 |
$ hg qnew bar -d '2 0' |
| 274 |
$ echo foo > foo |
| 275 |
$ hg add foo |
| 276 |
$ hg qnew foo |
| 277 |
$ hg qpop -a |
| 278 |
popping foo |
| 279 |
popping bar |
| 280 |
popping empty-important |
| 281 |
popping guarded |
| 282 |
patch queue now empty |
| 283 |
$ hg qguard guarded +guarded |
| 284 |
$ hg qguard bar +baz |
| 285 |
$ hg qguard foo +baz |
| 286 |
$ hg qselect baz |
| 287 |
number of unguarded, unapplied patches has changed from 1 to 3 |
| 288 |
$ hg qpush bar |
| 289 |
applying empty-important |
| 290 |
patch empty-important is empty |
| 291 |
applying bar |
| 292 |
now at: bar |
| 293 |
|
| 294 |
$ hg qguard -l |
| 295 |
guarded: +guarded |
| 296 |
empty-important: unguarded |
| 297 |
bar: +baz |
| 298 |
foo: +baz |
| 299 |
|
| 300 |
$ hg tglog |
| 301 |
@ 2: 4f44b861d38c 'imported patch bar' tags: bar qtip tip |
| 302 |
| |
| 303 |
o 1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase |
| 304 |
| |
| 305 |
o 0: cb9a9f314b8b 'a' tags: qparent |
| 306 |
|
| 307 |
Create new head to rebase bar onto: |
| 308 |
|
| 309 |
$ hg up -C 0 |
| 310 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 311 |
$ echo b > b |
| 312 |
$ hg add b |
| 313 |
$ hg ci -m b |
| 314 |
created new head |
| 315 |
$ hg up -C 2 |
| 316 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 317 |
$ echo a >> a |
| 318 |
$ hg qref |
| 319 |
|
| 320 |
$ hg tglog |
| 321 |
@ 3: d526d4536ed6 '[mq]: bar' tags: bar qtip tip |
| 322 |
| |
| 323 |
| o 2: d2ae7f538514 'b' tags: |
| 324 |
| | |
| 325 |
o | 1: 0aaf4c3af7eb 'important commit message' tags: empty-important qbase |
| 326 |
|/ |
| 327 |
o 0: cb9a9f314b8b 'a' tags: qparent |
| 328 |
|
| 329 |
|
| 330 |
Rebase bar (make sure series order is preserved and empty-important also is |
| 331 |
removed from the series): |
| 332 |
|
| 333 |
$ hg qseries |
| 334 |
guarded |
| 335 |
empty-important |
| 336 |
bar |
| 337 |
foo |
| 338 |
$ [ -f .hg/patches/empty-important ] |
| 339 |
$ hg -q rebase -d 2 |
| 340 |
note: not rebasing 1:0aaf4c3af7eb empty-important qbase "important commit message", its destination already has all its changes |
| 341 |
$ hg qseries |
| 342 |
guarded |
| 343 |
bar |
| 344 |
foo |
| 345 |
$ [ -f .hg/patches/empty-important ] |
| 346 |
[1] |
| 347 |
|
| 348 |
$ hg qguard -l |
| 349 |
guarded: +guarded |
| 350 |
bar: +baz |
| 351 |
foo: +baz |
| 352 |
|
| 353 |
$ hg tglog |
| 354 |
@ 2: 477d948bb2af '[mq]: bar' tags: bar qbase qtip tip |
| 355 |
| |
| 356 |
o 1: d2ae7f538514 'b' tags: qparent |
| 357 |
| |
| 358 |
o 0: cb9a9f314b8b 'a' tags: |
| 359 |
|
| 360 |
$ cd .. |