Mercurial > treepkg
view test/test_git.py @ 525:e73a4bbc35e7
tag_pkg_parameters depends on scm therefore move this method to the
tagdetetors which are scm aware
currently bot tag_pkg_parameters (for git and svn) contain hardcoded
regular expressions which should be removed in future
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Mon, 15 Nov 2010 14:34:15 +0000 |
parents | c4288095887f |
children |
line wrap: on
line source
# Copyright (C) 2010 by Intevation GmbH # Authors: # Bjoern Ricks <bjoern.ricks@intevation.de> # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with the software for details. """Tests for the treepkg.git module""" import unittest import os import treepkg.run as run from treepkg.cmdexpand import cmdexpand from filesupport import FileTestMixin import treepkg.git as git class TestTagDetector(unittest.TestCase, FileTestMixin): def test_tag(self): dirname = self.create_test_specific_temp_dir() repodir = self.create_temp_dir("repo") clonedir = os.path.join(dirname, "clone") run.call(cmdexpand("git init -q"), cwd=repodir) file = open(os.path.join(repodir, "tmp"), "w") file.write("test") file.close() run.call(cmdexpand("git add tmp"), cwd=repodir) run.call(cmdexpand("git commit -m \"Add tmp file\""), cwd=repodir) run.call(cmdexpand("git tag tag1"), cwd=repodir) run.call(cmdexpand("git tag tag2"), cwd=repodir) run.call(cmdexpand("git tag anothertag"), cwd=repodir) tagdetector1 = git.TagDetector(repodir, "tag*", clonedir) tags = tagdetector1.list_tags() urlrev = tagdetector1.newest_tag_revision() self.assertEquals(len(tags), 2) self.assertEquals(urlrev[0], "tag2") tagdetector2 = git.TagDetector(dirname, "*tag*", clonedir) tags = tagdetector2.list_tags() urlrev = tagdetector2.newest_tag_revision() self.assertEquals(len(tags), 3) self.assertEquals(urlrev[0], "tag2") tagdetector3 = git.TagDetector(dirname, "another*", clonedir) tags = tagdetector3.list_tags() urlrev = tagdetector3.newest_tag_revision() self.assertEquals(len(tags), 1) self.assertEquals(urlrev[0], "anothertag")