/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/branch.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2007-01-31 23:52:50 UTC
  • mto: (157.1.2 trunk) (170.1.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 141.
  • Revision ID: szilveszter.farkas@gmail.com-20070131235250-diu8t5xjk4qizf14
Use the decorator in the Branch dialog code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import gtk
26
26
import gtk.glade
27
27
 
 
28
from errors import show_bzr_error
 
29
 
28
30
from bzrlib.branch import Branch
29
31
from bzrlib.config import GlobalConfig
30
32
import bzrlib.errors as errors
150
152
            
151
153
                revb.destroy()
152
154
    
 
155
    @show_bzr_error
153
156
    def _on_branch_clicked(self, button):
154
157
        """ Branch button clicked handler. """
155
158
        location = self._combo.get_child().get_text()
159
162
            return
160
163
        
161
164
        destination = self._filechooser.get_filename()
162
 
        if self._button_revision.get_label() != 'N/A':
 
165
        try:
163
166
            revno = int(self._entry_revision.get_text())
164
 
        else:
 
167
        except:
165
168
            revno = None
166
169
        
167
 
        try:
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.'))
172
 
            return
173
 
        except OSError, e:
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)
177
171
        
178
172
        br_from.lock_read()
179
173
        try:
180
174
            from bzrlib.transport import get_transport
181
175
 
182
 
            try:
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."))
187
 
                return
 
176
            revision_id = br_from.get_rev_id(revno)
188
177
 
189
178
            basis_dir = None
190
179
            
191
180
            to_location = destination + '/' + os.path.basename(location.rstrip("/\\"))
192
181
            to_transport = get_transport(to_location)
193
182
            
194
 
            try:
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)
199
 
                return
200
 
            except errors.NoSuchFile:
201
 
                error_dialog(_('Non existing parent directory'),
202
 
                             _("The parent directory of %s\ndoesn't exist.") % location)
203
 
                return
 
183
            to_transport.mkdir('.')
204
184
            
205
185
            try:
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])
216
 
                return
 
194
                raise
217
195
        finally:
218
196
            br_from.unlock()
219
197