tests/bundles/test-revlog-diff-relative-to-nullrev.sh
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 27 May 2022 02:54:20 +0200
changeset 49259 a94f28be2e6e
parent 49258 6aae0e1ecdbc
child 51051 f636103c4d67
permissions -rwxr-xr-x
test-revlog: adds a new root revision with a delta against nullrev We add a revision with null parent but that is not the first revision of the revlog. It make it a different a case that is worthy of testing.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48871
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
     1
#!/bin/bash
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
     2
#
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
     3
# Make sure to patch mercurial to create the delta against nullrev
49257
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
     4
#
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
     5
# # Parent  cdb85d0512b81031d4a7b30d6a5ddbe69ef1a876
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
     6
#
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
     7
# diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
     8
# --- a/mercurial/revlogutils/deltas.py
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
     9
# +++ b/mercurial/revlogutils/deltas.py
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    10
# @@ -1117,7 +1117,10 @@ class deltacomputer:
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    11
#                  candidaterevs = next(groups)
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    12
#
48871
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    13
#          if deltainfo is None:
49257
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    14
# -            deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev)
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    15
# +            if revlog._generaldelta:
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    16
# +                deltainfo = self._builddeltainfo(revinfo, nullrev, fh)
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    17
# +            else:
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    18
# +                deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev)
996a70c75c66 test-revlog: update the patch used to test delta againts nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48871
diff changeset
    19
48871
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    20
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    21
cd "`dirname \"$0\"`"
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    22
export HGRCPATH=
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    23
export HGMODULEPOLICY=py
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    24
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    25
rm -rf nullrev-diff
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    26
../../hg init nullrev-diff  --config format.revlog-compression=zlib
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    27
cd nullrev-diff
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    28
echo hi > a
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    29
../../../hg commit -Am root-B
49258
6aae0e1ecdbc test-revlog: adds a non-root revision with a delta against nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49257
diff changeset
    30
echo ho > a
6aae0e1ecdbc test-revlog: adds a non-root revision with a delta against nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49257
diff changeset
    31
../../../hg commit -Am child-A
49259
a94f28be2e6e test-revlog: adds a new root revision with a delta against nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49258
diff changeset
    32
hg up null
a94f28be2e6e test-revlog: adds a new root revision with a delta against nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49258
diff changeset
    33
echo ha > a
a94f28be2e6e test-revlog: adds a new root revision with a delta against nullrev
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 49258
diff changeset
    34
../../../hg commit -Am root-A
48871
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    35
../../../hg debugdeltachain a
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    36
rm -rf .hg/cache/ .hg/wcache/
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    37
cd ..
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    38
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    39
tar cf test-revlog-diff-relative-to-nullrev.tar nullrev-diff
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    40
2dd53a33aefa test-revlog: test a repository that contains a diff against nullrev
Arseniy Alekseyev <aalekseyev@janestreet.com>
parents:
diff changeset
    41
rm -rf nullrev-diff