File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,40 @@ split_patches () {
248
248
this=
249
249
msgnum=
250
250
;;
251
+ hg)
252
+ this=0
253
+ for hg in " $@ "
254
+ do
255
+ this=$(( $this + 1 ))
256
+ msgnum=$( printf " %0${prec} d" $this )
257
+ # hg stores changeset metadata in #-commented lines preceding
258
+ # the commit message and diff(s). The only metadata we care about
259
+ # are the User and Date (Node ID and Parent are hashes which are
260
+ # only relevant to the hg repository and thus not useful to us)
261
+ # Since we cannot guarantee that the commit message is in
262
+ # git-friendly format, we put no Subject: line and just consume
263
+ # all of the message as the body
264
+ perl -M' POSIX qw(strftime)' -ne ' BEGIN { $subject = 0 }
265
+ if ($subject) { print ; }
266
+ elsif (/^\# User /) { s/\# User/From:/ ; print ; }
267
+ elsif (/^\# Date /) {
268
+ my ($hashsign, $str, $time, $tz) = split ;
269
+ $tz = sprintf "%+05d", (0-$tz)/36;
270
+ print "Date: " .
271
+ strftime("%a, %d %b %Y %H:%M:%S ",
272
+ localtime($time))
273
+ . "$tz\n";
274
+ } elsif (/^\# /) { next ; }
275
+ else {
276
+ print "\n", $_ ;
277
+ $subject = 1;
278
+ }
279
+ ' < " $hg " > " $dotest /$msgnum " || clean_abort
280
+ done
281
+ echo " $this " > " $dotest /last"
282
+ this=
283
+ msgnum=
284
+ ;;
251
285
* )
252
286
echo " Patch format $patch_format is not supported."
253
287
exit 1
You can’t perform that action at this time.
0 commit comments