~ubuntu-branches/debian/sid/bzr-svn/sid

« back to all changes in this revision

Viewing changes to tests/test_revspec.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-03-10 14:38:42 UTC
  • mfrom: (1.2.1 upstream) (3.1.4 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090310143842-ucp9fxog1yi3la8f
Tags: 0.5.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
 
1
# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org>
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
5
 
# the Free Software Foundation; either version 3 of the License, or
 
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
7
 
8
8
# This program is distributed in the hope that it will be useful,
19
19
 
20
20
from bzrlib.branch import Branch
21
21
from bzrlib.bzrdir import BzrDir
22
 
from bzrlib.errors import BzrError, InvalidRevisionSpec
23
 
from bzrlib.revisionspec import RevisionSpec, RevisionInfo
 
22
from bzrlib.errors import (
 
23
    BzrError,
 
24
    InvalidRevisionSpec,
 
25
    )
 
26
from bzrlib.revisionspec import (
 
27
    RevisionInfo,
 
28
    RevisionSpec,
 
29
    )
24
30
from bzrlib.tests import TestCase
25
31
 
26
 
from bzrlib.plugins.svn.tests import TestCaseWithSubversionRepository
 
32
from bzrlib.plugins.svn.tests import SubversionTestCase
27
33
 
28
34
 
29
35
class TestRevSpec(TestCase):
37
43
        self.assertIs(None, RevisionSpec.from_string("svn:foo").get_branch())
38
44
 
39
45
 
40
 
class TestRevSpecsBySubversion(TestCaseWithSubversionRepository):
 
46
class TestRevSpecsBySubversion(SubversionTestCase):
41
47
    def test_by_single_revno(self):
42
48
        revspec = RevisionSpec.from_string("svn:2")
43
 
        repos_url = self.make_client("a", "dc")
44
 
        self.build_tree({"dc/foo": "foo"})
45
 
        self.client_add("dc/foo")
46
 
        self.client_commit("dc", "msg")
47
 
 
48
 
        self.build_tree({"dc/bar": "bar"})
49
 
        self.client_add("dc/bar")
50
 
        self.client_commit("dc", "msg2")
 
49
        repos_url = self.make_repository("a")
 
50
 
 
51
        dc = self.get_commit_editor(repos_url)
 
52
        dc.add_file("foo").modify()
 
53
        dc.close()
 
54
 
 
55
        dc = self.get_commit_editor(repos_url)
 
56
        dc.add_file("bar").modify()
 
57
        dc.close()
51
58
 
52
59
        branch = Branch.open(repos_url)
53
60
        revinfo = revspec._match_on(branch, None)
56
63
 
57
64
    def test_invalid_revnum(self):
58
65
        revspec = RevisionSpec.from_string("svn:foo")
59
 
        repos_url = self.make_client("a", "dc")
60
 
        self.build_tree({"dc/bar": "bar"})
61
 
        self.client_add("dc/bar")
62
 
        self.client_commit("dc", "msg2")
 
66
        repos_url = self.make_repository("a")
 
67
 
 
68
        dc = self.get_commit_editor(repos_url)
 
69
        dc.add_file("bar").modify()
 
70
        dc.close()
63
71
 
64
72
        branch = Branch.open(repos_url)
65
73
 
68
76
    def test_oor_revnum(self):
69
77
        """Out-of-range revnum."""
70
78
        revspec = RevisionSpec.from_string("svn:24")
71
 
        repos_url = self.make_client("a", "dc")
72
 
        self.build_tree({"dc/bar": "bar"})
73
 
        self.client_add("dc/bar")
74
 
        self.client_commit("dc", "msg2")
 
79
        repos_url = self.make_repository("a")
 
80
 
 
81
        dc = self.get_commit_editor(repos_url)
 
82
        dc.add_file("bar").modify()
 
83
        dc.close()
75
84
 
76
85
        branch = Branch.open(repos_url)
77
86