darcs

Issue 2683 push --mirror (aka --force, --obliterate, --clone)

Title push --mirror (aka --force, --obliterate, --clone)
Priority feature Status unknown
Milestone Resolved in
Superseder Nosy List bfrk
Assigned To
Topics

Created on 2021-09-10.07:11:27 by bfrk, last changed 2021-09-11.05:39:00 by bfrk.

Files
File name Uploaded Type Edit Remove
wip-first-preliminary-implementation-of-apply-__mirror.dpatch bfrk, 2021-09-10.09:08:07 application/octet-stream
Messages
msg22910 (view) Author: bfrk Date: 2021-09-10.07:11:26
Alexis Praga <alexis.praga@gmail.com> asked about a feature akin to 
`git push --force` in darcs. In addition to adding local patches 
that are not in the remote repo, this would also obliterate remote 
patches that are not in the local repo. Since push is send plus a 
remote apply, such an option would first have to be implemented for 
apply.

The option should display a prominent warning, listing the patches 
to be obliterated.

Should be easy to implement, even for a newcomer (with some 
guidance).
msg22911 (view) Author: bfrk Date: 2021-09-10.07:22:32
Another name for the option could be --mirror.
msg22912 (view) Author: bfrk Date: 2021-09-10.09:08:07
Attached is a patch that implements apply --mirror, including a small 
test script. This is WIP as there is no warning yet, and no way to 
interactively select the patches to obliterate.

It occurred to me that this idea could be generalized to provide user-
selectable merge strategies. Given a set of patches to apply (them) and 
an existing set (us), with all common patches already removed, we could 
offer:

 - default: standard merge, possibly resulting in conflicts,
   details depend on --mark-conflicts/--allow-conflicts/...
 - mirror: replace us with them (this one)
 - remove-conflicting: remove only our conflicting patches
 - suspend: suspend all our existing patches
 - suspend-conflicting: suspend (only) our conflicting patches 
 - skip-conflicting: add only their non-conflicting patches

The versions wich suspend or remove existing patches in the target repo 
could support interactive selection, possibly resulting in a "mixed 
mode" strategy, where we first obliterate or suspend the selected 
patches and then fall back to the default merge for the rest.
Attachments
History
Date User Action Args
2021-09-10 07:11:27bfrkcreate
2021-09-10 07:22:32bfrksetmessages: + msg22911
2021-09-10 09:08:07bfrksetfiles: + wip-first-preliminary-implementation-of-apply-__mirror.dpatch
messages: + msg22912
2021-09-11 05:39:00bfrksettitle: push --force (or --obliterate or --clone) -> push --mirror (aka --force, --obliterate, --clone)