28
28
import bzrlib.errors as errors
29
from olive import gladefile
29
from __init__ import gladefile
32
32
""" Display branch dialog and perform the needed operations. """
33
def __init__(self, comm):
33
def __init__(self, path=None):
34
34
""" Initialize the Branch dialog. """
35
35
self.glade = gtk.glade.XML(gladefile, 'window_branch', 'olive-gtk')
37
# Communication object
40
37
self.window = self.glade.get_widget('window_branch')
42
39
# Dictionary for signal_autoconnect
68
66
revno = spinbutton_revno.get_value_as_int()
69
67
revision_id = br_from.get_rev_id(revno)
71
self.comm.set_busy(self.window)
73
70
from bzrlib.transport import get_transport
75
72
br_from = Branch.open(location)
77
73
br_from.lock_read()
80
76
destination = destination + '/' + os.path.basename(location.rstrip("/\\"))
81
77
to_transport = get_transport(destination)
83
78
to_transport.mkdir('.')
96
91
info_dialog(_('Branching successful'),
97
_('%d revision(s) branched.') % revs)
98
self.comm.refresh_right()
92
_('%d revision(s) branched.') % revs)
99
93
except errors.NonExistingSource, errmsg:
100
94
error_dialog(_('Non existing source'),
101
95
_("The location (%s)\ndoesn't exist.") % errmsg)
102
self.comm.set_busy(self.window, False)
104
97
except errors.TargetAlreadyExists, errmsg:
105
98
error_dialog(_('Target already exists'),
106
99
_('Target directory (%s)\nalready exists. Please select another target.') % errmsg)
107
self.comm.set_busy(self.window, False)
109
101
except errors.NonExistingParent, errmsg:
110
102
error_dialog(_('Non existing parent directory'),
111
103
_("The parent directory (%s)\ndoesn't exist.") % errmsg)
112
self.comm.set_busy(self.window, False)
114
105
except errors.NonExistingRevision:
115
106
error_dialog(_('Non existing revision'),
116
107
_("The revision you specified doesn't exist."))
117
self.comm.set_busy(self.window, False)
119
109
except errors.NotBranchError, errmsg:
120
110
error_dialog(_('Location is not a branch'),
121
111
_('The specified location has to be a branch.'))
122
self.comm.set_busy(self.window, False)