/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tests/test_refs.py

  • Committer: Vincent Ladeuil
  • Date: 2008-11-21 16:43:53 UTC
  • mto: (3855.1.1 bzr.integration)
  • mto: This revision was merged to the branch mainline in revision 3856.
  • Revision ID: v.ladeuil+lp@free.fr-20081121164353-8d07go33ycibzbwl
Better fix for bug #300055.

* bzrlib/tests/test_log.py:
(TestGetViewRevisions.make_tree_with_many_merges): Hijack the
helper to test for revisions touching file on a more significant
tree.
(TestGetViewRevisions.test_file_id_for_range): Better test to
highlight bug #300055: starting revision is a dotted revno and the
log should start right there, not at the mainline revision where
merging occured. But that uncovers yet another bug...
(TestGetRevisionsTouchingFileID.assertAllRevisionsForFileID):
_filter_revisions_touching_file_id doesn't have a 'direction'
parameter anymore.

* bzrlib/tests/blackbox/test_log.py:
(TestCaseWithoutPropsHandler): Fix line too long.
(TestLog.test_log_with_tags,
TestLogMerges.test_merges_partial_range): Fix whitespaces.

* bzrlib/log.py:
(calculate_view_revisions): Delete gratuitous split line. Push
direction handling closer to the needed point. Delete 'direction'
parameter when calling _filter_revisions_touching_file_id.
(_filter_revisions_touching_file_id): Delete 'direction'
parameter. This was used for calling reverse_by_depth which can't
handle an already reversed list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Jelmer Vernooij
2
 
# vim: encoding=utf-8
3
 
#
4
 
# This program is free software; you can redistribute it and/or modify
5
 
# it under the terms of the GNU General Public License as published by
6
 
# the Free Software Foundation; either version 2 of the License, or
7
 
# (at your option) any later version.
8
 
#
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 
 
18
 
 
19
 
"""Tests for ref handling."""
20
 
 
21
 
from bzrlib import tests
22
 
 
23
 
from bzrlib.plugins.git import refs
24
 
 
25
 
 
26
 
class BranchNameRefConversionTests(tests.TestCase):
27
 
 
28
 
    def test_head(self):
29
 
        self.assertEquals("HEAD", refs.ref_to_branch_name("HEAD"))
30
 
        self.assertEquals("HEAD", refs.branch_name_to_ref("HEAD"))
31
 
        self.assertEquals(None, refs.branch_name_to_ref(None))
32
 
 
33
 
    def test_tag(self):
34
 
        self.assertRaises(ValueError, refs.ref_to_branch_name, "refs/tags/FOO")
35
 
 
36
 
    def test_branch(self):
37
 
        self.assertEquals("frost", refs.ref_to_branch_name("refs/heads/frost"))
38
 
        self.assertEquals("refs/heads/frost", refs.branch_name_to_ref("frost"))
39
 
 
40
 
    def test_default(self):
41
 
        self.assertEquals("mydefault",
42
 
            refs.branch_name_to_ref(None, "mydefault"))
43
 
        self.assertEquals(None,
44
 
            refs.branch_name_to_ref(None))
45
 
 
46
 
 
47
 
class ExtractTagTests(tests.TestCase):
48
 
 
49
 
    def test_ignore_branch(self):
50
 
        self.assertEquals({},
51
 
            refs.extract_tags({
52
 
                "HEAD": "ref: foo", "refs/branches/blala": "la"}))
53
 
 
54
 
    def test_tags(self):
55
 
        self.assertEquals({"mytag": "mysha"},
56
 
            refs.extract_tags({
57
 
                "HEAD": "ref: foo", "refs/tags/mytag": "mysha"}))
58
 
 
59
 
    def test_ignores_peels(self):
60
 
        self.assertEquals({"mytag": "actualsha"},
61
 
            refs.extract_tags({
62
 
                "HEAD": "ref: foo",
63
 
                "refs/tags/mytag": "mysha",
64
 
                "refs/tags/mytag^{}": "actualsha"}))
65
 
 
66
 
    def test_non_ascii_name(self):
67
 
        self.assertEquals({u'myt\xe2g': "actualsha"},
68
 
            refs.extract_tags({
69
 
                "HEAD": "ref: foo",
70
 
                "refs/tags/myt\xc3\xa2g": "actualsha"}))
71
 
 
72
 
    def test_non_utf8_name(self):
73
 
        self.assertEquals({},
74
 
            refs.extract_tags({
75
 
                'refs/tags/LIBGEE_0_2_\xc20': "actualsha"}))