topic: slight code shuffling for readability

Junio C Hamano committed Dec 7, 2007 at 01:10 UTC 8f92733251b86d3dc476589f98659f10de8da2a7
1 file changed +28 -19
git-topic.perl
+28 -19
@@ -77,9 +77,10 @@ sub rebase_marker {
77
78 sub describe_topic {
79 my ($topic) = @_;
80 +
81 open(CONF, '-|', qw(git repo-config --get),
81 - "branch.$topic.description")
82 - or die;
82 + "branch.$topic.description")
83 + or die;
84 my $it = join('',<CONF>);
85 close(CONF);
86 chomp($it);
@@ -88,29 +89,26 @@ sub describe_topic {
89 }
90 }
91
91 -sub wrap_print {
92 - my ($string) = @_;
93 - format STDOUT =
94 -~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
95 - $string
96 - ~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
97 - $string
98 -.
99 - write;
100 -}
92 +my @in_next = read_revs_short('^master', $stage[0]);
93
94 open(TOPIC, '-|', qw(git for-each-ref),
103 - '--sort=-authordate',
104 - '--format=%(objectname) %(authordate) %(refname)',
105 - "refs/heads/$topic_pattern")
106 - or die;
107 -
108 -my @in_next = read_revs_short('^master', $stage[0]);
95 + '--sort=-authordate',
96 + '--format=%(objectname) %(authordate) %(refname)',
97 + "refs/heads/$topic_pattern")
98 + or die;
99
100 +my @topic = ();
101 while (<TOPIC>) {
102 chomp;
103 my ($sha1, $date, $topic) = m|^([0-9a-f]{40})\s(.*?)\srefs/heads/(.+)$|
113 - or next;
104 + or next;
105 + push @topic, [$sha1, $date, $topic];
106 +}
107 +
108 +my @last_merge_to_next = ();
109 +
110 +for (@topic) {
111 + my ($sha1, $date, $topic) = @$_;
112 my @revs = read_revs($base, $sha1, (1<<@stage)-1);
113 next unless (@revs || $all);
114
@@ -141,3 +139,14 @@ while (<TOPIC>) {
139 wrap_print("$mark $item->[1]");
140 }
141 }
142 +
143 +sub wrap_print {
144 + my ($string) = @_;
145 + format STDOUT =
146 +~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
147 + $string
148 + ~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
149 + $string
150 +.
151 + write;
152 +}