/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-10-01 01:56:17 UTC
  • mfrom: (0.8.98 merge)
  • Revision ID: jelmer@samba.org-20061001015617-9827cc403415cbf0
[merge] more changes from Szilveszter

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