/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_push.py

  • Committer: John Arbash Meinel
  • Date: 2007-03-01 21:56:19 UTC
  • mto: (2255.7.84 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: john@arbash-meinel.com-20070301215619-wpt6kz8yem3ypu1b
Update to dirstate locking.
Move all of WT4.lock_* functions locally, so that they can
properly interact and cleanup around when we lock/unlock the
dirstate file.
Change all Lock objects to be non-blocking. So that if someone
grabs a lock on the DirState we find out immediately, rather
than blocking.
Change WT4.unlock() so that if the dirstate is dirty, it will
save the contents even if it only has a read lock.
It does this by trying to take a write lock, if it fails
we just ignore it. If it succeeds, then we can flush to disk.
This is more important now that DirState tracks file changes.
It allows 'bzr status' to update the cached stat and sha values.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
2
 
# -*- coding: 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
 
"""Tests for pushing revisions from Bazaar into Git."""
19
 
 
20
 
from bzrlib import (
21
 
    errors,
22
 
    )
23
 
from bzrlib.bzrdir import (
24
 
    format_registry,
25
 
    )
26
 
from bzrlib.repository import (
27
 
    InterRepository,
28
 
    )
29
 
from bzrlib.tests import (
30
 
    TestCaseWithTransport,
31
 
    )
32
 
 
33
 
from bzrlib.plugins.git.push import (
34
 
    InterToGitRepository,
35
 
    )
36
 
 
37
 
 
38
 
class InterToGitRepositoryTests(TestCaseWithTransport):
39
 
 
40
 
    def setUp(self):
41
 
        super(InterToGitRepositoryTests, self).setUp()
42
 
        self.git_repo = self.make_repository("git",
43
 
                format=format_registry.make_bzrdir("git"))
44
 
        self.bzr_repo = self.make_repository("bzr")
45
 
        self.bzr_repo.lock_read()
46
 
        self.addCleanup(self.bzr_repo.unlock)
47
 
        self.interrepo = InterRepository.get(self.bzr_repo, self.git_repo)
48
 
 
49
 
    def test_instance(self):
50
 
        self.assertIsInstance(self.interrepo, InterToGitRepository)
51
 
 
52
 
    def test_pointless_fetch_refs(self):
53
 
        old_refs, new_refs = self.interrepo.fetch_refs(lambda x: x)
54
 
        self.assertEquals(old_refs, new_refs)
55
 
 
56
 
    def test_pointless_dfetch_refs(self):
57
 
        revidmap, old_refs, new_refs = self.interrepo.dfetch_refs(lambda x: x)
58
 
        self.assertEquals(old_refs, new_refs)
59
 
        self.assertEquals(revidmap, {})
60
 
 
61
 
    def test_pointless_missing_revisions(self):
62
 
        self.assertEquals([], list(self.interrepo.missing_revisions([])))
63
 
 
64
 
    def test_missing_revisions_unknown_stop_rev(self):
65
 
        self.assertEquals([],
66
 
                list(self.interrepo.missing_revisions([(None, "unknown")])))