73
74
def on_menuitem_branch_missing_revisions_activate(self, widget):
74
75
""" Branch/Missing revisions menu handler. """
75
import olive.backend.update as update
77
77
self.comm.set_busy(self.comm.window_main)
80
ret = update.missing(self.comm.get_path())
81
except errors.NotBranchError:
82
self.dialog.error_dialog(_('Directory is not a branch'),
83
_('You can perform this action only in a branch.'))
84
except errors.ConnectionError:
85
self.dialog.error_dialog(_('Connection error'),
86
_('Cannot connect to remote location.\nPlease try again later.'))
87
except errors.NoLocationKnown:
88
self.dialog.error_dialog(_('Parent location is unknown'),
89
_('Cannot determine missing revisions if no parent location is known.'))
83
local_branch = Branch.open_containing(self.comm.get_path())[0]
84
except NotBranchError:
85
self.dialog.error_dialog(_('Directory is not a branch'),
86
_('You can perform this action only in a branch.'))
89
other_branch = local_branch.get_parent()
90
if other_branch is None:
91
self.dialog.error_dialog(_('Parent location is unknown'),
92
_('Cannot determine missing revisions if no parent location is known.'))
95
remote_branch = Branch.open(other_branch)
97
if remote_branch.base == local_branch.base:
98
remote_branch = local_branch
100
ret = len(local_branch.missing_revisions(remote_branch))
92
103
self.dialog.info_dialog(_('There are missing revisions'),
93
104
_('%d revision(s) missing.') % ret)
95
106
self.dialog.info_dialog(_('Local branch up to date'),
96
107
_('There are no missing revisions.'))
98
self.comm.set_busy(self.comm.window_main, False)
109
self.comm.set_busy(self.comm.window_main, False)
100
111
def on_menuitem_branch_pull_activate(self, widget):
101
112
""" Branch/Pull menu handler. """
102
import olive.backend.update as update
104
114
self.comm.set_busy(self.comm.window_main)
107
ret = update.pull(self.comm.get_path())
108
except errors.NotBranchError:
109
self.dialog.error_dialog(_('Directory is not a branch'),
110
_('You can perform this action only in a branch.'))
111
except errors.NoLocationKnown:
112
self.dialog.error_dialog(_('Parent location is unknown'),
113
_('Pulling is not possible until there is no parent location.'))
118
tree_to = WorkingTree.open_containing(self.comm.get_path())[0]
119
branch_to = tree_to.branch
120
except NoWorkingTree:
122
branch_to = Branch.open_containing(self.comm.get_path())[0]
123
except NoBranchError:
124
self.dialog.error_dialog(_('Directory is not a branch'),
125
_('You can perform this action only in a branch.'))
127
location = branch_to.get_parent()
129
self.dialog.error_dialog(_('Parent location is unknown'),
130
_('Pulling is not possible until there is a parent location.'))
134
branch_from = Branch.open(location)
135
except errors.NotBranchError:
136
self.dialog.error_dialog(_('Directory is not a branch'),
137
_('You can perform this action only in a branch.'))
139
if branch_to.get_parent() is None:
140
branch_to.set_parent(branch_from.base)
142
old_rh = branch_to.revision_history()
143
if tree_to is not None:
144
tree_to.pull(branch_from, overwrite)
146
branch_to.pull(branch_from, overwrite)
115
148
self.dialog.info_dialog(_('Pull successful'),
116
149
_('%d revision(s) pulled.') % ret)
118
self.comm.set_busy(self.comm.window_main, False)
152
self.comm.set_busy(self.comm.window_main, False)
120
154
def on_menuitem_branch_push_activate(self, widget):
121
155
""" Branch/Push... menu handler. """