runbot/forwardport
Xavier Morel b1d3278de1 [CHG] forwardport: perform forward porting without working copies
The goal is to reduce maintenance and odd disk interactions &
concurrency issues, by not creating concurrent clones, not having to
push forks back in the repository, etc... it also removes the need to
cleanup "scratch" working copies though that looks not to have been an
issue in a while.

The work is done on isolated objects without using or mutating refs,
so even concurrent work should not be a problem.

This turns out to not be any more verbose (less so if anything) than
using `cherry-pick`, as that is not really designed for scripted /
non-interactive use, or for squashing commits thereafter. Working
directly with trees and commits is quite a bit cleaner even without a
ton of helpers.

Much of the credit goes to Julia Evans for [their investigation of
3-way merges as the underpinnings of cherry-picking][3-way merge],
this would have been a lot more difficult if I'd had to rediscover the
merge-base trick independently.

A few things have been changed by this:

- The old trace/stderr from cherrypick has disappeared as it's
  generated by cherrypick, but for a non-interactive use it's kinda
  useless anyway so I probably should have looked into removing it
  earlier (I think the main use was investigation of the inflateinit
  issue).
- Error on emptied commits has to be hand-rolled as `merge-tree`
  couldn't care less, this is not hard but is a bit annoying.
- `merge-tree`'s conflict information only references raw commits,
  which makes sense, but requires updating a bunch of tests. Then
  again so does the fact that it *usually* doesn't send anything to
  stderr, so that's usually disappearing.

Conveniently `merge-tree` merges the conflict marker directly in the
files / tree so we don't have to mess about moving them back out of
the repository and into the working copy as I assume cherry-pick does,
which means we don't have to try and commit them back in ether. That
is a huge part of the gain over faffing about with the working copy.

Fixes #847

[3-way merge]: https://jvns.ca/blog/2023/11/10/how-cherry-pick-and-revert-work/
2024-07-08 14:37:14 +02:00
..
changelog [ADD] *: changelog entries I forgot 2023-08-14 09:28:19 +02:00
data [FIX] forwardport: count next to users should be the fwport 2024-06-28 08:18:34 +02:00
migrations [CHG] *: rewrite commands set, rework status management 2024-05-23 07:58:46 +02:00
models [CHG] forwardport: perform forward porting without working copies 2024-07-08 14:37:14 +02:00
tests [CHG] forwardport: perform forward porting without working copies 2024-07-08 14:37:14 +02:00
__init__.py [ADD] mergebot, forwardbot: changelog 2021-10-20 15:16:48 +02:00
__manifest__.py [CHG] *: rewrite commands set, rework status management 2024-05-23 07:58:46 +02:00
controllers.py [FIX] forwardport: count next to users should be the fwport 2024-06-28 08:18:34 +02:00