~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_tags.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
16
16
 
17
17
"""Tests for commands related to tags"""
18
18
 
19
 
from bzrlib import bzrdir
 
19
from bzrlib import (
 
20
    bzrdir,
 
21
    tag,
 
22
    )
20
23
from bzrlib.branch import (
21
24
    Branch,
22
25
    )
47
50
        self.assertContainsRe(err,
48
51
            "Tags can only be placed on a single revision")
49
52
 
 
53
    def test_no_tag_name(self):
 
54
        out, err = self.run_bzr('tag -d branch', retcode=3)
 
55
        self.assertContainsRe(err, 'Please specify a tag name.')
 
56
 
 
57
    def test_automatic_tag_name(self):
 
58
        def get_tag_name(branch, revid):
 
59
            return "mytag"
 
60
        Branch.hooks.install_named_hook('automatic_tag_name',
 
61
            get_tag_name, 'get tag name')
 
62
        out, err = self.run_bzr('tag -d branch')
 
63
        self.assertContainsRe(out, 'Created tag mytag.')
 
64
 
50
65
    def test_tag_current_rev(self):
51
66
        t = self.make_branch_and_tree('branch')
52
67
        t.commit(allow_pointless=True, message='initial commit',
73
88
        # ... but can if you use --force
74
89
        out, err = self.run_bzr('tag -d branch NEWTAG --force')
75
90
 
 
91
    def test_tag_delete_requires_name(self):
 
92
        out, err = self.run_bzr('tag -d branch', retcode=3)
 
93
        self.assertContainsRe(err, 'Please specify a tag name\\.')
 
94
 
76
95
    def test_branch_push_pull_merge_copies_tags(self):
77
96
        t = self.make_branch_and_tree('branch1')
78
97
        t.commit(allow_pointless=True, message='initial commit',