|
10 | 10 | die "GIT_DIR is not defined or is unreadable"; |
11 | 11 | } |
12 | 12 |
|
13 | | -our ($opt_h, $opt_p, $opt_v, $opt_c ); |
| 13 | +our ($opt_h, $opt_p, $opt_v, $opt_c, $opt_f, $opt_m ); |
14 | 14 |
|
15 | | -getopts('hpvc'); |
| 15 | +getopts('hpvcfm:'); |
16 | 16 |
|
17 | 17 | $opt_h && usage(); |
18 | 18 |
|
|
77 | 77 | $opt_v && print "Applying to CVS commit $commit from parent $parent\n"; |
78 | 78 |
|
79 | 79 | # grab the commit message |
80 | | -`git-cat-file commit $commit | sed -e '1,/^\$/d' > .msg`; |
| 80 | +open(MSG, ">.msg") or die "Cannot open .msg for writing"; |
| 81 | +print MSG $opt_m; |
| 82 | +close MSG; |
| 83 | + |
| 84 | +`git-cat-file commit $commit | sed -e '1,/^\$/d' >> .msg`; |
81 | 85 | $? && die "Error extracting the commit message"; |
82 | 86 |
|
83 | 87 | my (@afiles, @dfiles, @mfiles); |
84 | 88 | my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit); |
85 | | -print @files; |
| 89 | +#print @files; |
86 | 90 | $? && die "Error in git-diff-tree"; |
87 | 91 | foreach my $f (@files) { |
88 | 92 | chomp $f; |
|
109 | 113 | if (@status > 1) { warn 'Strange! cvs status returned more than one line?'}; |
110 | 114 | unless ($status[0] =~ m/Status: Unknown$/) { |
111 | 115 | $dirty = 1; |
112 | | - warn "File $f is already known in your CVS checkout!\n"; |
| 116 | + warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n"; |
113 | 117 | } |
114 | 118 | } |
115 | 119 | foreach my $f (@mfiles, @dfiles) { |
|
122 | 126 | } |
123 | 127 | } |
124 | 128 | if ($dirty) { |
125 | | - die "Exiting: your CVS tree is not clean for this merge."; |
| 129 | + if ($opt_f) { warn "The tree is not clean -- forced merge\n"; |
| 130 | + $dirty = 0; |
| 131 | + } else { |
| 132 | + die "Exiting: your CVS tree is not clean for this merge."; |
| 133 | + } |
126 | 134 | } |
127 | 135 |
|
128 | 136 | ### |
|
215 | 223 | } |
216 | 224 | sub usage { |
217 | 225 | print STDERR <<END; |
218 | | -Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [ parent ] commit |
| 226 | +Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-m msgprefix] [ parent ] commit |
219 | 227 | END |
220 | 228 | exit(1); |
221 | 229 | } |
|
0 commit comments