view tests/test-sidedata.t @ 45584:4c8a93ec6908

merge: store commitinfo if these is a dc or cd conflict delete-changed or changed-delete conflicts can either be resolved by mergetool, if some tool is passed and using or by user choose something on prompt or user doing some `hg revert` after choosing the file to remain conflicted. If the user decides to keep the changed side, on commit we just reuse the parent filenode. This is mostly fine unless we are in a distributed environment and people are doing criss-cross merges. Since, we don't have recursive merges or any other way of describing the end result of the merge was an explicit choice and it should be differentiated from it's ancestors, merge algo during criss-cross merges fails to take in account the explicit choice made by user and end up with a what-can-be-said-wrong-merge. The solution which we are trying to fix this is by creating a filenode on commit instead of reusing the parent filenode. This helps differentiate between pre-merged filenode and post-merge filenode and kind of tells about the choice user made. To implement creating new filenode functionality, we store info about these files in mergestate so that we can read them on commit and force create a new filenode. Differential Revision: https://phab.mercurial-scm.org/D8988
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 03 Sep 2020 13:44:06 +0530
parents ea9563e9e65a
children 705c37f22859
line wrap: on
line source

==========================================================
Test file dedicated to checking side-data related behavior
==========================================================

Check data can be written/read from sidedata
============================================

  $ cat << EOF >> $HGRCPATH
  > [extensions]
  > testsidedata=$TESTDIR/testlib/ext-sidedata.py
  > EOF

  $ hg init test-sidedata --config format.exp-use-side-data=yes
  $ cd test-sidedata
  $ echo aaa > a
  $ hg add a
  $ hg commit -m a --traceback
  $ echo aaa > b
  $ hg add b
  $ hg commit -m b
  $ echo xxx >> a
  $ hg commit -m aa

  $ hg debugsidedata -c 0
  2 sidedata entries
   entry-0001 size 4
   entry-0002 size 32
  $ hg debugsidedata -c 1 -v
  2 sidedata entries
   entry-0001 size 4
    '\x00\x00\x006'
   entry-0002 size 32
    '\x98\t\xf9\xc4v\xf0\xc5P\x90\xf7wRf\xe8\xe27e\xfc\xc1\x93\xa4\x96\xd0\x1d\x97\xaaG\x1d\xd7t\xfa\xde'
  $ hg debugsidedata -m 2
  2 sidedata entries
   entry-0001 size 4
   entry-0002 size 32
  $ hg debugsidedata a  1
  2 sidedata entries
   entry-0001 size 4
   entry-0002 size 32

Check upgrade behavior
======================

Right now, sidedata has not upgrade support

Check that we can upgrade to sidedata
-------------------------------------

  $ hg init up-no-side-data --config format.exp-use-side-data=no
  $ hg debugformat -v -R up-no-side-data
  format-variant     repo config default
  fncache:            yes    yes     yes
  dotencode:          yes    yes     yes
  generaldelta:       yes    yes     yes
  sparserevlog:       yes    yes     yes
  sidedata:            no     no      no
  persistent-nodemap:  no     no      no
  copies-sdc:          no     no      no
  plain-cl-delta:     yes    yes     yes
  compression:        zlib   zlib    zlib
  compression-level:  default default default
  $ hg debugformat -v -R up-no-side-data --config format.exp-use-side-data=yes
  format-variant     repo config default
  fncache:            yes    yes     yes
  dotencode:          yes    yes     yes
  generaldelta:       yes    yes     yes
  sparserevlog:       yes    yes     yes
  sidedata:            no    yes      no
  persistent-nodemap:  no     no      no
  copies-sdc:          no     no      no
  plain-cl-delta:     yes    yes     yes
  compression:        zlib   zlib    zlib
  compression-level:  default default default
  $ hg debugupgraderepo -R up-no-side-data --config format.exp-use-side-data=yes > /dev/null

Check that we can downgrade from sidedata
-----------------------------------------

  $ hg init up-side-data --config format.exp-use-side-data=yes
  $ hg debugformat -v -R up-side-data
  format-variant     repo config default
  fncache:            yes    yes     yes
  dotencode:          yes    yes     yes
  generaldelta:       yes    yes     yes
  sparserevlog:       yes    yes     yes
  sidedata:           yes     no      no
  persistent-nodemap:  no     no      no
  copies-sdc:          no     no      no
  plain-cl-delta:     yes    yes     yes
  compression:        zlib   zlib    zlib
  compression-level:  default default default
  $ hg debugformat -v -R up-side-data --config format.exp-use-side-data=no
  format-variant     repo config default
  fncache:            yes    yes     yes
  dotencode:          yes    yes     yes
  generaldelta:       yes    yes     yes
  sparserevlog:       yes    yes     yes
  sidedata:           yes     no      no
  persistent-nodemap:  no     no      no
  copies-sdc:          no     no      no
  plain-cl-delta:     yes    yes     yes
  compression:        zlib   zlib    zlib
  compression-level:  default default default
  $ hg debugupgraderepo -R up-side-data --config format.exp-use-side-data=no > /dev/null