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 @@ -311,6 +311,40 @@ split_patches () {
311311 this=
312312 msgnum=
313313 ;;
314+ hg)
315+ this=0
316+ for hg in " $@ "
317+ do
318+ this=$(( $this + 1 ))
319+ msgnum=$( printf " %0${prec} d" $this )
320+ # hg stores changeset metadata in #-commented lines preceding
321+ # the commit message and diff(s). The only metadata we care about
322+ # are the User and Date (Node ID and Parent are hashes which are
323+ # only relevant to the hg repository and thus not useful to us)
324+ # Since we cannot guarantee that the commit message is in
325+ # git-friendly format, we put no Subject: line and just consume
326+ # all of the message as the body
327+ perl -M' POSIX qw(strftime)' -ne ' BEGIN { $subject = 0 }
328+ if ($subject) { print ; }
329+ elsif (/^\# User /) { s/\# User/From:/ ; print ; }
330+ elsif (/^\# Date /) {
331+ my ($hashsign, $str, $time, $tz) = split ;
332+ $tz = sprintf "%+05d", (0-$tz)/36;
333+ print "Date: " .
334+ strftime("%a, %d %b %Y %H:%M:%S ",
335+ localtime($time))
336+ . "$tz\n";
337+ } elsif (/^\# /) { next ; }
338+ else {
339+ print "\n", $_ ;
340+ $subject = 1;
341+ }
342+ ' < " $hg " > " $dotest /$msgnum " || clean_abort
343+ done
344+ echo " $this " > " $dotest /last"
345+ this=
346+ msgnum=
347+ ;;
314348 * )
315349 if test -n " $patch_format "
316350 then
You can’t perform that action at this time.
0 commit comments