161
164
destination = self._filechooser.get_filename()
162
if self._button_revision.get_label() != 'N/A':
163
166
revno = int(self._entry_revision.get_text())
168
br_from = Branch.open(location)
169
except errors.NotBranchError:
170
error_dialog(_('Location is not a branch'),
171
_('The specified location has to be a branch.'))
174
if e.errno == errno.ENOENT:
175
error_dialog(_('Non existing source'),
176
_("The location (%s)\ndoesn't exist.") % location)
170
br_from = Branch.open(location)
178
172
br_from.lock_read()
180
174
from bzrlib.transport import get_transport
183
revision_id = br_from.get_rev_id(revno)
184
except errors.NoSuchRevision:
185
error_dialog(_('No such revision'),
186
_("The revision you specified doesn't exist."))
176
revision_id = br_from.get_rev_id(revno)
191
180
to_location = destination + '/' + os.path.basename(location.rstrip("/\\"))
192
181
to_transport = get_transport(to_location)
195
to_transport.mkdir('.')
196
except errors.FileExists:
197
error_dialog(_('Target already exists'),
198
_("Target directory (%s)\nalready exists. Please select another target.") % location)
200
except errors.NoSuchFile:
201
error_dialog(_('Non existing parent directory'),
202
_("The parent directory of %s\ndoesn't exist.") % location)
183
to_transport.mkdir('.')
206
186
# preserve whatever source format we have.
211
191
revs = branch.revno()
212
192
except errors.NoSuchRevision:
213
193
to_transport.delete_tree('.')
214
error_dialog(_('Non existing revision'),
215
_("The branch has no revision %s.") % revision[0])