/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/frontend/gtk/handler.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-05 01:20:15 UTC
  • mto: (0.8.83 merge)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060905012015-afc711bf6c67e963
Integrate olive.backend.init

Show diffs side-by-side

added added

removed removed

Lines of Context:
165
165
    
166
166
    def on_menuitem_branch_initialize_activate(self, widget):
167
167
        """ Initialize current directory. """
168
 
        import olive.backend.init as init
169
 
        
170
168
        try:
171
 
            init.init(self.comm.get_path())
 
169
            location = self.comm.get_path()
 
170
            from bzrlib.builtins import get_format_type
 
171
 
 
172
            format = get_format_type('default')
 
173
 
 
174
            if not os.path.exists(location):
 
175
                os.mkdir(location)
 
176
     
 
177
            try:
 
178
                existing_bzrdir = bzrdir.BzrDir.open(location)
 
179
            except NotBranchError:
 
180
                bzrdir.BzrDir.create_branch_convenience(location, format=format)
 
181
            else:
 
182
                if existing_bzrdir.has_branch():
 
183
                    if existing_bzrdir.has_workingtree():
 
184
                        raise AlreadyBranchError(location)
 
185
                    else:
 
186
                        raise BranchExistsWithoutWorkingTree(location)
 
187
                else:
 
188
                    existing_bzrdir.create_branch()
 
189
                    existing_bzrdir.create_workingtree()
172
190
        except errors.AlreadyBranchError, errmsg:
173
191
            self.dialog.error_dialog(_('Directory is already a branch'),
174
192
                                     _('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
175
193
        except errors.BranchExistsWithoutWorkingTree, errmsg:
176
194
            self.dialog.error_dialog(_('Branch without a working tree'),
177
195
                                     _('The current directory (%s)\nis a branch without a working tree.') % errmsg)
178
 
        except:
179
 
            raise
180
196
        else:
181
 
            self.dialog.info_dialog(_('Ininialize successful'),
 
197
            self.dialog.info_dialog(_('Initialize successful'),
182
198
                                    _('Directory successfully initialized.'))
183
199
            self.comm.refresh_right()
184
200