/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to backend/update.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-07-08 17:36:59 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060708173659-8ab442681dadd8ea
2006-07-08  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * backend/errors.py: added some exceptions related to diff() and log()
    * backend/info.py: implemented log()
    * backend/info.py: diff() works well with revnos
    * added e-mail address to copyright header

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
2
2
# Some parts of the code are:
3
3
# Copyright (C) 2005, 2006 by Canonical Ltd
4
 
#
 
4
 
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
7
7
# the Free Software Foundation; either version 2 of the License, or
8
8
# (at your option) any later version.
9
 
#
 
9
 
10
10
# This program is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
# GNU General Public License for more details.
14
 
#
 
14
 
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
20
 
21
21
from bzrlib.workingtree import WorkingTree
22
22
 
23
 
from errors import ConnectionError, NoLocationKnown, NotBranchError
 
23
from errors import NoLocationKnown
24
24
 
25
25
def missing(branch, other_branch=None, reverse=False):
26
26
    """ Get the number of missing or extra revisions of local branch.
36
36
    import bzrlib
37
37
    from bzrlib.missing import find_unmerged
38
38
    
39
 
    try:
40
 
        local_branch = bzrlib.branch.Branch.open_containing(branch)[0]
41
 
    except errors.NotBranchError:
42
 
        raise NotBranchError(branch)
43
 
    except:
44
 
        raise
45
 
    
 
39
    local_branch = bzrlib.branch.Branch.open_containing(branch)[0]
46
40
    parent = local_branch.get_parent()
47
41
    if other_branch is None:
48
42
        other_branch = parent
49
43
        if other_branch is None:
50
44
            raise NoLocationKnown
51
 
    
52
 
    try:
53
 
        remote_branch = bzrlib.branch.Branch.open(other_branch)
54
 
    except errors.NotBranchError:
55
 
        raise NotBranchError(other_branch)
56
 
    except errors.ConnectionError:
57
 
        raise ConnectionError(other_branch)
58
 
    except:
59
 
        raise
60
 
    
 
45
    remote_branch = bzrlib.branch.Branch.open(other_branch)
61
46
    if remote_branch.base == local_branch.base:
62
47
        remote_branch = local_branch
63
48
    local_branch.lock_read()
114
99
    
115
100
    :return: number of revisions pulled
116
101
    """
117
 
    nobundle = False
118
 
    
119
102
    from bzrlib.branch import Branch
120
 
    try:
121
 
        from bzrlib.bundle import read_bundle_from_url
122
 
        from bzrlib.bundle.apply_bundle import install_bundle
123
 
    except ImportError:
124
 
        # no bundle support
125
 
        nobundle = True
 
103
    from bzrlib.bundle import read_bundle_from_url
 
104
    from bzrlib.bundle.apply_bundle import install_bundle
126
105
    
127
106
    try:
128
107
        tree_to = WorkingTree.open_containing(branch)[0]
129
108
        branch_to = tree_to.branch
130
109
    except errors.NoWorkingTree:
131
110
        tree_to = None
132
 
        try:
133
 
            branch_to = Branch.open_containing(branch)[0]
134
 
        except errors.NotBranchError:
135
 
            raise NotBranchError(location)
136
 
    except errors.NotBranchError:
137
 
        raise NotBranchError(location)
 
111
        branch_to = Branch.open_containing(branch)[0]
138
112
 
139
113
    reader = None
140
 
    if location is not None and not nobundle:
 
114
    if location is not None:
141
115
        try:
142
116
            reader = read_bundle_from_url(location)
143
117
        except errors.NotABundle:
150
124
        else:
151
125
            location = stored_loc
152
126
 
153
 
    if reader is not None and not nobundle:
 
127
    if reader is not None:
154
128
        install_bundle(branch_to.repository, reader)
155
129
        branch_from = branch_to
156
130
    else: