Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

commit: special dialog for dealing with branches and merges

When merging, you can only pick the branch name of one of the two
parent revisions (it's the only sane thing to do), so we make this
more convenient. The dialog is disabled entirely if the two merged
changes are on the same branch.

Changeset 35b6a45d0593

Parent 5c943b16734a

by Steve Borho

Changes to one file · Browse files at 35b6a45d0593 Showing diff from parent 5c943b16734a Diff from another changeset...

Change 1 of 4 Show Entire File hggtk/​commit.py Stacked
 
26
27
28
29
 
30
31
32
33
34
35
36
37
38
 
 
 
 
 
 
 
 
 
 
 
 
39
40
41
 
89
90
91
 
 
 
 
 
 
92
93
94
 
202
203
204
205
 
 
 
 
 
206
207
208
 
222
223
224
 
 
 
 
225
226
227
 
26
27
28
 
29
30
31
32
33
 
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
100
101
102
103
104
105
106
107
108
109
110
111
 
219
220
221
 
222
223
224
225
226
227
228
229
 
243
244
245
246
247
248
249
250
251
252
@@ -26,16 +26,27 @@
 from hggtk import gtklib, thgconfig, gdialog, hgcmd    class BranchOperationDialog(gtk.Dialog): - def __init__(self, branch, close): + def __init__(self, branch, close, mergebranches):   gtk.Dialog.__init__(self, parent=None, flags=gtk.DIALOG_MODAL,   buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,   gtk.STOCK_OK, gtk.RESPONSE_OK))   gtklib.set_tortoise_keys(self) - self.connect('response', self.response)   self.set_title(_('Branch Operations'))   self.newbranch = None   self.closebranch = False   + if mergebranches: + lbl = gtk.Label(_('Select branch of merge commit')) + branchcombo = gtk.combo_box_new_text() + for name in mergebranches: + branchcombo.append_text(name) + self.vbox.pack_start(lbl, True, True, 2) + self.vbox.pack_start(branchcombo, True, True, 2) + self.connect('response', self.merge_response, branchcombo) + self.show_all() + return + + self.connect('response', self.response)   lbl = gtk.Label(_('Changes take effect on next commit'))   nochanges = gtk.RadioButton(None, _('No branch changes'))   self.newbranchradio = gtk.RadioButton(nochanges, @@ -89,6 +100,12 @@
  self.closebranch = False   self.destroy()   + def merge_response(self, widget, response_id, combo): + self.closebranch = False + if response_id == gtk.RESPONSE_OK: + self.newbranch = combo.get_model()[combo.get_active()][0] + self.destroy() +    class GCommit(GStatus):   """GTK+ based dialog for displaying repository status and committing @@ -202,7 +219,11 @@
  liststore.append([sumline, msg])     def branch_clicked(self, button): - dialog = BranchOperationDialog(self.nextbranch, self.closebranch) + if self.merging: + mb = [p.branch() for p in self.repo.parents()] + else: + mb = None + dialog = BranchOperationDialog(self.nextbranch, self.closebranch, mb)   dialog.run()   self.nextbranch = None   self.closebranch = False @@ -222,6 +243,10 @@
  self.branchbutton = gtk.Button()   self.branchbutton.connect('clicked', self.branch_clicked)   mbox.pack_start(self.branchbutton, False, False, 2) + if self.merging: + branches = [p.branch() for p in self.repo.parents()] + if branches[0] == branches[1]: + self.branchbutton.set_sensitive(False)     if hasattr(self.repo, 'mq'):   label = gtk.Label('QNew: ')