From 351c723507e174a4c260fc536e7717219eb9105d Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 19 Apr 2011 06:00:17 +0200 Subject: [PATCH 1/2] [commit-patch] Add support for monotone --- commit-patch | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commit-patch b/commit-patch index 25ed6f7..79bd581 100755 --- a/commit-patch +++ b/commit-patch @@ -110,6 +110,16 @@ while (!$vc{name}) { $vc{message_file} = sub { ('-F', $_[0]) }; $vc{previous_message} = sub { my $prev; run([qw(git log -1 --pretty=format:%s%n%b)], '>', \$prev); $prev }; # Git is special cased below. + } elsif (-d "$repo/_MTN") { + $vc{name} = 'mtn'; + $vc{diff} = 'mtn diff'; + $vc{commit} = 'mtn commit'; + $vc{message} = sub { ('-m', $_[0]) }; + $vc{message_file} = sub { ('--message-file', $_[0]) }; + $vc{add} = 'mtn add'; + $vc{remove} = 'mtn drop'; + $vc{patcharg} = '-p0'; + $vc{lsdiffarg} = []; } else { $repo.="/.."; printf("Trying back a dir: $repo, abs:%s\n", abs_path($repo)); -- 2.51.2 From 02fa79ac37ed5d4c19f5fc86dab3a075900af33a Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 19 Apr 2011 09:31:12 +0200 Subject: [PATCH 2/2] [commit-patch] Avoid running 'interdiff' and 'patch -R' also when the working patch is just a series of comment lines. 'mtn diff' will output three comment lines when there are no changes. patch ignores them, so should we. --- commit-patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit-patch b/commit-patch index 79bd581..ac490bf 100755 --- a/commit-patch +++ b/commit-patch @@ -234,7 +234,7 @@ $SIG{PIPE} = $SIG{INT} = $SIG{QUIT} = sub { print "Cleanly aborting..\n"; }; my ($out, $working_patch, $non_committed_patch); run([split(/ /,$vc{diff}), @changed, @removed], '>', \$working_patch, '2>', \$err);# CVS diff dies. Sigh. or die "$err\n"; -unless ($working_patch =~ /^\s*$/s) { +unless ($working_patch =~ /^(#[^\n]*|\s)*$/s) { run(["interdiff", $vc{patcharg}, $patch, '-'], '<', \$working_patch, '>', \$non_committed_patch, '2>', \$err) or die "$err\n"; run(["patch", $vc{patcharg}, "-R"], '<', \$working_patch, '>', \$out, '2>', \$err) or die "$out\n$err\n"; -- 2.51.2