Commit Graph

31 Commits

Author SHA1 Message Date
Boris Feld
bd49de9658 effectflag: detect when date changed
Store in effect flag when the date changed between the predecessor and
its successors.

It can happens with "hg commit --amend -d", "hg amend -d" or "histedit".

Differential Revision: https://phab.mercurial-scm.org/D537
2017-07-06 14:54:22 +02:00
Boris Feld
dbe4674ce5 effectflag: detect when user changed
Store in effect flag when the user changed between the predecessor and its
successors.

It can happens with "hg commit --amend -u" or "histedit".

Differential Revision: https://phab.mercurial-scm.org/D536
2017-07-06 14:53:48 +02:00
Boris Feld
802a17caef effectflag: detect when description changed
Store in effect flag when the description changed between the predecessor and
its successors.

It can happens with "hg commit --amend -e", "hg amend -e" or "histedit".

Differential Revision: https://phab.mercurial-scm.org/D535
2017-07-06 14:52:34 +02:00
Boris Feld
f17532cf73 effectflag: store an empty effect flag for the moment
The idea behind effect flag is to store additional information in obs-markers
about what changed between a changeset and its successor(s). It's a low-level
information that comes without guarantees.

This information can be computed a posteriori, but only if we have all
changesets locally. This is not the case with distributed workflows where you
work with several people or on several computers (eg: laptop + build server).

Storing the effect-flag as a bitfield has several advantages:

- It's compact, we are using one byte per obs-marker at most for the effect-
  flag.
- It's compoundable, the obsfate log approach needs to display evolve history
  that could spans several obs-markers. Computing the effect-flag between a
  changeset and its grand-grand-grand-successor is simple thanks to the
  bitfield.

The effect-flag design has also some limitations:

- Evolving a changeset and reverting these changes just after would lead to
  two obs-markers with the same effect-flag without information that the first
  and third changesets are the same.

The effect-flag current design is a trade-off between compactness and
usefulness.

Storing this information helps commands to display a more complete and
understandable evolve history. For example, obslog (an Evolve command) use it
to improve its output:

x  62206adfd571 (34302) obscache: skip updating outdated obscache...
|    rewritten(parent) by Matthieu Laneuville <matthieu.laneuville@octobus...
|    rewritten(content) by Boris Feld <boris.feld@octobus.net>

The effect flag is stored in obs-markers metadata while we iterate on the
information we want to store. We plan to extend the existing obsmarkers
bit-field when the effect flag design will be stabilized.

It's different from the CommitCustody concept, effect-flag are not signed and
can be forged. It's also different from the operation metadata as the command
name (for example: amend) could alter a changeset in different ways (changing
the content with hg amend, changing the description with hg amend -e, changing
the user with hg amend -U). Also it's compatible with every custom command
that writes obs-markers without needing to be updated.

The effect-flag is placed behind an experimental flag set to off by default.

Hook the saving of effect flag in create markers, but store only an empty one
for the moment, I will refine the values in effect flag in following patches.

For more information, see:

  https://www.mercurial-scm.org/wiki/ChangesetEvolutionDevel#Record_types_of_operation

Differential Revision: https://phab.mercurial-scm.org/D533
2017-07-06 14:50:17 +02:00
Martin von Zweigbergk
2881701c97 templates: introduce a obsfateoperation() function
Differential Revision: https://phab.mercurial-scm.org/D723
2017-09-15 10:43:22 -07:00
Boris Feld
75dd8c8d61 template: better prune support in obsfate
successorssets don't returns good results for pruned commit, add a workaround
for simple cases.

A proper fix would require a large rework of successorssets algorithm, I will
send a separate series for this refactoring.
2017-07-03 17:38:56 +02:00
Boris Feld
f0beef3fad template: compute dates in obsfatedate
Extract the dates from obsmarkers. Compute the min and max date from the
obsmarker range list.
2017-07-03 15:34:10 +02:00
Boris Feld
6c65874220 template: compute user in obsfateusers
Extract, deduplicate users informations from obs markers in order to display
them.

Print all users for the moment, we might want to display users only in verbose
mode later.
2017-07-03 15:34:00 +02:00
Boris Feld
26b4084486 template: compute verb in obsfateverb
Add a template function obsfateverb which use the markers information to
compute a better obsfate verb.

