72
71
spinbutton_revno = self.glade.get_widget('spinbutton_checkout_revno')
73
72
revno = spinbutton_revno.get_value_as_int()
73
rev_id = source.get_rev_id(revno)
77
75
checkbutton_lightweight = self.glade.get_widget('checkbutton_checkout_lightweight')
78
76
lightweight = checkbutton_lightweight.get_active()
80
78
self.comm.set_busy(self.window)
82
init.checkout(location, destination, revno, lightweight)
80
source = Branch.open(location)
82
# if the source and destination are the same,
83
# and there is no working tree,
84
# then reconstitute a branch
85
if (bzrlib.osutils.abspath(destination) ==
86
bzrlib.osutils.abspath(location)):
88
source.bzrdir.open_workingtree()
90
source.bzrdir.create_workingtree()
93
destination = destination + '/' + os.path.basename(location.rstrip("/\\"))
97
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
98
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
102
checkout = bzrdir.BzrDirMetaFormat1().initialize(destination)
103
bzrlib.branch.BranchReferenceFormat().initialize(checkout, source)
105
checkout_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience(
106
destination, force_new_tree=False)
107
checkout = checkout_branch.bzrdir
108
checkout_branch.bind(source)
109
if rev_id is not None:
110
rh = checkout_branch.revno_history()
111
checkout_branch.set_revno_history(rh[:rh.index(rev_id) + 1])
113
checkout.create_workingtree(rev_id)
115
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
83
116
except errors.NotBranchError, errmsg:
84
117
self.dialog.error_dialog(_('Location is not a branch'),
85
118
_('The specified location has to be a branch.'))