/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: Jelmer Vernooij
  • Date: 2006-09-27 20:30:59 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927203059-85792ae0a81db524
Bunch of small fixes, cleanups and simplifications.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
import gtk.glade
27
27
 
28
28
import bzrlib.errors as errors
29
 
from olive import gladefile
 
29
from __init__ import gladefile
30
30
 
31
31
class OliveBranch:
32
32
    """ Display branch dialog and perform the needed operations. """
33
 
    def __init__(self, comm):
 
33
    def __init__(self, path=None):
34
34
        """ Initialize the Branch dialog. """
35
35
        self.glade = gtk.glade.XML(gladefile, 'window_branch', 'olive-gtk')
36
 
        
37
 
        # Communication object
38
 
        self.comm = comm
39
 
        
 
36
 
40
37
        self.window = self.glade.get_widget('window_branch')
41
38
        
42
39
        # Dictionary for signal_autoconnect
48
45
        
49
46
        # Save FileChooser state
50
47
        self.filechooser = self.glade.get_widget('filechooserbutton_branch')
51
 
        self.filechooser.set_filename(self.comm.get_path())
 
48
        if path is not None:
 
49
            self.filechooser.set_filename(path)
52
50
 
53
51
    def display(self):
54
52
        """ Display the Branch dialog. """
68
66
        revno = spinbutton_revno.get_value_as_int()
69
67
        revision_id = br_from.get_rev_id(revno)
70
68
        
71
 
        self.comm.set_busy(self.window)
72
69
        try:
73
70
            from bzrlib.transport import get_transport
74
71
 
75
72
            br_from = Branch.open(location)
76
 
 
77
73
            br_from.lock_read()
78
74
 
79
75
            try:
80
76
                destination = destination + '/' + os.path.basename(location.rstrip("/\\"))
81
77
                to_transport = get_transport(destination)
82
 
 
83
78
                to_transport.mkdir('.')
84
79
 
85
80
                try:
94
89
                
95
90
            self.close()
96
91
            info_dialog(_('Branching successful'),
97
 
                                _('%d revision(s) branched.') % revs)
98
 
            self.comm.refresh_right()
 
92
                        _('%d revision(s) branched.') % revs)
99
93
        except errors.NonExistingSource, errmsg:
100
94
            error_dialog(_('Non existing source'),
101
95
                                     _("The location (%s)\ndoesn't exist.") % errmsg)
102
 
            self.comm.set_busy(self.window, False)
103
96
            return
104
97
        except errors.TargetAlreadyExists, errmsg:
105
98
            error_dialog(_('Target already exists'),
106
99
                                     _('Target directory (%s)\nalready exists. Please select another target.') % errmsg)
107
 
            self.comm.set_busy(self.window, False)
108
100
            return
109
101
        except errors.NonExistingParent, errmsg:
110
102
            error_dialog(_('Non existing parent directory'),
111
103
                                     _("The parent directory (%s)\ndoesn't exist.") % errmsg)
112
 
            self.comm.set_busy(self.window, False)
113
104
            return
114
105
        except errors.NonExistingRevision:
115
106
            error_dialog(_('Non existing revision'),
116
107
                                     _("The revision you specified doesn't exist."))
117
 
            self.comm.set_busy(self.window, False)
118
108
            return
119
109
        except errors.NotBranchError, errmsg:
120
110
            error_dialog(_('Location is not a branch'),
121
111
                                     _('The specified location has to be a branch.'))
122
 
            self.comm.set_busy(self.window, False)
123
112
            return
124
113
        
125
114