The current logic behind the obsfate verb is simple for the moment:

- If the successorsets is empty, the changeset has been pruned, for example:

    Obsfate: pruned

- If the successorsets length is 1, the changeset has been rewritten without
  divergence, for example:

    Obsfate: rewritten as 2:337fec4d2edc, 3:f257fde29c7a

- If the successorsets length is more than 1, the changeset has diverged, for
  example:

    Obsfate: split as 2:337fec4d2edc, 3:f257fde29c7a

As the divergence might occurs on a subset of successors, we might see some
successors twice:

    Obsfate: split as 9:0b997eb7ceee, 5:dd800401bd8c, 10:eceed8f98ffc; split
    as 8:b18bc8331526, 5:dd800401bd8c, 10:eceed8f98ffc
2017-07-03 15:33:27 +02:00
Boris Feld
6cbbcf714c obsolete: fix old typo
Clean an old typo in successorssets.

Differential Revision: https://phab.mercurial-scm.org/D531
2017-07-03 03:56:53 +02:00
Boris Feld
6f2f6266d0 obsolete: move merge logic on the smaller object
Refactor some logic in _succs in order to clean successorssets code.

Differential Revision: https://phab.mercurial-scm.org/D530
2017-07-03 03:54:24 +02:00
Boris Feld
e5f84ad7bf template: add minimal obsfate template function
The goal of this series is to have templates capable of displaying the
evolution of a changeset in a clean and human-readable way.

Add the succsandmarkers template return successors and markers so it can be
used separately like this:

> {succsandmarkers % "{get(succsandmarkers, "markers")|json};"}

The following patches will add template functions that takes successors and
markers as inputs and compute various obsfate fields from them.
2017-08-17 18:26:11 +02:00
Boris Feld
3b8ae65ccd obsolete: track markers in _succs
We now also store markers in _succs. It will be useful for the obsfate template that
will use them to display more meaningful information like the list of users
that have evolved a changeset into its successors.
2017-07-03 03:27:58 +02:00
Boris Feld
3838c52528 obsolete: add an explicit '_succs.copy()' method
Mimic the standard API for copying in the _succs class, it makes the code
slightly cleaner and will be needed later for copying markers at the same time
than copying the list content.
2017-07-03 03:13:17 +02:00
Boris Feld
db45a50f51 obsolete: introduce a _succs class
It will be useful later when we will be adding markers to _succs in order to
represent a successorset with the list of markers from the root to each
successors sets. This information will be needed for the obsfate template I will
introduce.

Makes it a subclass of list so all callers will continue to work.
2017-07-03 00:53:55 +02:00
Boris Feld
76d1768227 obsmarker: fix precnode deprecation
The deprecation message for marker.precnode was wrong. Fix the typo.

Differential Revision: https://phab.mercurial-scm.org/D413
2017-08-16 10:18:57 +02:00
Boris Feld
d88d8d1c9e obsutil: rename allprecursors into allpredecessors
Use util.nouideprecwarn because obsstore doesn't have easy access to an ui
object.

The renaming is done according to
https://www.mercurial-scm.org/wiki/CEDVocabulary.

Differential Revision: https://phab.mercurial-scm.org/D247
2017-08-02 19:49:57 +02:00
Boris Feld
edffdda1d5 obsstore: rename precursors into predecessors
Use util.nouideprecwarn because obsstore doesn't have easy access to an ui
object.

The renaming is done according to
https://www.mercurial-scm.org/wiki/CEDVocabulary.

Differential Revision: https://phab.mercurial-scm.org/D245
2017-08-02 19:39:08 +02:00
Boris Feld
6a8cca1d6e obsmarker: rename precnode into prednode
Rename prednode (predecessors node) into precnode (precursors node) in markers
class. Use util.nouideprecwarn because markers doesn't have easy access to an
ui object.

The renaming is done according to
https://www.mercurial-scm.org/wiki/CEDVocabulary.

Differential Revision: https://phab.mercurial-scm.org/D243
2017-08-02 19:20:59 +02:00
Augie Fackler
0a25400b8c obsutil: defend against succsmarkers() returning None
I'm not sure if this is a realistic problem, but doing this avoids
some pretty awful test failures on Python 3, and it looks like it
should be harmless.

