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

Fix tests, split up InterGitNonGitRepository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 
 
17
"""Push implementation that simply prints message saying push is not supported."""
 
18
 
 
19
from bzrlib.repository import (
 
20
    InterRepository,
 
21
    )
 
22
 
 
23
from bzrlib.plugins.git.errors import (
 
24
    NoPushSupport,
 
25
    )
 
26
from bzrlib.plugins.git.repository import (
 
27
    GitRepository,
 
28
    GitRepositoryFormat,
 
29
    )
 
30
 
 
31
class InterToGitRepository(InterRepository):
 
32
    """InterRepository that copies into a Git repository."""
 
33
 
 
34
    _matching_repo_format = GitRepositoryFormat()
 
35
 
 
36
    @staticmethod
 
37
    def _get_repo_format_to_test():
 
38
        return None
 
39
 
 
40
    def copy_content(self, revision_id=None, pb=None):
 
41
        """See InterRepository.copy_content."""
 
42
        self.fetch(revision_id, pb, find_ghosts=False)
 
43
 
 
44
    def fetch(self, revision_id=None, pb=None, find_ghosts=False, 
 
45
            fetch_spec=None):
 
46
        raise NoPushSupport()
 
47
 
 
48
    @staticmethod
 
49
    def is_compatible(source, target):
 
50
        """Be compatible with GitRepository."""
 
51
        return (not isinstance(source, GitRepository) and 
 
52
                isinstance(target, GitRepository))