54
57
if os.path.exists(docuri):
55
58
if not self._get_is_active_branch(docuri):
56
59
docpath = os.path.dirname(docuri)
57
code, newdocpath = self._bzrInputDialog(docpath,"<big><b>Select path to INIT</b></big>","Choose which is the path where you want to create this bzr")
60
code, newdocpath = self._bzrInputDialog(docpath,"Select path to INIT","Choose which is the path where you want to create this bzr")
59
62
if code == gtk.RESPONSE_OK and newdocpath != '' and os.path.exists(newdocpath) and os.path.isdir(newdocpath) and not self._get_is_active_branch(docuri):
60
63
self._bzr_init_wt(newdocpath)
108
113
print "error, please enter a local path" # FIXME: ERROR MESSAGE
116
def on_bazaar_commit(self,menu):
117
doc = self._window.get_active_document()
119
print "error, you need to do this from a saved document" # FIXME: ERROR MESSAGE
121
docuri = doc.get_uri_for_display() # FIXME: is this the right one? or should i clean up get_uri?
122
if os.path.exists(docuri):
123
localpath = os.path.dirname(docuri)
125
wt,realpath = workingtree.WorkingTree.open_containing(localpath)
127
print "error, can't commit: %s" % sys.exc_value
129
#let's show our "let's commit dialog!"
130
response, comment = self._bzrComitDialog(wt.basedir)
131
if response == gtk.RESPONSE_OK:
135
print "error, can't commit: %s" % sys.exc_value
137
print "commit ok!" # FIXME: say something to user!!!
140
print "error, folder doesn't exists. THAT'S WEIRD!!!" # FIXME: ERROR MESSAGE
143
def on_bazaar_add(self,menu):
144
doc = self._window.get_active_document()
146
print "error, you need to do this from a saved document" # FIXME: ERROR MESSAGE
148
docuri = doc.get_uri_for_display() # FIXME: is this the right one? or should i clean up get_uri?
149
if os.path.exists(docuri):
150
localpath = os.path.dirname(docuri)
152
wt,realpath = workingtree.WorkingTree.open_containing(localpath)
154
print "error, can't add: %s" % sys.exc_value
156
ret = wt.smart_add([wt.basedir])
158
print "error, file doesn't exists!"
161
def on_bazaar_push(self,menu):
162
doc = self._window.get_active_document()
164
print "error, you need to do this from a saved document" # FIXME: ERROR MESSAGE
166
docuri = doc.get_uri_for_display() # FIXME: is this the right one? or should i clean up get_uri?
167
if os.path.exists(docuri):
168
localpath = os.path.dirname(docuri)
170
br,realpath = branch.Branch.open_containing(localpath)
172
print "error, can't push: %s" % sys.exc_value # FIXME: error message
174
pushloc = br.get_push_location()
177
response, pushlocation = self._bzrInputDialog(pushloc,"Push your changes", "Enter the location where you want to push your branch","Push")
178
if response == gtk.RESPONSE_OK and pushlocation != '':
180
branch_dest = branch.Branch.open(pushlocation)
182
print "error opening destination branch: %s" % sys.exc_value # FIXME: error message
184
res = br.push(branch_dest)
185
print "pushed!" # FIXME: say something to user!
187
elif pushlocation == '':
188
print "error, you have to enter a push location" # FIXME: error message
190
#ret = wt.smart_add([wt.basedir])
192
print "error, file doesn't exists!"
111
195
def _bzr_init_wt(self,path):
112
196
print "bazaar, inniting %s" % path
113
197
wt = bzrlib.bzrdir.BzrDir.create_standalone_workingtree(path)
151
235
None, _("Branch from..."),
152
236
self.on_bazaar_branchfrom)])
154
self._action_group.add_actions([("BazaarComit", None, _("Update"),
156
self.on_clear_document_activate)])
238
self._action_group.add_actions([("BazaarComit", None, _("Commit"),
240
self.on_bazaar_commit)])
241
self._action_group.add_actions([("BazaarAddAll", None, _("Add all..."),
242
None, _("Add all..."),
243
self.on_bazaar_add)])
244
self._action_group.add_actions([("BazaarPush", None, _("Push to..."),
245
None, _("Push to..."),
246
self.on_bazaar_push)])
157
250
self._action_group.add_actions([("BazaarUpdate", None, _("Bazaar"),
158
251
None, _("Bazaar"),
412
def _bzrComitDialog(self,path):
413
d = gtk.Dialog("Commit",None)
415
d.vbox.pack_start(hbox)
416
d.vbox.set_spacing(2)
418
img.set_from_stock(gtk.STOCK_DIALOG_QUESTION,gtk.ICON_SIZE_DIALOG)
423
hbox.pack_start(vbox)
425
lbltit = gtk.Label("<big><b>Commit changes in %s.</b></big>" % path)
426
lbltit.set_padding(0,10)
427
lbltit.set_use_markup(True)
428
lbltit.set_alignment(0,0)
429
vbox.pack_start(lbltit)
430
lbl = gtk.Label("Please enter a comment for your commit")#"Choose which is the path where you want to create this bzr")
431
lbl.set_alignment(0,0)
433
scrollw = gtk.ScrolledWindow()
434
textview = gtk.TextView()
435
#textview.set_size_request(-1,100)
436
scrollw.add(textview)
437
scrollw.set_policy(gtk.POLICY_NEVER,gtk.POLICY_AUTOMATIC)
440
vbox.pack_start(frame)
442
d.add_buttons(gtk.STOCK_CANCEL,gtk.RESPONSE_REJECT,gtk.STOCK_OK,gtk.RESPONSE_OK)
444
buf = textview.get_buffer()
445
bounds = buf.get_bounds()
446
mytext = buf.get_text(bounds[0],bounds[1])
319
450
class BazaarPlugin(gedit.Plugin):
320
451
def __init__(self):
321
452
gedit.Plugin.__init__(self)