Differential Revision: https://phab.mercurial-scm.org/D274
2017-07-24 11:29:51 -04:00
Boris Feld
061d0d579b obsolete: closest divergent support
Add a closest argument to successorssets changing the definition of latest
successors.

With "closest=false" (current behavior), latest successors are "leafs" on the
obsmarker graph. They don't have any successor and are known locally.

With "closest=true", latest successors are the closest locally-known
changesets that are visible in the repository or repoview. Closest successors
can be then obsolete, orphan.

This will be used in a later patch to show the closest successor of
changesets with the successorssets template.
2017-06-30 15:27:19 +02:00
Boris Feld
a17b3dc03b obsolete: small doc update for 'successorssets'
Clarify successorssets documentation before we start updating the main function.

This patch serie will introduce the successorssets template, the opposite of
predecessor templates.

Successors will use successorssets function and requires some improvement so
before doing that, we clean up successorssets a bit.
2017-06-30 13:47:24 +02:00
Pierre-Yves David
5e97e55c0f obsolete: reports the number of local changeset obsoleted when unbundling
This is a first basic visible usage of the changes tracking in the transaction.
We adds a new function computing the pre-existing changesets obsoleted by a
transaction and a transaction call back displaying this information.

Example output:

  added 1 changesets with 1 changes to 1 files (+1 heads)
  3 new obsolescence markers
  obsoleted 1 changesets

The goal is to evolve the transaction summary into something bigger, gathering
existing output there and adding new useful one. This patch is a good first step
on this road. The new output is basic but give a user to the content of
tr.changes['obsmarkers'] and give an idea of the new options we haves. I expect
to revisit the message soon.

The caller recording the transaction summary should also be moved into a more
generic location but further refactoring is needed before it can happen.
2017-06-28 03:54:19 +02:00
Pierre-Yves David
675e8b857f obsutil: move 'getmarkers' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to
bring 'obsolete.py' back to a more reasonable size.
2017-06-27 02:06:15 +02:00
Pierre-Yves David
cf50b9bfaf obsutil: move the 'marker' class to the new modules
We have a new 'obsutil' module now. We move high level utility there to bring
'obsolete.py' back to a more reasonable size.
2017-06-27 01:51:40 +02:00
Pierre-Yves David
ab57951fd7 obsutil: move 'foreground' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to
bring 'obsolete.py' back to a more reasonable size.
2017-06-27 01:40:34 +02:00
Pierre-Yves David
719387c7c7 obsutil: move 'allsuccessors' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to bring
'obsolete.py' back to a more reasonable size.
2017-06-27 01:36:20 +02:00
Pierre-Yves David
2f0989dab7 obsutil: move 'allprecursors' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to
bring 'obsolete.py' back to a more reasonable size.
2017-06-27 01:31:18 +02:00
Pierre-Yves David
8b519349e8 obsutil: move 'exclusivemarkers' to the new modules
We have a new 'obsutil' module now. We move the high level utility there to
bring 'obsolete.py' back to a more reasonable size.
2017-06-27 01:11:56 +02:00
Pierre-Yves David
04205af86b obsutil: move 'successorssets' to the new modules
We have a new 'obsutil' module now. We move this high level utility there to bring
'obsolete.py' back to a more reasonable size.
2017-06-27 01:03:01 +02:00
Boris Feld
6b02ddc020 template: add predecessors template
Add a 'predecessors' template that returns the list of all closest known
predecessors for a changectx. The elements of the list are row changectx node id
formatted by default as short nodes.

The "closest predecessors" are the first locally known revisions encountered
while, walking predecessors markers. For example:

  1) If a (A, (B)) markers exists and both A and B are locally known A is a
  closest predecessors of B.

  2) If a (A, (B)) and (B, (C)) markers exists and only A and C are known
  locally, A will be the closest precursors of C.

This logic respect repository filtering. So hidden revision will be skipped by
this logic unless --hidden is specified. Since we only display the visible
predecessors, this template will not display anything in most case. It makes a
good candidate for inclusion in the default log output.

I added a new test-file for testing the precursors in various scenarios. This
test file will also be used for the successors template.

A new "obsutil" module has been added to start gathering utility function
outside of the large obsolete.py module.
2017-06-15 13:02:58 +02:00