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