Hello, here we go! gitk screenshot: http://wwwcip.informatik.uni-erlangen.de/~sithglan/shot.png (64k) (faui00u) [~/work/mutt/git/mutt-test] ../../../git/yagf/git pull ../mutt-attach-file/ ../mutt-collapse-flags/ ../mutt-cstatus/ ../mutt-cvs/ ../mutt-edit-threads/ ../mutt-hcache/ ../mutt-headers/ ../mutt-imap/ ../mutt-maildir-mtime/ ../mutt-move-hook/ ../mutt-setenv-hack/ ../mutt-thread-pattern/ ../mutt-menu-move/ <chatty output> (faui00u) [~/work/mutt/git/mutt-test] git treediff ../mutt-tg-solaris (faui00u) [~/work/mutt/git/mutt-test] git changes -m | perl -pe '$a += /^diff-tree/; exit if $a==2' diff-tree 5b22da9792b6f6a968dc0a916275d6c301575f75 (from e8f4a291a81f0a8fb24555f0e36e4b75e2d3f4c8) Author: Thomas Glanzmann <sithglan@stud.uni-erlangen.de> Date: Mon May 30 00:28:53 2005 +0200 => faui00u:/home/cip/adm/sithglan/work/mutt/git/mutt-test <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-attach-file/.git (bringing head ahead) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-collapse-flags/.git (automatic merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-cstatus/.git (threeway merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-cvs/.git (nothing to merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-edit-threads/.git (threeway merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-hcache/.git (threeway merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-headers/.git (threeway merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-imap/.git (automatic merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-maildir-mtime/.git (threeway merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-move-hook/.git (nothing to merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-setenv-hack/.git (automatic merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-thread-pattern/.git (threeway merge) <= /home/cip/adm/sithglan/work/mutt/git/mutt-test/../mutt-menu-move/.git (threeway merge) Could please someone who has a clue how this merge should work (which it hopefully already does) look at my code to check for obvious mistakes in the merge *logic*. I call 'merge' with all involved trees (with current head first, if there is a current head). If everything is fine. I would like to write a seperate git-resolve script in sh or adopt the current to multi head merge - whatever you please. sub merge { my $message = undef; my $head = undef; my $last_tree = undef; my $fh; my @heads = (); foreach my $r (@_) { my $current_head = @{$r}[0]; my $current_url = @{$r}[1]; print "current_head => $current_head\ncurrent_url => $current_url\n"; push(@heads, '-p', ${current_head}); if (! defined($last_tree)) { $message = "=> ${current_url}\n"; $head = $current_head; $last_tree = $current_head; if (@_ == 1) { head($head); return; } next; } my $merge_base = gitcmdout('git-merge-base', $head, $current_head) || die ("no merge-base"); chomp($merge_base); print "head => $head\nremote => $current_head\nbase => $merge_base\n"; if ($merge_base eq $current_head) { $message .= "<= ${current_url} (nothing to merge)\n"; if (@_ == 2) { return; } next; } if ($merge_base eq $head) { $message .= "<= ${current_url} (bringing head ahead)\n"; $head = ${current_head}; $last_tree = ${current_head}; if (@_ == 2) { head($head); return; } next; } gitcmd('git-read-tree', '-m', $merge_base, $last_tree, $current_head); if (! defined($last_tree = write_tree())) { system('git-merge-cache', '-o', 'git-merge-one-file-script', '-a'); if (! defined($last_tree = write_tree())) { # FIXME: Make manual intervention possible # --tg 23:11 05-05-29 die("Couldn't merge automatically: Call 'git resolve'"); } $message .= "<= ${current_url} (threeway merge)\n"; } else { $message .= "<= ${current_url} (automatic merge)\n"; } } open($fh, "+>", undef); print $fh $message; seek($fh, 0, 0); $head = gitcmdinout($fh, 'git-commit-tree', $last_tree, @heads); chomp($head); close $fh; head($head); return; } Thomas - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
This archive was generated by hypermail 2.1.8 : 2005-05-30 09:05:59 EST