35
35
import bzrlib.errors as errors
36
36
from bzrlib.workingtree import WorkingTree
38
# Olive GTK UI version
39
__version__ = '0.14.0'
41
38
from dialog import error_dialog, info_dialog
39
from errors import show_bzr_error
42
40
from guifiles import GLADEFILENAME
44
42
# import this classes only once
278
276
info_dialog(_('Local branch up to date'),
279
277
_('There are no missing revisions.'))
281
280
def on_menuitem_branch_pull_activate(self, widget):
282
281
""" Branch/Pull menu handler. """
283
282
branch_to = self.wt.branch
288
287
_('Pulling is not possible until there is a parent location.'))
292
branch_from = Branch.open(location)
293
except errors.NotBranchError:
294
error_dialog(_('Directory is not a branch'),
295
_('You can perform this action only in a branch.'))
290
branch_from = Branch.open(location)
297
292
if branch_to.get_parent() is None:
298
293
branch_to.set_parent(branch_from.base)
318
313
status = OliveStatus(self.wt, self.wtpath)
321
317
def on_menuitem_branch_initialize_activate(self, widget):
322
318
""" Initialize current directory. """
323
319
import bzrlib.bzrdir as bzrdir
321
if not os.path.exists(self.path):
326
if not os.path.exists(self.path):
330
existing_bzrdir = bzrdir.BzrDir.open(self.path)
331
except errors.NotBranchError:
332
bzrdir.BzrDir.create_branch_convenience(self.path)
334
if existing_bzrdir.has_branch():
335
if existing_bzrdir.has_workingtree():
336
raise errors.AlreadyBranchError(self.path)
338
raise errors.BranchExistsWithoutWorkingTree(self.path)
325
existing_bzrdir = bzrdir.BzrDir.open(self.path)
326
except errors.NotBranchError:
327
bzrdir.BzrDir.create_branch_convenience(self.path)
329
if existing_bzrdir.has_branch():
330
if existing_bzrdir.has_workingtree():
331
raise errors.AlreadyBranchError(self.path)
340
existing_bzrdir.create_branch()
341
existing_bzrdir.create_workingtree()
342
except errors.AlreadyBranchError, errmsg:
343
error_dialog(_('Directory is already a branch'),
344
_('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
345
except errors.BranchExistsWithoutWorkingTree, errmsg:
346
error_dialog(_('Branch without a working tree'),
347
_('The current directory (%s)\nis a branch without a working tree.') % errmsg)
349
info_dialog(_('Initialize successful'),
350
_('Directory successfully initialized.'))
333
raise errors.BranchExistsWithoutWorkingTree(self.path)
335
existing_bzrdir.create_branch()
336
existing_bzrdir.create_workingtree()
337
info_dialog(_('Initialize successful'),
338
_('Directory successfully initialized.'))
353
341
def on_menuitem_file_annotate_activate(self, widget):
354
342
""" File/Annotate... menu handler. """