docs/instability.rst
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 07 Aug 2012 14:08:31 +0200
changeset 429 079b231b8ea4
parent 365 9f6a77ec66cb
child 492 7ecd41520dae
permissions -rw-r--r--
obsolete: introduce an extension helper and use it this extension helper allow most of setup operation to be declared in place using decorator. This allow clear separation between independant part of the code. This is the first HUGE wave of changes related to this introduction. The goal is to have a clear distinction and documention of every part of this extension.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
     1
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     2
-----------------------------------
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
     3
The instability Principle
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     4
-----------------------------------
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     5
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     6
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     7
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     8
An intrinsic contradiction
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     9
-----------------------------------
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    10
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    11
XXX starts by talking about getting ride of changeset.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    12
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    13
DVCSes bring two new major concepts to the Version Control Scene:
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    14
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    15
    * History is organized as a robust DAG,
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    16
    * History can be rewritten.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    17
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    18
However, the two concepts are in contradiction:
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    19
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    20
To achieve a robust history, three key elements are gathered in *changesets*:
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    21
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    22
    * Full snapshot of the versioned content,
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    23
    * Reference to the previous full snapshot used to build the new one,
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    24
    * A description of the change who lead from the old content to the new old.
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    25
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    26
All three elements are to compute a *unique* hash that identify the changeset
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    27
(with various other metadata). This identification is a key part of DVCS design.
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    28
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    29
This is a very useful property because Changing B parent means
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    30
changing B content too. This requires the creation of **another**
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    31
changeset, which is semantically good.
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    32
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    33
::
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    34
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    35
  Schema base,  A, B and B'
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    36
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    37
To avoid duplication, the older changeset is usually discarded from accessible
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    38
history. I'm calling them *obsolete* changesets.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    39
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    40
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    41
But rewriting a changeset with children does not change these
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    42
children's parent! And because children of the rewritten changeset
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    43
still **depend** on the older "dead" version of the changeset with
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    44
can not get rid of this dead version.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    45
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    46
::
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    47
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    48
  Schema base,  A and A' and B.
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    49
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    50
I'm calling these children **unstable** because they are based on a
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    51
dead changeset and prevent people to get rid of it.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    52
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    53
This instability is an **unavoidable consequence** of the strict dependency of
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    54
changeset.  History Rewriting history alway  need to take it in account and
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    55
provide a way to rewrite the descendant on the new changeset to avoid
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    56
coexistence of the old and new version of a rewritten changeset.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    57
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    58
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    59
Everybody is working around the issue
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    60
------------------------------------------------
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    61
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    62
I'm not claiming that rewriting history is impossible. People are successfully
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    63
doing for years. However they all need to work around *instability*. Several
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    64
work around strategy exists.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    65
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    66
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    67
Rewriting all at once
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    68
``````````````````````````
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    69
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    70
The simplest way to avoid instability is to ensure rewriting
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    71
operations always end in a stable situation. This is achieved by
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    72
rewriting all affected changesets at the same time.
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    73
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    74
Rewriting all descendants at the same time when rewriting a changeset.
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    75
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    76
::
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    77
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    78
  Schema!
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    79
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    80
Several Mercurial commands apply it: rebase, collapse, histedit.
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    81
Mercurial also refuses to amend changeset with descendant. The git
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    82
branch design enforces such approach in git too.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    83
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    84
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    85
However, DVCS are **Distributed**. This means that you do not control what
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    86
happen outside your repository. Once a changeset have been exchanged *outside*,
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    87
there is no way to be sure it does not have descendants somewhere else.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    88
Therefore **if you rewrite changeset that exists elsewhere, you can't eradicate
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    89
the risk of instability.**
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    90
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    91
Do not rewrite exchanged changeset
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
    92
