tests/test-evolve-effectflags.t
author Boris Feld <boris.feld@octobus.net>
Fri, 19 May 2017 18:43:21 +0200
changeset 2446 4b2f4da124a2
child 2447 631ccf45f0bb
permissions -rw-r--r--
effectflag: allow to save effect of change in obsmarkers Obsmarkers lack a precious information, what are the changes between the source and the destination. This could be several thing: - The description has changed, with a amend -e for example - The parent has changed, with a rebase for example - The content has changed, with a amend for example - The meta, like the user, has change, with a amend -u for example Or any combination of them. We hijack the createobsmarkers in order to compute the modification and store the effect flag which is basically a bitfield of the changes list above and we store it in the metadata for the moment. The advantage of computing the flag just before creating the obs marker is that all commands will immediately be compatible and we can start working on the UI display of the flag. As a future optimization, the commands will be able to pass the flag directly or data to help computing them, for example amend knows if the description has changed or rebase now if the parent has changed, virtually removing the overhead. To start simple, this patch add the detection and storage of the effect flag when the description has changed. And hide it behind an experimental flag disabled by default 'experimental.evolution.effect-flags'. More flag will follow.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2446
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     1
Test the 'effect-flags' feature
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     2
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     3
Global setup
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     4
============
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     5
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     6
  $ . $TESTDIR/testlib/common.sh
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     7
  $ cat >> $HGRCPATH <<EOF
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     8
  > [ui]
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     9
  > interactive = true
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    10
  > [phases]
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    11
  > publish=False
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    12
  > [extensions]
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    13
  > evolve =
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    14
  > [experimental]
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    15
  > evolution.effect-flags = 1
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    16
  > EOF
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    17
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    18
  $ hg init $TESTTMP/effect-flags
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    19
  $ cd $TESTTMP/effect-flags
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    20
  $ mkcommit ROOT
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    21
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    22
Test simple amend touching the description only
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    23
-----------------------------------------------
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    24
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    25
amend the description only
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    26
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    27
  $ mkcommit A0
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    28
  $ hg amend -m "A1"
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    29
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    30
check result
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    31
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    32
  $ hg debugobsolete
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    33
  471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (*) {'ef1': '1', 'user': 'test'} (glob)
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    34
  $ hg obslog .
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    35
  @  fdf9bde5129a (2) A1
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    36
  |
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    37
  x  471f378eab4c (1) A0
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    38
       rewritten by test (*) as fdf9bde5129a (glob)
4b2f4da124a2 effectflag: allow to save effect of change in obsmarkers
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    39