mq: add --currentdate and --date options to qnew and qrefresh
These options make qnew add and qrefresh update a "# Date "-style
header line. This allows proper recording of creation / last
modification dates of patches in patch queues.
Note that `qrefresh -D` only updates existing header lines. It never
adds them, and does not warn about this. This is because I expect
people to have `[default] qrefresh -D` in their .hgrc so patches with
tracked dates get updated, others are left unchanged. The suggested
setup in .hgrc is, in fact,
[default]
qnew = -D -U
qrefresh = -D
I tried to not mix header styles, so `qnew -D -U` now writes the user in
"# User "-style, while `qnew -U` still writes it "From: "-style. Also, if
`qrefresh -U` must add the user, it does so in "# User "-style if the
header contains a "# HG changeset patch" line. (This is caused by mq
not supporting the "Date: "-style header line at all - a reasonable choice
given its standard date format.)
==== init
==== qnew -d
# HG changeset patch
# Date 3 0
0: [mq]: 1.patch - test - 3.00
==== qref
adding 1
# HG changeset patch
# Date 3 0
diff -r ... 1
--- /dev/null
+++ b/1
@@ -0,0 +1,1 @@
+1
0: [mq]: 1.patch - test - 3.00
==== qref -d
# HG changeset patch
# Date 4 0
diff -r ... 1
--- /dev/null
+++ b/1
@@ -0,0 +1,1 @@
+1
0: [mq]: 1.patch - test - 4.00
==== qnew
adding 2
diff -r ... 2
--- /dev/null
+++ b/2
@@ -0,0 +1,1 @@
+2
1: [mq]: 2.patch - test
0: [mq]: 1.patch - test
==== qref -d
diff -r ... 2
--- /dev/null
+++ b/2
@@ -0,0 +1,1 @@
+2
1: [mq]: 2.patch - test
0: [mq]: 1.patch - test
Now at: 1.patch
==== qnew -d -m
# HG changeset patch
# Date 6 0
Three
1: Three - test - 6.00
0: [mq]: 1.patch - test - 4.00
==== qref
adding 3
# HG changeset patch
# Date 6 0
Three
diff -r ... 3
--- /dev/null
+++ b/3
@@ -0,0 +1,1 @@
+3
1: Three - test - 6.00
0: [mq]: 1.patch - test - 4.00
==== qref -m
# HG changeset patch
# Date 6 0
Drei
diff -r ... 3
--- /dev/null
+++ b/3
@@ -0,0 +1,1 @@
+3
1: Drei - test - 6.00
0: [mq]: 1.patch - test - 4.00
==== qref -d
# HG changeset patch
# Date 7 0
Drei
diff -r ... 3
--- /dev/null
+++ b/3
@@ -0,0 +1,1 @@
+3
1: Drei - test - 7.00
0: [mq]: 1.patch - test - 4.00
==== qref -d -m
# HG changeset patch
# Date 8 0
Three (again)
diff -r ... 3
--- /dev/null
+++ b/3
@@ -0,0 +1,1 @@
+3
1: Three (again) - test - 8.00
0: [mq]: 1.patch - test - 4.00
==== qnew -m
adding 4
Four
diff -r ... 4
--- /dev/null
+++ b/4
@@ -0,0 +1,1 @@
+4
2: Four - test
1: Three (again) - test
0: [mq]: 1.patch - test
==== qref -d
Four
diff -r ... 4
--- /dev/null
+++ b/4
@@ -0,0 +1,1 @@
+4
2: Four - test
1: Three (again) - test
0: [mq]: 1.patch - test
Now at: 3.patch
==== qnew with HG header
Now at: 3.patch
applying 5.patch
patch failed, unable to continue (try -v)
patch 5.patch is empty
Now at: 5.patch
# HG changeset patch
# Date 10 0
2: imported patch 5.patch - test - 10.00
1: Three (again) - test - 8.00
0: [mq]: 1.patch - test - 4.00
==== hg qref
adding 5
# HG changeset patch
# Date 10 0
diff -r ... 5
--- /dev/null
+++ b/5
@@ -0,0 +1,1 @@
+5
2: [mq]: 5.patch - test - 10.00
1: Three (again) - test - 8.00
0: [mq]: 1.patch - test - 4.00
==== hg qref -d
# HG changeset patch
# Date 11 0
diff -r ... 5
--- /dev/null
+++ b/5
@@ -0,0 +1,1 @@
+5
2: [mq]: 5.patch - test - 11.00
1: Three (again) - test - 8.00
0: [mq]: 1.patch - test - 4.00
==== qnew -u
adding 6
From: jane
diff -r ... 6
--- /dev/null
+++ b/6
@@ -0,0 +1,1 @@
+6
3: [mq]: 6.patch - jane
2: [mq]: 5.patch - test
1: Three (again) - test
0: [mq]: 1.patch - test
==== qref -d
From: jane
diff -r ... 6
--- /dev/null
+++ b/6
@@ -0,0 +1,1 @@
+6
3: [mq]: 6.patch - jane
2: [mq]: 5.patch - test
1: Three (again) - test
0: [mq]: 1.patch - test
Now at: 5.patch
==== qnew -d
adding 7
# HG changeset patch
# Date 13 0
diff -r ... 7
--- /dev/null
+++ b/7
@@ -0,0 +1,1 @@
+7
3: [mq]: 7.patch - test
2: [mq]: 5.patch - test
1: Three (again) - test
0: [mq]: 1.patch - test
==== qref -u
# HG changeset patch
# User john
# Date 13 0
diff -r ... 7
--- /dev/null
+++ b/7
@@ -0,0 +1,1 @@
+7
3: [mq]: 7.patch - john - 13.00
2: [mq]: 5.patch - test - 11.00
1: Three (again) - test - 8.00
0: [mq]: 1.patch - test - 4.00
==== qnew
adding 8
diff -r ... 8
--- /dev/null
+++ b/8
@@ -0,0 +1,1 @@
+8
4: [mq]: 8.patch - test
3: [mq]: 7.patch - john
2: [mq]: 5.patch - test
1: Three (again) - test
0: [mq]: 1.patch - test
==== qref -u -d
From: john
diff -r ... 8
--- /dev/null
+++ b/8
@@ -0,0 +1,1 @@
+8
4: [mq]: 8.patch - john
3: [mq]: 7.patch - john
2: [mq]: 5.patch - test
1: Three (again) - test
0: [mq]: 1.patch - test
Now at: 7.patch
==== qnew -m
adding 9
Nine
diff -r ... 9
--- /dev/null
+++ b/9
@@ -0,0 +1,1 @@
+9
4: Nine - test
3: [mq]: 7.patch - john
2: [mq]: 5.patch - test
1: Three (again) - test
0: [mq]: 1.patch - test
==== qref -u -d
From: john
Nine
diff -r ... 9
--- /dev/null
+++ b/9
@@ -0,0 +1,1 @@
+9
4: Nine - john
3: [mq]: 7.patch - john
2: [mq]: 5.patch - test
1: Three (again) - test
0: [mq]: 1.patch - test
Now at: 7.patch
==== qpop -a / qpush -a
Patch queue now empty
applying 1.patch
applying 3.patch
applying 5.patch
applying 7.patch
Now at: 7.patch
3: imported patch 7.patch - john - 13.00
2: imported patch 5.patch - test - 11.00
1: Three (again) - test - 8.00
0: imported patch 1.patch - test - 4.00