Skip to content

Commit

Permalink
Merge branch 'ml/cvs'
Browse files Browse the repository at this point in the history
* ml/cvs:
  Change to allow subdir updates from Eclipse
  Many fixes for most operations in Eclipse.
  Added logged warnings for CVS error returns
  cvsserver: use git-rev-list instead of git-log
  git-cvsexportcommit: Add -f(orce) and -m(essage prefix) flags, small cleanups.
  • Loading branch information
Junio C Hamano committed May 14, 2006
2 parents 3a3e89b + 5c222ce commit 5f7f211
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 97 deletions.
9 changes: 8 additions & 1 deletion Documentation/git-cvsexportcommit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git-cvsexportcommit - Export a commit to a CVS checkout

SYNOPSIS
--------
'git-cvsexportcommmit' [-h] [-v] [-c] [-p] [PARENTCOMMIT] COMMITID
'git-cvsexportcommmit' [-h] [-v] [-c] [-p] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID


DESCRIPTION
Expand Down Expand Up @@ -39,6 +39,13 @@ OPTIONS
Be pedantic (paranoid) when applying patches. Invokes patch with
--fuzz=0

-f::
Force the merge even if the files are not up to date.

-m::
Prepend the commit message with the provided prefix.
Useful for patch series and the like.

-v::
Verbose.

Expand Down
22 changes: 15 additions & 7 deletions git-cvsexportcommit.perl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
die "GIT_DIR is not defined or is unreadable";
}

our ($opt_h, $opt_p, $opt_v, $opt_c );
our ($opt_h, $opt_p, $opt_v, $opt_c, $opt_f, $opt_m );

getopts('hpvc');
getopts('hpvcfm:');

$opt_h && usage();

Expand Down Expand Up @@ -77,12 +77,16 @@
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";

# grab the commit message
`git-cat-file commit $commit | sed -e '1,/^\$/d' > .msg`;
open(MSG, ">.msg") or die "Cannot open .msg for writing";
print MSG $opt_m;
close MSG;

`git-cat-file commit $commit | sed -e '1,/^\$/d' >> .msg`;
$? && die "Error extracting the commit message";

my (@afiles, @dfiles, @mfiles);
my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
print @files;
#print @files;
$? && die "Error in git-diff-tree";
foreach my $f (@files) {
chomp $f;
Expand All @@ -109,7 +113,7 @@
if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
unless ($status[0] =~ m/Status: Unknown$/) {
$dirty = 1;
warn "File $f is already known in your CVS checkout!\n";
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";
}
}
foreach my $f (@mfiles, @dfiles) {
Expand All @@ -122,7 +126,11 @@
}
}
if ($dirty) {
die "Exiting: your CVS tree is not clean for this merge.";
if ($opt_f) { warn "The tree is not clean -- forced merge\n";
$dirty = 0;
} else {
die "Exiting: your CVS tree is not clean for this merge.";
}
}

###
Expand Down Expand Up @@ -215,7 +223,7 @@
}
sub usage {
print STDERR <<END;
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [ parent ] commit
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-m msgprefix] [ parent ] commit
END
exit(1);
}
Expand Down
Loading

0 comments on commit 5f7f211

Please sign in to comment.