Skip to content

Instantly share code, notes, and snippets.

@xavierzwirtz
Created February 4, 2015 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavierzwirtz/0ecfb8bc739b1cabb3d6 to your computer and use it in GitHub Desktop.
Save xavierzwirtz/0ecfb8bc739b1cabb3d6 to your computer and use it in GitHub Desktop.
Function makeRandom($length){
$text = '';
for($i=1; $i -le $length; $i++){
$text += [char](get-random -Minimum 65 -Maximum 90);
}
return $text
}
mkdir repo
cd repo
hg init
"Initial file" > "init.txt"
hg add
hg commit -m "Initial commit"
cd ..
Write-Host "Creating 3000 files"
for ($i=1; $i -le 3000; $i++)
{
makeRandom(500) | Set-Content "repo\$i.txt"
}
Write-Host "Created 3000 files"
cd repo
hg add
hg commit -m "3000 file commit"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
"Test branch file content #$i" > "b_$i.txt"
hg branch "testbranch-$i"
hg add
hg commit -m "Added file b_$i.txt"
}).TotalSeconds
Write-Host "Created branch #$i"
}
Write-Host "Created 100 branches off of each other"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
hg update default --clean
"Test branch file content #$i" > "b2_$i.txt"
hg branch "testbranch2-$i"
hg add
hg commit -m "Added file b2_$i.txt"
}).TotalSeconds
Write-Host "Created branch2 #$i"
}
Write-Host "Created 100 branches off of default"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
"Test branch file content #$i" > "b3_$i.txt"
hg branch "testbranch3-$i"
hg add
hg commit -m "Added file b3_$i.txt"
hg commit -m "Closed branch3 #$i" --close-branch
}).TotalSeconds
Write-Host "Created branch3 #$i"
}
Write-Host "Created 100 branches off of each other and closed them"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
hg update default --clean
"Test branch file content #$i" > "b4_$i.txt"
hg branch "testbranch4-$i"
hg add
hg commit -m "Added file b4_$i.txt"
hg commit -m "Closed branch4 #$i" --close-branch
}).TotalSeconds
Write-Host "Created branch4 #$i"
}
Write-Host "Created 100 branches off of default and closed them"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
hg update default --clean
"Test branch file content #$i" > "b5_$i.txt"
hg branch "testbranch5-$i"
hg add
hg commit -m "Added file b5_$i.txt"
}).TotalSeconds
Write-Host "Created branch5 #$i"
}
Write-Host "Created 100 branches off of default after closed branches"
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment