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

  • Committer: Jelmer Vernooij
  • Date: 2006-09-28 06:35:56 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060928063556-62ec354cb06ba38c
Update TODO
integrate the handle and communicator functions into a main class.

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
 
        
 
24
    
25
25
import gtk
26
26
import gtk.gdk
27
27
import gtk.glade
32
32
 
33
33
class OlivePush:
34
34
    """ Display Push dialog and perform the needed actions. """
35
 
    def __init__(self, comm):
 
35
    def __init__(self, branch):
36
36
        """ Initialize the Push dialog. """
37
37
        self.glade = gtk.glade.XML(gladefile, 'window_push')
38
38
        
39
 
        # Communication object
40
 
        self.comm = comm
41
 
        
42
39
        self.window = self.glade.get_widget('window_push')
 
40
 
 
41
        self.branch = branch
43
42
        
44
43
        # Dictionary for signal_autoconnect
45
44
        dic = { "on_button_push_push_clicked": self.push,
67
66
        self.check_remember.set_sensitive(0)
68
67
        self.check_create.set_sensitive(0)
69
68
        
70
 
        # Get stored location
71
 
        self.notbranch = False
72
 
        try:
73
 
            from bzrlib.branch import Branch
74
 
    
75
 
            branch = Branch.open_containing(self.comm.get_path())[0]
76
 
    
77
 
            self.entry_stored.set_text(branch.get_push_location())
78
 
        except errors.NotBranchError:
79
 
            self.notbranch = True
80
 
            return
 
69
        self.entry_stored.set_text(branch.get_push_location())
81
70
    
82
71
    def display(self):
83
72
        """ Display the Push dialog. """
84
 
        if self.notbranch:
85
 
            error_dialog(_('Directory is not a branch'),
86
 
                                     _('You can perform this action only in a branch.'))
87
 
            self.close()
88
 
        else:
89
 
            self.window.show()
90
 
            self.width, self.height = self.window.get_size()
 
73
        self.window.show()
 
74
        self.width, self.height = self.window.get_size()
91
75
    
92
76
    def stored_toggled(self, widget):
93
77
        if widget.get_active():
117
101
        revs = 0
118
102
        if self.radio_stored.get_active():
119
103
            try:
120
 
                revs = do_push(self.comm.get_path(),
 
104
                revs = do_push(self.branch,
121
105
                               overwrite=self.check_overwrite.get_active())
122
106
            except errors.NotBranchError:
123
107
                error_dialog(_('Directory is not a branch'),
135
119
                return
136
120
            
137
121
            try:
138
 
                revs = do_push(self.comm.get_path(), location,
 
122
                revs = do_push(self.branch, location,
139
123
                               self.check_remember.get_active(),
140
124
                               self.check_overwrite.get_active(),
141
125
                               self.check_create.get_active())
257
241
    else:
258
242
        old_rh = br_to.revision_history()
259
243
        try:
260
 
            try:
261
 
                tree_to = dir_to.open_workingtree()
262
 
            except errors.NotLocalUrl:
263
 
                # FIXME - what to do here? how should we warn the user?
264
 
                #warning('This transport does not update the working '
265
 
                #        'tree of: %s' % (br_to.base,))
266
 
                count = br_to.pull(br_from, overwrite)
267
 
            except errors.NoWorkingTree:
268
 
                count = br_to.pull(br_from, overwrite)
269
 
            else:
270
 
                count = tree_to.pull(br_from, overwrite)
271
 
    
 
244
            tree_to = dir_to.open_workingtree()
 
245
        except errors.NotLocalUrl:
 
246
            # FIXME - what to do here? how should we warn the user?
 
247
            #warning('This transport does not update the working '
 
248
            #        'tree of: %s' % (br_to.base,))
 
249
            count = br_to.pull(br_from, overwrite)
 
250
        except errors.NoWorkingTree:
 
251
            count = br_to.pull(br_from, overwrite)
 
252
        else:
 
253
            count = tree_to.pull(br_from, overwrite)
 
254
 
272
255
    return count