aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2007-06-08 15:41:02 +0200
committerSimon Josefsson <simon@josefsson.org>2007-06-08 15:41:02 +0200
commit23dc43674ca0bed8e8e0b809e187349d3857d222 (patch)
treeab42319dda3c7e83dbffca5a3587452ad22b20f3
parent24a0ff7f7e60203d8515345fd2ae43097466b806 (diff)
downloadgit2cl-23dc43674ca0bed8e8e0b809e187349d3857d222.zip
git2cl-23dc43674ca0bed8e8e0b809e187349d3857d222.tar.gz
git2cl-23dc43674ca0bed8e8e0b809e187349d3857d222.tar.bz2
Handle merges. Handle binary files ('-' in added/deleted columns).
-rwxr-xr-xgit2cl17
1 files changed, 15 insertions, 2 deletions
diff --git a/git2cl b/git2cl
index a6d0f68..aa1e8c1 100755
--- a/git2cl
+++ b/git2cl
@@ -227,6 +227,7 @@ my @date;
my $author;
my @files;
my $comment;
+my $merge;
my $state; # 0-header 1-comment 2-files
my $done = 0;
@@ -234,6 +235,8 @@ my $done = 0;
$state = 0;
while (<>) {
+ #print STDERR "debug ($state, " . (@date ? (strftime "%Y-%m-%d", @date) : "") . "): `$_'\n";
+
if ($state == 0) {
if (m,^Author: (.*),) {
$author = $1;
@@ -241,14 +244,19 @@ while (<>) {
if (m,^Date: (.*),) {
@date = strptime($1);
}
+ if (m,^Merge: (.*),) {
+ $merge = 1;
+ }
$state = 1 if (m,^$,);
} elsif ($state == 1) {
$state = 2 if (m,^$,);
s/^ //g;
s/\n/ /g;
$comment = $comment . $_;
+ } elsif ($state == 2 && $merge) {
+ $done = 1;
} elsif ($state == 2) {
- if (m,^([0-9]+)\t([0-9]+)\t(.*)$,) {
+ if (m,^([-0-9]+)\t([-0-9]+)\t(.*)$,) {
push @files, $3;
} elsif (m,^[^ ],) {
# No file changes.
@@ -275,12 +283,17 @@ while (<>) {
$msg =~ s/[ \t]+\n/\n/g;
- print "$files: $msg\n";
+ if ($merge) {
+ print "\t$msg\n";
+ } else {
+ print "$files: $msg\n";
+ }
@date = ();
$author = "";
@files = ();
$comment = "";
+ $merge = 0;
$state = 0;
$done = 0;