Mercurial > hg
view mercurial/mpatch.h @ 32009:c6cb21ddf74a
checkheads: upgrade the obsolescence postprocessing logic (issue4354)
The previous logic had many shortcoming (eg: looking at the head only, not
handling prune, etc...), the new logic use a more robust approach:
For each head, we check if after the push all changesets exclusive to this heads
will be obsolete. If they are, the branch considered be "replaced".
To check if a changeset will be obsolete, we simply checks:
* the changeset phase
* the existence of a marker relevant to the "pushed set" that affects the
changesets..
This fixes two major issues of the previous algorithm:
* branch partially rewritten (eg: head but not root) are no longer detected as
replaced,
* Prune are now properly handled.
(This implementation was introduction in the evolve extension, version 6.0.0.)
This new algorithm has an extended number of tests, a basic one is provided
in this patch. The others will be introduced in their own changeset for clarity.
In addition, we stop trying to process heads unknown locally, we do not have
enough data to take an informed decision so we should stop pretending we do.
This reflect a test that is now update.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 15 Apr 2017 02:55:18 +0200 |
parents | 155f0cc3f813 |
children | 761355833867 |
line wrap: on
line source
#ifndef _HG_MPATCH_H_ #define _HG_MPATCH_H_ #define MPATCH_ERR_NO_MEM -3 #define MPATCH_ERR_CANNOT_BE_DECODED -2 #define MPATCH_ERR_INVALID_PATCH -1 struct mpatch_frag { int start, end, len; const char *data; }; struct mpatch_flist { struct mpatch_frag *base, *head, *tail; }; int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist** res); ssize_t mpatch_calcsize(ssize_t len, struct mpatch_flist *l); void mpatch_lfree(struct mpatch_flist *a); int mpatch_apply(char *buf, const char *orig, ssize_t len, struct mpatch_flist *l); struct mpatch_flist *mpatch_fold(void *bins, struct mpatch_flist* (*get_next_item)(void*, ssize_t), ssize_t start, ssize_t end); #endif