#61 Let fedpkg merge branches with same content but differing history
Closed: Invalid by ndim. Opened by ndim.

After the migration to dist-git, many packages with the same package content for multiple branches often have different histories.

In git, this means that normal git merging does strange things, and it also makes the branch structure unnecessarily complicated to grasp.

I have built a preliminary fedpkg initial-merge command which does the following:

  • take a fresh clone of a package (immediately after fedpkg clone)
  • group the branches whose HEAD contains the same directory tree content
  • git merge -s ours each branch group into the "newest" branch, e.g. f12, f13, 14 into master, and f8 into f9 (the sorting order still has bugs)
  • Do fast-forward merges the "newest" branch into each branch from the branch group (e.g. git checkout f13 && git merge master) to make sure that not only the package content is the same, but also the git commit SHA matches.

The future merging becomes easier in that e.g.

  1. edit foo.spec in master
  2. commit foo.spec to master
  3. fedpkg switch-branch f14 && git merge master
    This will work without problems as the f14 branch was created in git.
  4. fedpkg switch-branch f13 && git merge master
    This merge might be strange as the f13 branch has a different history even though it has the same content.

I am not sure where and how this might be included into fedpkg. One might argue that fedpkg clone should do that, or that the conversion from dist-cvs to dist-git should have done it. I am not sure whether this should be a separate fedpkg command "initial-merge", or whether "initial-merge" is even a good name for it (it might become useful later).

For a test case, check e.g. the "ddrescue" package:

  1. fedpkg clone ddrescue
  2. cd ddrescue && gitk --all &
    Observe the current branch structure.
  3. fedpkg initial-merge ddrescue
  4. Press F5 in gitk --all window to see the new branch structure

At this time, I am '''not''' proposing to directly include any of my code, but want to start a discussion.

I am attaching a single patch implementing the fedpkg initial-merge command. I am developing the code in the ''initial-merge-command/raw'' branch in git://fedorapeople.org/~ndim/fedora-packager.git (cf. http://fedorapeople.org/gitweb?p=ndim/public_git/fedora-packager.git;a=shortlog;h=refs/heads/initial-merge-command/raw)


"fedpkg initial-merge" implementation for illustration (squashed commits)
initial-merge-command.patch

Fix pyfedpkg usage of path=os.getcwd() as function parameters
0001-Remove-function-call-results-as-default-param-values.patch

Cleaned up implementation of "fedpkg initial-merge" command
0002-Add-fedpkg-initial-merge-command.patch

Replying to [ticket:51 ndim]:

I am attaching a single patch implementing the fedpkg initial-merge command. I am developing the code in the ''initial-merge-command/raw'' branch in git://fedorapeople.org/~ndim/fedora-packager.git (cf. http://fedorapeople.org/gitweb?p=ndim/public_git/fedora-packager.git;a=shortlog;h=refs/heads/initial-merge-command/raw)

More cleaned up version available from my ''initial-merge-command/2'' branch (gitweb link is http://fedorapeople.org/gitweb?p=ndim/public_git/fedora-packager.git;a=shortlog;h=refs/heads/initial-merge-command/2).

The most up-to-date version is in the enh/initial-merge branch at git://fedorapeople.org/~ndim/fedora-packager.git.

I have just ported the initial-merge code to 0.5.2.0, and pushed it as the initial-merge/3 branch at git://fedorapeople.org/~ndim/fedora-packager.git.

Updated version pushed to git://fedorapeople.org/~ndim/fedora-packager.git as 4/initial-merge branch. Works with my man page patch now, and has bash completion support.

This needs some major rework, which I will do shortly.

Hey, I'm interested in using this on some packages. Is it safe?

This appears to be about a decade out of date.

Closing.

Metadata Update from @ndim:
- Issue close_status updated to: Invalid
- Issue status updated to: Closed (was: Open)

Metadata