diff options
Diffstat (limited to 'Documentation/BK-usage/cset-to-linus')
-rwxr-xr-x | Documentation/BK-usage/cset-to-linus | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Documentation/BK-usage/cset-to-linus b/Documentation/BK-usage/cset-to-linus new file mode 100755 index 000000000000..d28a96f8c618 --- /dev/null +++ b/Documentation/BK-usage/cset-to-linus | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | |||
3 | use strict; | ||
4 | |||
5 | my ($lhs, $rev, $tmp, $rhs, $s); | ||
6 | my @cset_text = (); | ||
7 | my @pipe_text = (); | ||
8 | my $have_cset = 0; | ||
9 | |||
10 | while (<>) { | ||
11 | next if /^---/; | ||
12 | |||
13 | if (($lhs, $tmp, $rhs) = (/^(ChangeSet\@)([^,]+)(, .*)$/)) { | ||
14 | &cset_rev if ($have_cset); | ||
15 | |||
16 | $rev = $tmp; | ||
17 | $have_cset = 1; | ||
18 | |||
19 | push(@cset_text, $_); | ||
20 | } | ||
21 | |||
22 | elsif ($have_cset) { | ||
23 | push(@cset_text, $_); | ||
24 | } | ||
25 | } | ||
26 | &cset_rev if ($have_cset); | ||
27 | exit(0); | ||
28 | |||
29 | |||
30 | sub cset_rev { | ||
31 | my $empty_cset = 0; | ||
32 | |||
33 | open PIPE, "bk export -tpatch -hdu -r $rev | diffstat -p1 2>/dev/null |" or die; | ||
34 | while ($s = <PIPE>) { | ||
35 | $empty_cset = 1 if ($s =~ /0 files changed/); | ||
36 | push(@pipe_text, $s); | ||
37 | } | ||
38 | close(PIPE); | ||
39 | |||
40 | if (! $empty_cset) { | ||
41 | print @cset_text; | ||
42 | print @pipe_text; | ||
43 | print "\n\n"; | ||
44 | } | ||
45 | |||
46 | @pipe_text = (); | ||
47 | @cset_text = (); | ||
48 | } | ||
49 | |||