/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-27 21:05:19 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927210519-7bc2662211808af5
Bunch of other small updates, add more items to 
the TODO list.

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, branch):
 
35
    def __init__(self, comm):
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
        
39
42
        self.window = self.glade.get_widget('window_push')
40
 
 
41
 
        self.branch = branch
42
43
        
43
44
        # Dictionary for signal_autoconnect
44
45
        dic = { "on_button_push_push_clicked": self.push,
66
67
        self.check_remember.set_sensitive(0)
67
68
        self.check_create.set_sensitive(0)
68
69
        
69
 
        self.entry_stored.set_text(branch.get_push_location())
 
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
70
81
    
71
82
    def display(self):
72
83
        """ Display the Push dialog. """
73
 
        self.window.show()
74
 
        self.width, self.height = self.window.get_size()
 
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()
75
91
    
76
92
    def stored_toggled(self, widget):
77
93
        if widget.get_active():
101
117
        revs = 0
102
118
        if self.radio_stored.get_active():
103
119
            try:
104
 
                revs = do_push(self.branch,
 
120
                revs = do_push(self.comm.get_path(),
105
121
                               overwrite=self.check_overwrite.get_active())
106
122
            except errors.NotBranchError:
107
123
                error_dialog(_('Directory is not a branch'),
119
135
                return
120
136
            
121
137
            try:
122
 
                revs = do_push(self.branch, location,
 
138
                revs = do_push(self.comm.get_path(), location,
123
139
                               self.check_remember.get_active(),
124
140
                               self.check_overwrite.get_active(),
125
141
                               self.check_create.get_active())
241
257
    else:
242
258
        old_rh = br_to.revision_history()
243
259
        try:
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
 
 
 
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
    
255
272
    return count