mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
97c0bbb3ad
Summary: The file of some revision is the initial file content with applied deltas Delta is a vector of Fragments. Fragment is a sequential change of the file (old part of the content -> new content) This diff is representing the implementation of optimization of the process of getting a file content of some revision. Reviewed By: lukaspiatkowski Differential Revision: D12928138 fbshipit-source-id: fcc28e2d0e0acf83e17887092f6593e155431c1b
47 lines
1.2 KiB
Perl
47 lines
1.2 KiB
Perl
$ . $TESTDIR/library.sh
|
|
|
|
# setup repo, usegeneraldelta flag = false for forcing inline flag for file
|
|
# forcing running algo for inline revlof parsing
|
|
$ hg init repo-hg --config format.usegeneraldelta=false
|
|
|
|
# Init treemanifest and remotefilelog
|
|
$ cd repo-hg
|
|
$ cat >> .hg/hgrc <<EOF
|
|
> [extensions]
|
|
> treemanifest=
|
|
> [treemanifest]
|
|
> server=True
|
|
> EOF
|
|
|
|
$ touch file
|
|
$ max_line_length=20
|
|
$ lines_cnt=20
|
|
$ commits_cnt=20
|
|
$ lines_per_commit=5
|
|
|
|
# Fill the file randomly
|
|
$ for (( i=0; i < $lines_cnt; i++ ))
|
|
> do
|
|
> LINE_LENGTH=$(random_int $max_line_length)
|
|
> echo $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $LINE_LENGTH | head -n 1) >> file
|
|
> done
|
|
|
|
$ hg ci -Aqm "commit"$c
|
|
|
|
# Perform commits, every commit changes random lines, simulation of making diffs
|
|
$ for (( c=0; c < $commits_cnt; c++ ))
|
|
> do
|
|
> for ((change=0; change<$lines_per_commit; change++))
|
|
> do
|
|
> LINE_LENGTH=$(random_int $max_line_length)
|
|
> LINE_NUMBER=$(random_int $lines_cnt)
|
|
> CONTENT=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $LINE_LENGTH | head -n 1)
|
|
> sed -i "$LINE_NUMBER""s/.*/$CONTENT/" file
|
|
> done
|
|
> hg ci -Aqm "commit"$c
|
|
> done
|
|
|
|
$ cd $TESTTMP
|
|
|
|
$ blobimport files repo-hg/.hg repo
|