* Re: Pulling one commit at a time.
2009-08-24 6:22 ` Sanjiv Gupta
@ 2009-08-24 7:46 ` Kai Blin
2009-08-24 7:55 ` Sanjiv Gupta
2009-08-24 10:22 ` David Aguilar
2009-08-24 18:19 ` Avery Pennarun
2 siblings, 1 reply; 20+ messages in thread
From: Kai Blin @ 2009-08-24 7:46 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: Nanako Shiraishi, git
[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]
On Monday 24 August 2009 08:22:07 Sanjiv Gupta wrote:
> > In general the public history isn't necessarily a single straight line
> > like this picture and it doesn't make sense to merge one at a time for
> > all the commits on the public branch, but if that is what you really want
> > to do, you can do so.
>
> Excellent description. Thanks for that. I want to merge commits one by
> one because I want to run a regression suite on each commit and
> therefore know if any one is causing failures.
What I do for a case like this is using rebase. I'm not sure if I get the
explanation right enough to please all the git gurus on the list, but I'll
try. What this basically does is to back out all the commits you did on your
branch to the point you diverged from the branch you're rebasing on now.
So assuming you had a structure like this:
your 'master' HEAD
|
A---B---C
/
---X---U---V---W---Y
|
public 'master' HEAD
git would back out commits A-C, so your local branch HEAD would be at X. Then,
if forwards your branch to the branch you're rebasing on, so your local
branch HEAD is at Y now, like the public branch HEAD.
After that, git applies all of your patches back to your local branch,
producing a tree that looks like this:
your 'master' HEAD
|
A---B---C
/
---X---U---V---W---Y
|
public 'master' head
Personally I prefer that solution as it keeps the history linear. Of course
this means that all of your commits change sha1s, and you should not do this
on public branches with tags. But if you're still developing, it's much
easier to wrap your head around a history like this. It's also nice to
present feature branches to other people, as all of your commits are in one
block, without lots of annoying merge commits between them.
rebase also handles more complicated cases of merging, but from the way I
understood your issue, this should already help.
Cheers,
Kai
--
Kai Blin
WorldForge developer http://www.worldforge.org/
Wine developer http://wiki.winehq.org/KaiBlin
Samba team member http://www.samba.org/samba/team/
--
Will code for cotton.
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: Pulling one commit at a time.
2009-08-24 7:46 ` Kai Blin
@ 2009-08-24 7:55 ` Sanjiv Gupta
2009-08-24 8:20 ` Sean Estabrooks
` (3 more replies)
0 siblings, 4 replies; 20+ messages in thread
From: Sanjiv Gupta @ 2009-08-24 7:55 UTC (permalink / raw)
To: Kai Blin; +Cc: Nanako Shiraishi, git
Kai Blin wrote:
> On Monday 24 August 2009 08:22:07 Sanjiv Gupta wrote:
>
>
>>> In general the public history isn't necessarily a single straight line
>>> like this picture and it doesn't make sense to merge one at a time for
>>> all the commits on the public branch, but if that is what you really want
>>> to do, you can do so.
>>>
>> Excellent description. Thanks for that. I want to merge commits one by
>> one because I want to run a regression suite on each commit and
>> therefore know if any one is causing failures.
>>
>
> What I do for a case like this is using rebase. I'm not sure if I get the
> explanation right enough to please all the git gurus on the list, but I'll
> try. What this basically does is to back out all the commits you did on your
> branch to the point you diverged from the branch you're rebasing on now.
>
> So assuming you had a structure like this:
>
> your 'master' HEAD
> |
> A---B---C
> /
> ---X---U---V---W---Y
> |
> public 'master' HEAD
>
> git would back out commits A-C, so your local branch HEAD would be at X. Then,
> if forwards your branch to the branch you're rebasing on, so your local
> branch HEAD is at Y now, like the public branch HEAD.
>
> After that, git applies all of your patches back to your local branch,
> producing a tree that looks like this:
>
> your 'master' HEAD
> |
> A---B---C
> /
> ---X---U---V---W---Y
> |
> public 'master' head
>
> Personally I prefer that solution as it keeps the history linear. Of course
> this means that all of your commits change sha1s, and you should not do this
> on public branches with tags. But if you're still developing, it's much
> easier to wrap your head around a history like this. It's also nice to
> present feature branches to other people, as all of your commits are in one
> block, without lots of annoying merge commits between them.
>
> rebase also handles more complicated cases of merging, but from the way I
> understood your issue, this should already help.
>
> Cheers,
> Kai
>
Thanks Kai.
What I would like is to "test *every* commit" available in the public
master. There would be no local changes or commits that aren't pushed in
the private copy.
So I just want to clone one copy from the public master and then just
keep pulling commits from the public master one by one and run
regressions on each one.
It's a damn simple thing in SVN world.
$ svn info will give you the current version you are at, assume it is
"cur_rev"
$ svn update -r `expr $cur_rev + 1`
$ build
$ test
Thanks,
- Sanjiv
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: Pulling one commit at a time.
2009-08-24 7:55 ` Sanjiv Gupta
@ 2009-08-24 8:20 ` Sean Estabrooks
2009-08-24 8:20 ` Erik Faye-Lund
` (2 subsequent siblings)
3 siblings, 0 replies; 20+ messages in thread
From: Sean Estabrooks @ 2009-08-24 8:20 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: Kai Blin, Nanako Shiraishi, git
On Mon, 24 Aug 2009 13:25:22 +0530
Sanjiv Gupta <sanjiv.gupta@microchip.com> wrote:
Hi Sanjiv,
> What I would like is to "test *every* commit" available in the public
> master. There would be no local changes or commits that aren't pushed in
> the private copy.
> So I just want to clone one copy from the public master and then just
> keep pulling commits from the public master one by one and run
> regressions on each one.
There's no reason to ask for the commits from the public master one by
one. You can download them all in one operation. After that it is
a local operation to checkout each new commit and build-test it. This
is more efficient than needing a network operation to get each commit
individually.
As an aside, you might not really need to test each and every commit.
It is likely enough to just test the most recent commit since it is
built on top of all the commits that came before it. Essentially
you'd be testing all the new commits at once and only need to test
more commits (git bisect) if you found a regression with that first
test.
> It's a damn simple thing in SVN world.
With Git you have a complete local copy of the history. Once you're
up to date with remote master you can checkout each new commit at
your leisure pretty damn simply ;o)
Cheers,
Sean
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: Pulling one commit at a time.
2009-08-24 7:55 ` Sanjiv Gupta
2009-08-24 8:20 ` Sean Estabrooks
@ 2009-08-24 8:20 ` Erik Faye-Lund
2009-08-24 8:22 ` Erik Faye-Lund
2009-08-24 8:28 ` Matthieu Moy
2009-08-24 8:33 ` skillzero
3 siblings, 1 reply; 20+ messages in thread
From: Erik Faye-Lund @ 2009-08-24 8:20 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: Kai Blin, Nanako Shiraishi, git
On Mon, Aug 24, 2009 at 9:55 AM, Sanjiv Gupta<sanjiv.gupta@microchip.com> wrote:
> It's a damn simple thing in SVN world.
> $ svn info will give you the current version you are at, assume it is
> "cur_rev"
> $ svn update -r `expr $cur_rev + 1`
> $ build
> $ test
I guess you could do it something like this. Unlike your example, this
processes all new commits, not just the next one.
$ git fetch origin master
$ for c in $(git rev-list HEAD..FETCH_HEAD); do
$ git checkout $c
$ build
$ test
$ done
$ git merge FETCH_HEAD
--
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Pulling one commit at a time.
2009-08-24 7:55 ` Sanjiv Gupta
2009-08-24 8:20 ` Sean Estabrooks
2009-08-24 8:20 ` Erik Faye-Lund
@ 2009-08-24 8:28 ` Matthieu Moy
2009-08-24 8:33 ` skillzero
3 siblings, 0 replies; 20+ messages in thread
From: Matthieu Moy @ 2009-08-24 8:28 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: Kai Blin, Nanako Shiraishi, git
Sanjiv Gupta <sanjiv.gupta@microchip.com> writes:
> What I would like is to "test *every* commit" available in the
> public master.
Then, you don't want to _merge_ each of them, you want to _fetch_ and
test each of them (Erik Faye-Lund's reply gives a solution for that).
Fetching is about getting existing commits from another repository,
while merging is about creating new commits.
--
Matthieu
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Pulling one commit at a time.
2009-08-24 7:55 ` Sanjiv Gupta
` (2 preceding siblings ...)
2009-08-24 8:28 ` Matthieu Moy
@ 2009-08-24 8:33 ` skillzero
2009-08-24 8:41 ` Matthieu Moy
3 siblings, 1 reply; 20+ messages in thread
From: skillzero @ 2009-08-24 8:33 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: Kai Blin, Nanako Shiraishi, git
On Mon, Aug 24, 2009 at 12:55 AM, Sanjiv
Gupta<sanjiv.gupta@microchip.com> wrote:
> What I would like is to "test *every* commit" available in the public
> master. There would be no local changes or commits that aren't pushed in the
> private copy.
> So I just want to clone one copy from the public master and then just keep
> pulling commits from the public master one by one and run regressions on
> each one.
>
> It's a damn simple thing in SVN world.
> $ svn info will give you the current version you are at, assume it is
> "cur_rev"
> $ svn update -r `expr $cur_rev + 1`
> $ build
> $ test
I'm not sure if this is the best way, but you can use git fetch to get
the latest stuff from the server without merging it then you can merge
from origin/master (i.e. the server) into your local master, one
commit at a time, and verify at each step:
$ git merge `git log --format=%h master..origin/master | sed '$!d'`
$ build
$ test
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: Pulling one commit at a time.
2009-08-24 8:33 ` skillzero
@ 2009-08-24 8:41 ` Matthieu Moy
0 siblings, 0 replies; 20+ messages in thread
From: Matthieu Moy @ 2009-08-24 8:41 UTC (permalink / raw)
To: skillzero; +Cc: Sanjiv Gupta, Kai Blin, Nanako Shiraishi, git
skillzero@gmail.com writes:
> On Mon, Aug 24, 2009 at 12:55 AM, Sanjiv
> Gupta<sanjiv.gupta@microchip.com> wrote:
>
>> What I would like is to "test *every* commit" available in the public
>> master. There would be no local changes or commits that aren't pushed in the
>> private copy.
>> So I just want to clone one copy from the public master and then just keep
>> pulling commits from the public master one by one and run regressions on
>> each one.
>>
>> It's a damn simple thing in SVN world.
>> $ svn info will give you the current version you are at, assume it is
>> "cur_rev"
>> $ svn update -r `expr $cur_rev + 1`
>> $ build
>> $ test
>
> I'm not sure if this is the best way, but you can use git fetch to get
> the latest stuff from the server without merging it then you can merge
> from origin/master (i.e. the server) into your local master, one
> commit at a time, and verify at each step:
See my other reply, but I really don't think you want to _merge_ one
commit at a time. This would not mean "test each commit" but "test the
interaction between any two commits", which few people would care
about.
The example above in SVN doesn't merge each commit, it just walks
history (assuming the history is linear, the example wouldn't be as
simple if it had to walk /branches/* too). To continue the analogy,
merging commits one by one in Git would be more or less the equivalent
in SVN of:
$ svn status
# Hmm, OK, I have stuff to commit.
$ test
# Yes, it works. But do my changes work too on top of the previous
# commits?
$ while ...; do
svn update $(($cur_rev - 1))
build
test
done
# If so, then
$ svn update
$ svn commit
That is: test the interaction between your new change with any other
changes in the repository. 'never seen anyone interested by such
thing, but why not ;-).
--
Matthieu
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Pulling one commit at a time.
2009-08-24 6:22 ` Sanjiv Gupta
2009-08-24 7:46 ` Kai Blin
@ 2009-08-24 10:22 ` David Aguilar
2009-08-24 10:49 ` Sanjiv Gupta
2009-08-24 18:19 ` Avery Pennarun
2 siblings, 1 reply; 20+ messages in thread
From: David Aguilar @ 2009-08-24 10:22 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: Nanako Shiraishi, git
On Mon, Aug 24, 2009 at 11:52:07AM +0530, Sanjiv Gupta wrote:
> Excellent description. Thanks for that. I want to merge commits one by
> one because I want to run a regression suite on each commit and
> therefore know if any one is causing failures.
'git bisect' is your friend.
If your developers are disciplined and test each change as they
commit it then you're going to have fewer problems.
If they aren't, then make 'em send you patches. Then you can
at least 'git am' each one and run the tests at each step,
including the critical steps where you merge various topics
together.
I'm not sure what exactly you're trying to accomplish, though.
I'm just making guesses without you telling us more.
Are you trying to do post-mortem change-that-introduced-bug
finding (git bisect), commit-time bug prevention
(patch-based workflows, using git commit hooks to disallow
commits that fail the tests, etc), or is it something
completely different?
HTH,
--
David
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Pulling one commit at a time.
2009-08-24 10:22 ` David Aguilar
@ 2009-08-24 10:49 ` Sanjiv Gupta
2009-08-24 11:07 ` Matthieu Moy
0 siblings, 1 reply; 20+ messages in thread
From: Sanjiv Gupta @ 2009-08-24 10:49 UTC (permalink / raw)
To: David Aguilar; +Cc: Nanako Shiraishi, git
David Aguilar wrote:
> On Mon, Aug 24, 2009 at 11:52:07AM +0530, Sanjiv Gupta wrote:
>
>> Excellent description. Thanks for that. I want to merge commits one by
>> one because I want to run a regression suite on each commit and
>> therefore know if any one is causing failures.
>>
>
> 'git bisect' is your friend.
>
> If your developers are disciplined and test each change as they
> commit it then you're going to have fewer problems.
>
> If they aren't, then make 'em send you patches. Then you can
> at least 'git am' each one and run the tests at each step,
> including the critical steps where you merge various topics
> together.
>
> I'm not sure what exactly you're trying to accomplish, though.
> I'm just making guesses without you telling us more.
>
> Are you trying to do post-mortem change-that-introduced-bug
> finding (git bisect), commit-time bug prevention
> (patch-based workflows, using git commit hooks to disallow
> commits that fail the tests, etc), or is it something
> completely different?
>
>
> HTH,
>
>
Thanks everyone for the overwhelming response.
I was looking for post-mortem change-that-introduced-bug.
It's also called "buildbot" in other terms, which sends you an email
with the details of the "culprit" commit as soon as it introduces a bug.
- Sanjiv
-
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Pulling one commit at a time.
2009-08-24 10:49 ` Sanjiv Gupta
@ 2009-08-24 11:07 ` Matthieu Moy
0 siblings, 0 replies; 20+ messages in thread
From: Matthieu Moy @ 2009-08-24 11:07 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: David Aguilar, Nanako Shiraishi, git
Sanjiv Gupta <sanjiv.gupta@microchip.com> writes:
> I was looking for post-mortem change-that-introduced-bug.
If so, then you don't need to test every commit. As David mentionned,
"git bisect" is your friend, and will do a binary search, finding the
culprit commit much more efficiently (run the testsuite log(n) times
instead of n times).
OTOH, if you want some kind of quality insurance (i.e. check that
every commit is OK, including the case where a commit introduces a
bug, and the next one fixes it), bisect is rather helpless.
--
Matthieu
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Pulling one commit at a time.
2009-08-24 6:22 ` Sanjiv Gupta
2009-08-24 7:46 ` Kai Blin
2009-08-24 10:22 ` David Aguilar
@ 2009-08-24 18:19 ` Avery Pennarun
2009-08-24 19:08 ` Sanjiv Gupta
2 siblings, 1 reply; 20+ messages in thread
From: Avery Pennarun @ 2009-08-24 18:19 UTC (permalink / raw)
To: Sanjiv Gupta; +Cc: Nanako Shiraishi, git
On Mon, Aug 24, 2009 at 6:22 AM, Sanjiv Gupta<sanjiv.gupta@microchip.com> wrote:
> Excellent description. Thanks for that. I want to merge commits one by one
> because I want to run a regression suite on each commit and therefore know
> if any one is causing failures.
Hi Sanjiv,
'git bisect' is an even better way to do this, in my experience. I
wrote a program (http://github.com/apenwarr/gitbuilder/) that
automatically runs regression tests against all the new versions on
all the new branches. It then publishes the results on a web page and
via RSS.
gitbuilder does take a shortcut: if commit x passes and commit x+10
passes, it doesn't bother to test commit x+1..9. However, if x+10
fails, it bisects automatically to find the first commit that caused a
failure. You could disable this shortcut easily enough, however.
Have fun,
Avery
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Pulling one commit at a time.
2009-08-24 18:19 ` Avery Pennarun
@ 2009-08-24 19:08 ` Sanjiv Gupta
0 siblings, 0 replies; 20+ messages in thread
From: Sanjiv Gupta @ 2009-08-24 19:08 UTC (permalink / raw)
To: Avery Pennarun; +Cc: Nanako Shiraishi, git
Avery Pennarun wrote:
> On Mon, Aug 24, 2009 at 6:22 AM, Sanjiv Gupta<sanjiv.gupta@microchip.com> wrote:
>
>> Excellent description. Thanks for that. I want to merge commits one by one
>> because I want to run a regression suite on each commit and therefore know
>> if any one is causing failures.
>>
>
> Hi Sanjiv,
>
> 'git bisect' is an even better way to do this, in my experience. I
> wrote a program (http://github.com/apenwarr/gitbuilder/) that
> automatically runs regression tests against all the new versions on
> all the new branches. It then publishes the results on a web page and
> via RSS.
>
> gitbuilder does take a shortcut: if commit x passes and commit x+10
> passes, it doesn't bother to test commit x+1..9.
Even, I won't need to run in between commits in that case.
What I wanted to do is to
1. off load this job to a script which sends an email to the developer
who broke something,
2. schedule that script
3. and sit back relaxed myself.
Looks like you already have the tool. Thanks.
BTW, git is not git, it's great.
thanks to everybody who replied.
- Sanjiv
> However, if x+10
> fails, it bisects automatically to find the first commit that caused a
> failure. You could disable this shortcut easily enough, however.
>
> Have fun,
>
> Avery
>
^ permalink raw reply [flat|nested] 20+ messages in thread