```````````````````````````````````
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    93
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    94
To work around the issue above, Mercurial introduced phases, which
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    95
prevent you from rewriting shared changesets and ensure others can't
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    96
pull certain changesets from you. But this is a very frustrating
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    97
limitation that prevents you to efficiently sharing, reviewing and
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
    98
collaborating on mutable changesets.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    99
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   100
In the Git world, they use another approach to prevent instability. By
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   101
convention only a single developper works on a changeset contained in
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   102
a named branch. But once again this is a huge blocker for
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   103
collaborating. Moreover clueless people **will** mess up social
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   104
convention soon or later.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   105
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   106
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   107
Loose the DAG robustness
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   108
````````````````````````````
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   109
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   110
The other approach in Mercurial is to keep the mutable part of the
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   111
history outside the DVCS constraint. This is the MQ approach of
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   112
sticking a quilt queue over Mercurial.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   113
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   114
This allow much more flexible workflow but two major feature are lost in the
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   115
process:
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   116
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   117
:Graceful merge: MQ use plain-patch to store changeset content and patch have
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   118
                 trouble to apply in changing context. Applying your queue
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   119
                 becomes very painful when context changes.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   120
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   121
:easy branching: A quilt queue is by definition a linear queue. Increasing risk
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   122
                 of conflict
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   123
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   124
It is possible to collaborate over versioned mq! But you are going to
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   125
have a lot of troubles.
228
5a17c0d41a00 proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 227
diff changeset
   126
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   127
Ignore conflicts
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   128
```````````````````````````````````
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   129
 
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   130
Another ignored issue is a conflicting rewrite of the same changeset.
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   131
If a changeset is rewritten two times we have two newer versions,
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   132
and duplicated history is complicated to merge.
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   133
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   134
Mercurial work around by
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   135
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   136
The "One set of mutable changset == One developer" mantra is also a way to work
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   137
around conflicting rewriting of changeset. If two different people are able to
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   138
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   139
The git branch model allow to overwrite changeset version by another
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   140
one, but it does not care about divergent version. It is the equivalent
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   141
of "common ftp" source management for changesets.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   142
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   143
Facing The Danger Once And For All
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   144
------------------------------------------------
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   145
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   146
Above we saw that, the more effort you put to avoid instability, the more option
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   147
you deny. And even most restrictive work flow can't guarantee that instability
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   148
will never show up!
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   149
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   150
Obsolete marker can handle the job
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   151
```````````````````````````````````
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   152
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   153
It is time to provide a full featured solution to deal with
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   154
instability and to stop working around the issue! This is why I
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   155
developing a new feature for mercurial called "Obsolete markers".
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   156
Obsolete markers have two key properties:
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   157
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   158
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   159
* Any "old" changeset we want to get ride of is **explicitly** marked
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   160
  as "obsolete" by history rewriting operation.
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   161
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   162
  By explicitly marking the obsolete part of the history, we will be able to
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   163
  easily detect instability situation.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   164
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   165
* Relations between old and new version of changesets are tracked by obsolete
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   166
  markers.
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   167
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   168
  By Storing a meta-history of changeset evolution we are able to easily resolve
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   169
  instability and edition conflict [#]_ .
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   170
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   171
.. [#] edition conflict is another major obstable to collaboration. See the
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   172
       section dedicated to obsolete marker for details.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   173
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   174
Improves robustness == improves simplicity
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   175
````````````````````````````````````````````````
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   176
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   177
This proposal should **first** be seen as a safety measure.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   178
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   179
It allow to detect instability as soon as possible
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   180
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   181
::
240
ab9ee2eba21e [doc] fix unstable code block
Pierre-Yves.David@ens-lyon.org
parents: 231
diff changeset
   182
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   183
    $ hg pull
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   184
    added 3 changeset
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   185
    +2 unstable changeset
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   186
    (do you want "hg stabilize" ?)
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   187
    working directory parent is obsolete!
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   188
    $ hg push
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   189
    outgoing unstable changesets
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   190
    (use "hg stabilize" or force the push)
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   191
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   192
And should not not encourage people to create instability
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   193
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   194
::
240
ab9ee2eba21e [doc] fix unstable code block
Pierre-Yves.David@ens-lyon.org
parents: 231
diff changeset
   195
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   196
    $ hg up 42
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   197
    $ hg commit --amend
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   198
    changeset have descendant.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   199
    $ hg commit --amend -f
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   200
    +5 unstable changeset
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   201
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   202
    $ hg rebase -D --rev 40::44
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   203
    rebasing already obsolete changeset 42:AAA will conflict with newer version 48:BBB
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   204
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   205
While allowing powerful feature
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   206
````````````````````````````````````````````````
221
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   207
d43b72724b84 doc: unstability principle
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
   208
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   209
* Help to automatically solve instability.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   210
365
9f6a77ec66cb evolve: switch the official name for "kill" to prune
Pierre-Yves.David@ens-lyon.org
parents: 357
diff changeset
   211
* "prune" changeset remotely.
231
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   212
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   213
* track resulting changeset when submitting patch//pull request.
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   214
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   215
* Focus on what you do:
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   216
f589d054329a restore unstability content
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 228
diff changeset
   217
  I do not like the "all at once" model of history rewriting. I'm comfortable
357
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   218
  with instability and obsolete marker offer all the tool to safely create and
b398e9c2dbd1 doc: English proofreading
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 243
diff changeset
   219
  handle instability locally.
228
5a17c0d41a00 proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 227
diff changeset
   220
5a17c0d41a00 proof-read documentation and docstrings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 227
diff changeset
   221