Skip to content

Instantly share code, notes, and snippets.

@xavierzwirtz
Created February 4, 2015 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xavierzwirtz/5a45d90e7b629f4651bf to your computer and use it in GitHub Desktop.
Save xavierzwirtz/5a45d90e7b629f4651bf to your computer and use it in GitHub Desktop.
$nextTagID = 0;
Function getTag() {
$global:nextTagID += 1;
return 'foo' + $global:nextTagID
}
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
getTag | Set-Content data.txt
#cd repo
hg add data.txt
hg commit -m "Init"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
$tagId = getTag
$tagId | Set-Content data.txt
"Test branch file content #$i" > "b_$i.txt"
hg branch "testbranch-$i"
hg add
hg commit -m "Modify"
hg tag $tagId
}).TotalSeconds
Write-Host "Created branch #$i"
}
Write-Host "Created 100 branches off of each other"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
$tagId = getTag
$tagId | Set-Content data.txt
"Test branch file content #$i" > "b_$i.txt"
hg branch "testbranch2-$i"
hg add
hg commit -m "Modify"
hg tag $tagId
}).TotalSeconds
Write-Host "Created branch2 #$i"
}
Write-Host "Created 100 branches off of default"
for ($i=1; $i -le 100; $i++)
{
(Measure-Command {
$tagId = getTag
$tagId | Set-Content data.txt
"Test branch file content #$i" > "b_$i.txt"
hg branch "testbranch3-$i"
hg add
hg commit -m "Modify"
hg tag $tagId
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 {
$tagId = getTag
$tagId | Set-Content data.txt
"Test branch file content #$i" > "b_$i.txt"
hg branch "testbranch4-$i"
hg add
hg commit -m "Modify"
hg tag $tagId
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 {
$tagId = getTag
$tagId | Set-Content data.txt
"Test branch file content #$i" > "b_$i.txt"
hg branch "testbranch5-$i"
hg add
hg commit -m "Modify"
hg tag $tagId
}).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