From 01c9ae1e709bf767a95d2f812f574c771252d5e4 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Tue, 24 Jun 2008 22:54:43 +0200 Subject: [PATCH] Added more tags to the generated test repo This makes it easier to refer to tags instead of hashes in the test cases. This is a major advantage when the hashes change, as it means that only the expected output of the tests will have to be changed. Currently, the changed hash has to be looked up in the old version, and then the commit that it refers to found in the new version, which hash may then be used. This eliminates that need, and will make such a hash change a lot easier to correct. --- src/scripts/setupRepo.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/scripts/setupRepo.py b/src/scripts/setupRepo.py index 49e05b2..3185a13 100755 --- a/src/scripts/setupRepo.py +++ b/src/scripts/setupRepo.py @@ -268,7 +268,7 @@ def revertLastCommit(commitChanges=True): if commitChanges: bumpTime() -def tagRelease(releaseNumber): +def tagRelease(releaseNumber, head="HEAD"): """Tags a release. The created tag is 'v' + releaseNumber. @@ -279,8 +279,7 @@ def tagRelease(releaseNumber): git = Git(".") - git.tag('v' + str(releaseNumber)) - bumpTime() + git.tag('v' + str(releaseNumber), head) def createRemoteBranch(name, start="HEAD"): """Creates a new remote branch with the specified name @@ -365,6 +364,9 @@ def createTestRepository(): createBranch(p) createLinearHistory(t, createFile=True, count=7, finalCommit=True) + # Start out with release 0 + tagRelease(0, head="HEAD~3") + # Revert that commit revertLastCommit() @@ -400,12 +402,14 @@ def createTestRepository(): # Create a readme and add some content to it createLinearHistory(r, createFile=True, count=5, finalCommit=True) + tagRelease(2) # Ah, but that last one was bad, we don't want it revertLastCommit() # Instead, continue the linear history createLinearHistory(r, start=6, count=1) + tagRelease(3) # Come to think of it, that -was- a really good change after all revertLastCommit() @@ -413,6 +417,8 @@ def createTestRepository(): # Reinstate that final commit createLinearHistory(r, count=0, finalCommit=True) + tagRelease(4, head="HEAD~1") + # Create a branch to delete a file on createBranch(e) @@ -423,7 +429,7 @@ def createTestRepository(): addFile(r, createFile=False) # Create a release at this point for easy switching later - tagRelease(2) + tagRelease(5) # Switch back to master for the test suite checkoutBranch(m) -- 2.11.4.GIT