| 1 |
Create configuration |
| 2 |
|
| 3 |
$ echo "[ui]" >> $HGRCPATH |
| 4 |
$ echo "interactive=true" >> $HGRCPATH |
| 5 |
|
| 6 |
help qrefresh (no record) |
| 7 |
|
| 8 |
$ echo "[extensions]" >> $HGRCPATH |
| 9 |
$ echo "mq=" >> $HGRCPATH |
| 10 |
$ hg help qrefresh |
| 11 |
hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]... |
| 12 |
|
| 13 |
update the current patch |
| 14 |
|
| 15 |
If any file patterns are provided, the refreshed patch will contain only the |
| 16 |
modifications that match those patterns; the remaining modifications will |
| 17 |
remain in the working directory. |
| 18 |
|
| 19 |
If -s/--short is specified, files currently included in the patch will be |
| 20 |
refreshed just like matched files and remain in the patch. |
| 21 |
|
| 22 |
If -e/--edit is specified, Mercurial will start your configured editor for you |
| 23 |
to enter a message. In case qrefresh fails, you will find a backup of your |
| 24 |
message in ".hg/last-message.txt". |
| 25 |
|
| 26 |
hg add/remove/copy/rename work as usual, though you might want to use git- |
| 27 |
style patches (-g/--git or [diff] git=1) to track copies and renames. See the |
| 28 |
diffs help topic for more information on the git diff format. |
| 29 |
|
| 30 |
Returns 0 on success. |
| 31 |
|
| 32 |
options ([+] can be repeated): |
| 33 |
|
| 34 |
-e --edit invoke editor on commit messages |
| 35 |
-g --git use git extended diff format |
| 36 |
-s --short refresh only files already in the patch and |
| 37 |
specified files |
| 38 |
-U --currentuser add/update author field in patch with current user |
| 39 |
-u --user USER add/update author field in patch with given user |
| 40 |
-D --currentdate add/update date field in patch with current date |
| 41 |
-d --date DATE add/update date field in patch with given date |
| 42 |
-I --include PATTERN [+] include names matching the given patterns |
| 43 |
-X --exclude PATTERN [+] exclude names matching the given patterns |
| 44 |
-m --message TEXT use text as commit message |
| 45 |
-l --logfile FILE read commit message from file |
| 46 |
|
| 47 |
(some details hidden, use --verbose to show complete help) |
| 48 |
|
| 49 |
help qrefresh (record) |
| 50 |
|
| 51 |
$ echo "record=" >> $HGRCPATH |
| 52 |
$ hg help qrefresh |
| 53 |
hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]... |
| 54 |
|
| 55 |
update the current patch |
| 56 |
|
| 57 |
If any file patterns are provided, the refreshed patch will contain only the |
| 58 |
modifications that match those patterns; the remaining modifications will |
| 59 |
remain in the working directory. |
| 60 |
|
| 61 |
If -s/--short is specified, files currently included in the patch will be |
| 62 |
refreshed just like matched files and remain in the patch. |
| 63 |
|
| 64 |
If -e/--edit is specified, Mercurial will start your configured editor for you |
| 65 |
to enter a message. In case qrefresh fails, you will find a backup of your |
| 66 |
message in ".hg/last-message.txt". |
| 67 |
|
| 68 |
hg add/remove/copy/rename work as usual, though you might want to use git- |
| 69 |
style patches (-g/--git or [diff] git=1) to track copies and renames. See the |
| 70 |
diffs help topic for more information on the git diff format. |
| 71 |
|
| 72 |
Returns 0 on success. |
| 73 |
|
| 74 |
options ([+] can be repeated): |
| 75 |
|
| 76 |
-e --edit invoke editor on commit messages |
| 77 |
-g --git use git extended diff format |
| 78 |
-s --short refresh only files already in the patch and |
| 79 |
specified files |
| 80 |
-U --currentuser add/update author field in patch with current user |
| 81 |
-u --user USER add/update author field in patch with given user |
| 82 |
-D --currentdate add/update date field in patch with current date |
| 83 |
-d --date DATE add/update date field in patch with given date |
| 84 |
-I --include PATTERN [+] include names matching the given patterns |
| 85 |
-X --exclude PATTERN [+] exclude names matching the given patterns |
| 86 |
-m --message TEXT use text as commit message |
| 87 |
-l --logfile FILE read commit message from file |
| 88 |
-i --interactive interactively select changes to refresh |
| 89 |
|
| 90 |
(some details hidden, use --verbose to show complete help) |
| 91 |
|
| 92 |
$ hg init a |
| 93 |
$ cd a |
| 94 |
|
| 95 |
Base commit |
| 96 |
|
| 97 |
$ cat > 1.txt <<EOF |
| 98 |
> 1 |
| 99 |
> 2 |
| 100 |
> 3 |
| 101 |
> 4 |
| 102 |
> 5 |
| 103 |
> EOF |
| 104 |
$ cat > 2.txt <<EOF |
| 105 |
> a |
| 106 |
> b |
| 107 |
> c |
| 108 |
> d |
| 109 |
> e |
| 110 |
> f |
| 111 |
> EOF |
| 112 |
|
| 113 |
$ mkdir dir |
| 114 |
$ cat > dir/a.txt <<EOF |
| 115 |
> hello world |
| 116 |
> |
| 117 |
> someone |
| 118 |
> up |
| 119 |
> there |
| 120 |
> loves |
| 121 |
> me |
| 122 |
> EOF |
| 123 |
|
| 124 |
$ hg add 1.txt 2.txt dir/a.txt |
| 125 |
$ hg commit -m aaa |
| 126 |
$ hg qrecord --config ui.interactive=false patch |
| 127 |
abort: running non-interactively, use qnew instead |
| 128 |
[10] |
| 129 |
$ hg qnew -i --config ui.interactive=false patch |
| 130 |
abort: running non-interactively |
| 131 |
[10] |
| 132 |
$ hg qnew -d '0 0' patch |
| 133 |
|
| 134 |
Changing files |
| 135 |
|
| 136 |
$ sed -e 's/2/2 2/;s/4/4 4/' 1.txt > 1.txt.new |
| 137 |
$ sed -e 's/b/b b/' 2.txt > 2.txt.new |
| 138 |
$ sed -e 's/hello world/hello world!/' dir/a.txt > dir/a.txt.new |
| 139 |
|
| 140 |
$ mv -f 1.txt.new 1.txt |
| 141 |
$ mv -f 2.txt.new 2.txt |
| 142 |
$ mv -f dir/a.txt.new dir/a.txt |
| 143 |
|
| 144 |
Whole diff |
| 145 |
|
| 146 |
$ hg diff --nodates |
| 147 |
diff -r ed27675cb5df 1.txt |
| 148 |
--- a/1.txt |
| 149 |
+++ b/1.txt |
| 150 |
@@ -1,5 +1,5 @@ |
| 151 |
1 |
| 152 |
-2 |
| 153 |
+2 2 |
| 154 |
3 |
| 155 |
-4 |
| 156 |
+4 4 |
| 157 |
5 |
| 158 |
diff -r ed27675cb5df 2.txt |
| 159 |
--- a/2.txt |
| 160 |
+++ b/2.txt |
| 161 |
@@ -1,5 +1,5 @@ |
| 162 |
a |
| 163 |
-b |
| 164 |
+b b |
| 165 |
c |
| 166 |
d |
| 167 |
e |
| 168 |
diff -r ed27675cb5df dir/a.txt |
| 169 |
--- a/dir/a.txt |
| 170 |
+++ b/dir/a.txt |
| 171 |
@@ -1,4 +1,4 @@ |
| 172 |
-hello world |
| 173 |
+hello world! |
| 174 |
|
| 175 |
someone |
| 176 |
up |
| 177 |
|
| 178 |
partial qrefresh |
| 179 |
|
| 180 |
$ hg qrefresh -i --config ui.interactive=false |
| 181 |
abort: running non-interactively |
| 182 |
[10] |
| 183 |
$ hg qrefresh -i -d '0 0' <<EOF |
| 184 |
> y |
| 185 |
> y |
| 186 |
> n |
| 187 |
> y |
| 188 |
> y |
| 189 |
> n |
| 190 |
> EOF |
| 191 |
diff --git a/1.txt b/1.txt |
| 192 |
2 hunks, 2 lines changed |
| 193 |
examine changes to '1.txt'? |
| 194 |
(enter ? for help) [Ynesfdaq?] y |
| 195 |
|
| 196 |
@@ -1,3 +1,3 @@ |
| 197 |
1 |
| 198 |
-2 |
| 199 |
+2 2 |
| 200 |
3 |
| 201 |
record change 1/4 to '1.txt'? |
| 202 |
(enter ? for help) [Ynesfdaq?] y |
| 203 |
|
| 204 |
@@ -3,3 +3,3 @@ |
| 205 |
3 |
| 206 |
-4 |
| 207 |
+4 4 |
| 208 |
5 |
| 209 |
record change 2/4 to '1.txt'? |
| 210 |
(enter ? for help) [Ynesfdaq?] n |
| 211 |
|
| 212 |
diff --git a/2.txt b/2.txt |
| 213 |
1 hunks, 1 lines changed |
| 214 |
examine changes to '2.txt'? |
| 215 |
(enter ? for help) [Ynesfdaq?] y |
| 216 |
|
| 217 |
@@ -1,5 +1,5 @@ |
| 218 |
a |
| 219 |
-b |
| 220 |
+b b |
| 221 |
c |
| 222 |
d |
| 223 |
e |
| 224 |
record change 3/4 to '2.txt'? |
| 225 |
(enter ? for help) [Ynesfdaq?] y |
| 226 |
|
| 227 |
diff --git a/dir/a.txt b/dir/a.txt |
| 228 |
1 hunks, 1 lines changed |
| 229 |
examine changes to 'dir/a.txt'? |
| 230 |
(enter ? for help) [Ynesfdaq?] n |
| 231 |
|
| 232 |
|
| 233 |
After partial qrefresh 'tip' |
| 234 |
|
| 235 |
$ hg tip -p |
| 236 |
changeset: 1:0738af1a8211 |
| 237 |
tag: patch |
| 238 |
tag: qbase |
| 239 |
tag: qtip |
| 240 |
tag: tip |
| 241 |
user: test |
| 242 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 243 |
summary: [mq]: patch |
| 244 |
|
| 245 |
diff -r 1fd39ab63a33 -r 0738af1a8211 1.txt |
| 246 |
--- a/1.txt Thu Jan 01 00:00:00 1970 +0000 |
| 247 |
+++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 |
| 248 |
@@ -1,5 +1,5 @@ |
| 249 |
1 |
| 250 |
-2 |
| 251 |
+2 2 |
| 252 |
3 |
| 253 |
4 |
| 254 |
5 |
| 255 |
diff -r 1fd39ab63a33 -r 0738af1a8211 2.txt |
| 256 |
--- a/2.txt Thu Jan 01 00:00:00 1970 +0000 |
| 257 |
+++ b/2.txt Thu Jan 01 00:00:00 1970 +0000 |
| 258 |
@@ -1,5 +1,5 @@ |
| 259 |
a |
| 260 |
-b |
| 261 |
+b b |
| 262 |
c |
| 263 |
d |
| 264 |
e |
| 265 |
|
| 266 |
After partial qrefresh 'diff' |
| 267 |
|
| 268 |
$ hg diff --nodates |
| 269 |
diff -r 0738af1a8211 1.txt |
| 270 |
--- a/1.txt |
| 271 |
+++ b/1.txt |
| 272 |
@@ -1,5 +1,5 @@ |
| 273 |
1 |
| 274 |
2 2 |
| 275 |
3 |
| 276 |
-4 |
| 277 |
+4 4 |
| 278 |
5 |
| 279 |
diff -r 0738af1a8211 dir/a.txt |
| 280 |
--- a/dir/a.txt |
| 281 |
+++ b/dir/a.txt |
| 282 |
@@ -1,4 +1,4 @@ |
| 283 |
-hello world |
| 284 |
+hello world! |
| 285 |
|
| 286 |
someone |
| 287 |
up |
| 288 |
|
| 289 |
qrefresh interactively everything else |
| 290 |
|
| 291 |
$ hg qrefresh -i -d '0 0' <<EOF |
| 292 |
> y |
| 293 |
> y |
| 294 |
> y |
| 295 |
> y |
| 296 |
> EOF |
| 297 |
diff --git a/1.txt b/1.txt |
| 298 |
1 hunks, 1 lines changed |
| 299 |
examine changes to '1.txt'? |
| 300 |
(enter ? for help) [Ynesfdaq?] y |
| 301 |
|
| 302 |
@@ -1,5 +1,5 @@ |
| 303 |
1 |
| 304 |
2 2 |
| 305 |
3 |
| 306 |
-4 |
| 307 |
+4 4 |
| 308 |
5 |
| 309 |
record change 1/2 to '1.txt'? |
| 310 |
(enter ? for help) [Ynesfdaq?] y |
| 311 |
|
| 312 |
diff --git a/dir/a.txt b/dir/a.txt |
| 313 |
1 hunks, 1 lines changed |
| 314 |
examine changes to 'dir/a.txt'? |
| 315 |
(enter ? for help) [Ynesfdaq?] y |
| 316 |
|
| 317 |
@@ -1,4 +1,4 @@ |
| 318 |
-hello world |
| 319 |
+hello world! |
| 320 |
|
| 321 |
someone |
| 322 |
up |
| 323 |
record change 2/2 to 'dir/a.txt'? |
| 324 |
(enter ? for help) [Ynesfdaq?] y |
| 325 |
|
| 326 |
|
| 327 |
After final qrefresh 'tip' |
| 328 |
|
| 329 |
$ hg tip -p |
| 330 |
changeset: 1:2c3f66afeed9 |
| 331 |
tag: patch |
| 332 |
tag: qbase |
| 333 |
tag: qtip |
| 334 |
tag: tip |
| 335 |
user: test |
| 336 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 337 |
summary: [mq]: patch |
| 338 |
|
| 339 |
diff -r 1fd39ab63a33 -r 2c3f66afeed9 1.txt |
| 340 |
--- a/1.txt Thu Jan 01 00:00:00 1970 +0000 |
| 341 |
+++ b/1.txt Thu Jan 01 00:00:00 1970 +0000 |
| 342 |
@@ -1,5 +1,5 @@ |
| 343 |
1 |
| 344 |
-2 |
| 345 |
+2 2 |
| 346 |
3 |
| 347 |
-4 |
| 348 |
+4 4 |
| 349 |
5 |
| 350 |
diff -r 1fd39ab63a33 -r 2c3f66afeed9 2.txt |
| 351 |
--- a/2.txt Thu Jan 01 00:00:00 1970 +0000 |
| 352 |
+++ b/2.txt Thu Jan 01 00:00:00 1970 +0000 |
| 353 |
@@ -1,5 +1,5 @@ |
| 354 |
a |
| 355 |
-b |
| 356 |
+b b |
| 357 |
c |
| 358 |
d |
| 359 |
e |
| 360 |
diff -r 1fd39ab63a33 -r 2c3f66afeed9 dir/a.txt |
| 361 |
--- a/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 |
| 362 |
+++ b/dir/a.txt Thu Jan 01 00:00:00 1970 +0000 |
| 363 |
@@ -1,4 +1,4 @@ |
| 364 |
-hello world |
| 365 |
+hello world! |
| 366 |
|
| 367 |
someone |
| 368 |
up |
| 369 |
|
| 370 |
|
| 371 |
After qrefresh 'diff' |
| 372 |
|
| 373 |
$ hg diff --nodates |
| 374 |
|
| 375 |
$ cd .. |