I use git_buildbot.py script for my project and prefer "true merges" in my git repositories. So I use the --first-parent script option for my builds.
Unfortunately, the behavior of the script with this option is currently incorrect. It only prevents merged commits from being added if changes are added when the branch is updated:
|
if newrev != baserev: |
|
# Not a pure rewind |
|
options = "--reverse --pretty=oneline" |
|
if first_parent: |
|
# Add the --first-parent to avoid adding the merge commits which |
|
# have already been tested. |
|
options += ' --first-parent' |
|
f = subprocess.Popen(shlex.split("git rev-list %s %s..%s" % |
|
(options, baserev, newrev)), |
|
stdout=subprocess.PIPE) |
|
gen_changes(f, branch) |
The first problem is that the changes are lost. For merge commits, merge pseudo-changes are added, and if the commit does not have its own changes, only merge is added:
|
if re.match(r"^Merge: .*$", line): |
|
files.append('merge') |
This would only be useful when the fact of merging and not change is important.
So if this option is enabled, all changes merged using a merge commit must be added.
The second problem is that when adding a branch, this logic is fully ignored:
|
f3 = subprocess.Popen( |
|
shlex.split("git rev-list --reverse --pretty=oneline --stdin %s" % newrev), |
|
stdin=f2.stdout, |
|
stdout=subprocess.PIPE |
|
) |
If the branch has no history yet, there is no problem. But otherwise changes are added for every commit. If changes will also be added from merge commits, they will be duplicated and builds will be triggered twice.
Again, when this option is enabled, changes must not be added from merged commits when adding a branch. The behavior must be the same as when updating a branch.
I use
git_buildbot.pyscript for my project and prefer "true merges" in my git repositories. So I use the--first-parentscript option for my builds.Unfortunately, the behavior of the script with this option is currently incorrect. It only prevents merged commits from being added if changes are added when the branch is updated:
buildbot-contrib/master/contrib/git_buildbot.py
Lines 315 to 325 in 4c8615d
The first problem is that the changes are lost. For merge commits,
mergepseudo-changes are added, and if the commit does not have its own changes, onlymergeis added:buildbot-contrib/master/contrib/git_buildbot.py
Lines 175 to 176 in 4c8615d
This would only be useful when the fact of merging and not change is important.
So if this option is enabled, all changes merged using a merge commit must be added.
The second problem is that when adding a branch, this logic is fully ignored:
buildbot-contrib/master/contrib/git_buildbot.py
Lines 230 to 234 in 4c8615d
If the branch has no history yet, there is no problem. But otherwise changes are added for every commit. If changes will also be added from merge commits, they will be duplicated and builds will be triggered twice.
Again, when this option is enabled, changes must not be added from merged commits when adding a branch. The behavior must be the same as when updating a branch.