##// END OF EJS Templates
patchbomb: --desc implies --intro...
Cédric Duval -
r10734:7a0502a6 default
parent child Browse files
Show More
@@ -105,6 +105,10 b' def cdiffstat(ui, summary, patchlines):'
105 105 raise util.Abort(_('diffstat rejected'))
106 106 return s
107 107
108 def introneeded(opts, number):
109 '''is an introductory message required?'''
110 return number > 1 or opts.get('intro') or opts.get('desc')
111
108 112 def makepatch(ui, repo, patch, opts, _charsets, idx, total, patchname=None):
109 113
110 114 desc = []
@@ -170,7 +174,7 b' def makepatch(ui, repo, patch, opts, _ch'
170 174 flag = ' ' + flag
171 175
172 176 subj = desc[0].strip().rstrip('. ')
173 if total == 1 and not opts.get('intro'):
177 if not introneeded(opts, total):
174 178 subj = '[PATCH%s] %s' % (flag, opts.get('subject') or subj)
175 179 else:
176 180 tlen = len(str(total))
@@ -329,7 +333,7 b' def patchbomb(ui, repo, *revs, **opts):'
329 333 len(patches), name)
330 334 msgs.append(msg)
331 335
332 if len(patches) > 1 or opts.get('intro'):
336 if introneeded(opts, len(patches)):
333 337 tlen = len(str(len(patches)))
334 338
335 339 flag = ' '.join(opts.get('flag'))
@@ -126,6 +126,11 b' echo "% test intro for single patch"'
126 126 hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test \
127 127 -r 2 | fixheaders
128 128
129 echo "% test --desc without --intro for a single patch"
130 echo foo > intro.text
131 hg email --date '1970-1-1 0:1' -n --desc intro.text -f quux -t foo -c bar \
132 -s test -r 2 | fixheaders
133
129 134 echo "% test intro for multiple patches"
130 135 hg email --date '1970-1-1 0:1' -n --intro -f quux -t foo -c bar -s test \
131 136 -r 0:1 | fixheaders
@@ -940,6 +940,52 b' diff -r 97d72e5f12c7 -r ff2c9fa2018b c'
940 940 @@ -0,0 +1,1 @@
941 941 +c
942 942
943 % test --desc without --intro for a single patch
944 This patch series consists of 1 patches.
945
946
947 Displaying [PATCH 0 of 1] test ...
948 Content-Type: text/plain; charset="us-ascii"
949 MIME-Version: 1.0
950 Content-Transfer-Encoding: 7bit
951 Subject: [PATCH 0 of 1] test
952 Message-Id: <patchbomb.60@
953 User-Agent: Mercurial-patchbomb
954 Date: Thu, 01 Jan 1970 00:01:00 +0000
955 From: quux
956 To: foo
957 Cc: bar
958
959 foo
960
961 Displaying [PATCH 1 of 1] c ...
962 Content-Type: text/plain; charset="us-ascii"
963 MIME-Version: 1.0
964 Content-Transfer-Encoding: 7bit
965 Subject: [PATCH 1 of 1] c
966 X-Mercurial-Node: ff2c9fa2018b15fa74b33363bda9527323e2a99f
967 Message-Id: <ff2c9fa2018b15fa74b3.61@
968 In-Reply-To: <patchbomb.60@
969 References: <patchbomb.60@
970 User-Agent: Mercurial-patchbomb
971 Date: Thu, 01 Jan 1970 00:01:01 +0000
972 From: quux
973 To: foo
974 Cc: bar
975
976 # HG changeset patch
977 # User test
978 # Date 3 0
979 # Node ID ff2c9fa2018b15fa74b33363bda9527323e2a99f
980 # Parent 97d72e5f12c7e84f85064aa72e5a297142c36ed9
981 c
982
983 diff -r 97d72e5f12c7 -r ff2c9fa2018b c
984 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
985 +++ b/c Thu Jan 01 00:00:03 1970 +0000
986 @@ -0,0 +1,1 @@
987 +c
988
943 989 % test intro for multiple patches
944 990 This patch series consists of 2 patches.
945 991
General Comments 0
You need to be logged in to leave comments. Login now