On Wed, Aug 14, 2024 at 04:57:13PM -0700, Bryce Harrington wrote:
Athos raised an issue last week about how when annotating delta about
upstream status while doing git-ubuntu merges, if another package later
does a merge of the package and does not use git-ubuntu style, you can
lose the rich history (and thus also the annotation).

I mentioned this also happens frequently with packages suffering
git-ubuntu's "empty dir" bug (LP: #1917877).  Several of the packages I
merge have this problem, so I've gotten accustomed to recovering the
rich history from my previous work.  This is what I'm currently using:

##############
local last_remote
last_remote=$(git branch -a | grep -E "remotes/.*/merge-" | sort -V | tail -1 | 
xargs) || {
   error "Could not determine last merge remote to base off of"
   return 1
}
branch_name="${last_remote##*/}"

git checkout "${last_remote}" -b "${branch_name}" || {
   error "Could not checkout '${branch_name}'"
   return 1
}
git tag -f base || {
   error "Failed to tag base"
   return 1
}

git checkout ubuntu/devel || {
   error "Could not checkout ubuntu/devel"
   return 1
}

git rebase base || {
   # TODO: If the conflict is with debian/patch/series,
   #       then likely we can just take the debian version and
   #       then append all the additional ubuntu patches to the end.
   # TODO: If the conflict is with changelog, then take the ubuntu
   #       version of the file, and then prepend all Debian's
   #       new changelog entries on top.
   # TODO: Then git add, and git rebase --continue
   error "Could not rebase to base"
   return 1
}
info "Successfully imported past merge work"
#############


That first step is going to need some adjustment, because it assumes YOU
were the last merger, and assumes my style of branch naming for merges
(i.e. "merge-" and alphanumerically sortable).  So YMMV on that and TBD
to handle someone else as the last merger, but hopefully the above gives
some inspiration.

Bryce

Thanks, Bryce!

I will try it next time I face the issue.

I suppose this can eventually land under ubuntu-helpers :)

--
Athos Ribeiro

--
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam

Reply via email to