mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
mq: correctly make an empty line after description in new patches
There would in some cases be an empty line between headers and the description - that does not seem right. There should also be an empty line between description and diff - but that was missing. These two mistakes would sometimes make it up for each other so we fix both at once to just show the improvement. Instead of writing an extra newline when writing a header line, write an extra line when it not is written as a part of the description but is necessary anyway.
This commit is contained in:
parent
51a0933f38
commit
8c41a3576b
@ -1073,10 +1073,8 @@ class queue(object):
|
||||
if self.plainmode:
|
||||
if user:
|
||||
p.write("From: " + user + "\n")
|
||||
if not date:
|
||||
p.write("\n")
|
||||
if date:
|
||||
p.write("Date: %d %d\n\n" % date)
|
||||
p.write("Date: %d %d\n" % date)
|
||||
else:
|
||||
p.write("# HG changeset patch\n")
|
||||
p.write("# Parent "
|
||||
@ -1084,7 +1082,7 @@ class queue(object):
|
||||
if user:
|
||||
p.write("# User " + user + "\n")
|
||||
if date:
|
||||
p.write("# Date %s %s\n\n" % date)
|
||||
p.write("# Date %s %s\n" % date)
|
||||
|
||||
defaultmsg = "[mq]: %s" % patchfn
|
||||
editor = cmdutil.getcommiteditor(editform=editform)
|
||||
@ -1117,6 +1115,8 @@ class queue(object):
|
||||
if nctx.description() != defaultmsg.rstrip():
|
||||
msg = nctx.description() + "\n\n"
|
||||
p.write(msg)
|
||||
elif not self.plainmode or date or user:
|
||||
p.write('\n')
|
||||
if commitfiles:
|
||||
parent = self.qparents(repo, n)
|
||||
if inclsubs:
|
||||
|
@ -243,7 +243,6 @@
|
||||
now at: 1.patch
|
||||
==== qnew -d -m
|
||||
Date: 6 0
|
||||
|
||||
Three
|
||||
|
||||
1: Three - test - 6.00
|
||||
@ -251,7 +250,6 @@
|
||||
==== qref
|
||||
adding 3
|
||||
Date: 6 0
|
||||
|
||||
Three
|
||||
|
||||
diff -r ... 3
|
||||
@ -263,7 +261,6 @@
|
||||
0: [mq]: 1.patch - test - 4.00
|
||||
==== qref -m
|
||||
Date: 6 0
|
||||
|
||||
Drei
|
||||
|
||||
diff -r ... 3
|
||||
@ -275,7 +272,6 @@
|
||||
0: [mq]: 1.patch - test - 4.00
|
||||
==== qref -d
|
||||
Date: 7 0
|
||||
|
||||
Drei
|
||||
|
||||
diff -r ... 3
|
||||
@ -287,7 +283,6 @@
|
||||
0: [mq]: 1.patch - test - 4.00
|
||||
==== qref -d -m
|
||||
Date: 8 0
|
||||
|
||||
Three (again)
|
||||
|
||||
diff -r ... 3
|
||||
@ -590,7 +585,6 @@
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# Date 6 0
|
||||
|
||||
Three
|
||||
|
||||
1: Three - test - 6.00
|
||||
@ -600,7 +594,6 @@
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# Date 6 0
|
||||
|
||||
Three
|
||||
|
||||
diff -r ... 3
|
||||
@ -614,7 +607,6 @@
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# Date 6 0
|
||||
|
||||
Drei
|
||||
|
||||
diff -r ... 3
|
||||
@ -628,7 +620,6 @@
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# Date 7 0
|
||||
|
||||
Drei
|
||||
|
||||
diff -r ... 3
|
||||
@ -642,7 +633,6 @@
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# Date 8 0
|
||||
|
||||
Three (again)
|
||||
|
||||
diff -r ... 3
|
||||
|
@ -176,7 +176,6 @@
|
||||
0: [mq]: 1.patch - mary
|
||||
==== qnew -U -m
|
||||
From: test
|
||||
|
||||
Three
|
||||
|
||||
2: Three - test
|
||||
@ -185,7 +184,6 @@
|
||||
==== qref
|
||||
adding 3
|
||||
From: test
|
||||
|
||||
Three
|
||||
|
||||
diff -r ... 3
|
||||
@ -198,7 +196,6 @@
|
||||
0: [mq]: 1.patch - mary
|
||||
==== qref -m
|
||||
From: test
|
||||
|
||||
Drei
|
||||
|
||||
diff -r ... 3
|
||||
@ -211,7 +208,6 @@
|
||||
0: [mq]: 1.patch - mary
|
||||
==== qref -u
|
||||
From: mary
|
||||
|
||||
Drei
|
||||
|
||||
diff -r ... 3
|
||||
@ -224,7 +220,6 @@
|
||||
0: [mq]: 1.patch - mary
|
||||
==== qref -u -m
|
||||
From: maria
|
||||
|
||||
Three (again)
|
||||
|
||||
diff -r ... 3
|
||||
@ -406,6 +401,7 @@
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# User test
|
||||
|
||||
0: [mq]: 1.patch - test
|
||||
==== qref
|
||||
adding 1
|
||||
@ -690,6 +686,7 @@
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# User test
|
||||
|
||||
0: [mq]: 1.patch - test
|
||||
==== qref
|
||||
adding 1
|
||||
|
@ -209,6 +209,7 @@ hg headers
|
||||
M d/b
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
|
||||
diff --git a/d/b b/d/b
|
||||
--- a/d/b
|
||||
+++ b/d/b
|
||||
@ -219,10 +220,12 @@ hg headers
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# User blue
|
||||
|
||||
% qnew -e -u with no username configured
|
||||
# HG changeset patch
|
||||
# Parent
|
||||
# User chartreuse
|
||||
|
||||
% fail when trying to import a merge
|
||||
adding a
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
@ -337,6 +340,7 @@ Test handling default message with the patch filename with tail whitespaces
|
||||
$ cat ".hg/patches/patch "
|
||||
# HG changeset patch
|
||||
# Parent 0000000000000000000000000000000000000000
|
||||
|
||||
|
||||
$ cd ..
|
||||
|
||||
|
@ -508,6 +508,7 @@ but only after writing the bad name into the patch.
|
||||
$ cat .hg/patches/a
|
||||
# HG changeset patch
|
||||
# Parent 0000000000000000000000000000000000000000
|
||||
|
||||
diff --git a/a b/a
|
||||
new file mode 100644
|
||||
$ hg qpush
|
||||
@ -522,6 +523,7 @@ but only after writing the bad name into the patch.
|
||||
$ cat .hg/patches/a
|
||||
# HG changeset patch
|
||||
# Parent 0000000000000000000000000000000000000000
|
||||
|
||||
diff --git a/a b/a
|
||||
new file mode 100644
|
||||
$ cd ..
|
||||
|
Loading…
Reference in New Issue
Block a user