/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/checkout.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-30 10:21:43 UTC
  • Revision ID: jelmer@samba.org-20060930102143-c0ef64d6ca860c21
Merge some files from Olive and bzr-gtk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
import os
 
17
import sys
18
18
 
19
19
try:
20
20
    import pygtk
25
25
import gtk
26
26
import gtk.glade
27
27
 
28
 
from bzrlib.branch import Branch
29
 
import bzrlib.bzrdir as bzrdir
30
28
import bzrlib.errors as errors
31
 
import bzrlib.osutils
32
29
 
33
30
from olive import gladefile
34
 
from dialog import error_dialog
35
31
 
36
32
class OliveCheckout:
37
33
    """ Display checkout dialog and perform the needed operations. """
62
58
        location = entry_location.get_text()
63
59
        if location is '':
64
60
            error_dialog(_('Missing branch location'),
65
 
                         _('You must specify a branch location.'))
 
61
                                     _('You must specify a branch location.'))
66
62
            return
67
63
        
68
64
        destination = self.filechooser.get_filename()
69
65
        
70
66
        spinbutton_revno = self.glade.get_widget('spinbutton_checkout_revno')
71
67
        revno = spinbutton_revno.get_value_as_int()
 
68
        rev_id = source.get_rev_id(revno)
72
69
        
73
70
        checkbutton_lightweight = self.glade.get_widget('checkbutton_checkout_lightweight')
74
71
        lightweight = checkbutton_lightweight.get_active()
75
72
        
76
73
        try:
77
74
            source = Branch.open(location)
78
 
            rev_id = source.get_rev_id(revno)
79
75
            
80
76
            # if the source and destination are the same, 
81
77
            # and there is no working tree,
84
80
                bzrlib.osutils.abspath(location)):
85
81
                try:
86
82
                    source.bzrdir.open_workingtree()
87
 
                except errors.NoWorkingTree:
 
83
                except NoWorkingTree:
88
84
                    source.bzrdir.create_workingtree()
89
85
                    return
90
86
 
93
89
            os.mkdir(destination)
94
90
 
95
91
            old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
96
 
            bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
 
92
            bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrdir.BzrDirMetaFormat1())
97
93
 
98
94
            try:
99
95
                if lightweight:
113
109
                bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
114
110
        except errors.NotBranchError, errmsg:
115
111
            error_dialog(_('Location is not a branch'),
116
 
                         _('The specified location has to be a branch.'))
 
112
                                     _('The specified location has to be a branch.'))
117
113
            return
118
114
        except errors.TargetAlreadyExists, errmsg:
119
115
            error_dialog(_('Target already exists'),
120
 
                         _('Target directory (%s)\nalready exists. Please select another target.') % errmsg)
 
116
                                     _('Target directory (%s)\nalready exists. Please select another target.') % errmsg)
121
117
            return
122
118
        except errors.NonExistingParent, errmsg:
123
119
            error_dialog(_('Non existing parent directory'),
124
 
                         _("The parent directory (%s)\ndoesn't exist.") % errmsg)
 
120
                                     _("The parent directory (%s)\ndoesn't exist.") % errmsg)
125
121
            return
126
122
        
127
123
        self.close()