From: Sam Vilain <sam@vilain.net>
To: Andrew Myrick <amyrick@apple.com>
Cc: Eric Wong <normalperson@yhbt.net>, git@vger.kernel.org
Subject: Re: Regression: git-svn clone failure
Date: Wed, 23 Dec 2009 13:09:05 +1300 [thread overview]
Message-ID: <4B315FA1.1060902@vilain.net> (raw)
In-Reply-To: <B39991E2-D632-4FD5-B5DA-0B6B502BBFC8@apple.com>
Andrew Myrick wrote:
> This makes perfect sense now. Thank you for clarifying. Unfortunately, I don't think the patch you provided will help my particular problem. Allow me to elaborate.
>
> As I mentioned before, my project's integration model is to create a separate branch for every change. Specifically, we create a branch from a recent internal tag. So, the model for a simple bug fix looks something like this:
>
> F---G branch1
> / \
> D tag1 \ E tag2
> / \ /
> A---B C trunk
>
> Revision B on trunk was tagged with tag1. A bug was found in that version, so a branch was created from tag1, a fix was committed to the branch, and then the branch was merged back to trunk. Finally, trunk is tagged with tag2.
>
> The "missing commit" messages show up when git svn fetch is fetching revision C. It warns the there is a cherry-pick from branch1, and states that commits D and F are missing. These commits are just copies, however; there is no code change. The svn:mergeinfo property on trunk also only points at commit G. Should git-svn be ignoring commits D and F, which are copy operations, not code changes?
>
> Also of note is that we very, very rarely cherry-pick commits, and never directly from a branch to trunk. Branches are always integrated back to trunk in their entirety.
>
Ok. Yes, I can see that. I guess what the code needs to do then is
figure out if the missing changes didn't touch the tree, and exclude
them if that happens.
in the check_cherry_pick function, try putting at the end something like;
for my $commit (keys %commits) {
if (has_no_changes($commit)) {
delete $commits{$commit};
}
}
Before the return. has_no_changes should be:
sub has_no_changes {
my $commit = shift;
# merges should always have no changes, but more
# importantly $commit~1 won't be defined for them, so
# don't proceed if that is the case.
my $num_parents = split / /, command_oneline(
qw(rev-list --parents -1 -m), $commit,
);
return 0 if $num_parents > 1;
return (command_oneline("rev-parse", "$commit^{tree}")
eq command_oneline("rev-parse", "$commit~1^{tree}"));
}
has_no_changes should also be memoized. Cherry picking a single commit
from a large unrelated branch will be slow (using cat-file --batch could
help here, but that's not something I can hack out off the cuff like
this), the first time, then it will remember whether particular commits
have changes or not.
Good luck,
Sam
next prev parent reply other threads:[~2009-12-23 0:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 18:43 Regression: git-svn clone failure Andrew Myrick
2009-12-22 19:21 ` Eric Wong
2009-12-22 19:38 ` Andrew Myrick
2009-12-22 20:26 ` Eric Wong
2009-12-22 21:13 ` Sam Vilain
2009-12-22 21:38 ` Junio C Hamano
2009-12-23 0:09 ` Sam Vilain
2009-12-22 23:50 ` Andrew Myrick
2009-12-23 0:09 ` Sam Vilain [this message]
2009-12-22 20:35 ` [spf:guess] " Sam Vilain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B315FA1.1060902@vilain.net \
--to=sam@vilain.net \
--cc=amyrick@apple.com \
--cc=git@vger.kernel.org \
--cc=normalperson@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).