Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7, 0.7.1, and 0.7.2

commit: partial support for qrefresh

* Detect applied patch, place qheader in commit message
* Change Commit button label to QRefresh
* Allow dialog to exit if qheader is not changed
* Call qrefresh instead of commit, do not use file list

This is not the perfect, but it at least works. I don't want to do more than this
inside the commit dialog. For better MQ support we need a dedicated app for it.
I'm not sure it's a feature that needs our highest priority.

Changeset b02edd30a9a5

Parent ae4759a7254b

by Steve Borho

Changes to one file · Browse files at b02edd30a9a5 Showing diff from parent ae4759a7254b Diff from another changeset...

Change 1 of 5 Show Entire File hggtk/​commit.py Stacked
 
188
189
190
191
 
 
 
 
192
193
194
 
198
199
200
 
201
202
203
 
230
231
232
 
 
 
 
 
 
 
 
 
 
 
 
 
233
234
235
 
411
412
413
414
415
416
417
418
 
 
 
 
 
 
 
 
 
419
420
421
 
423
424
425
426
427
428
429
 
 
 
 
430
431
432
 
188
189
190
 
191
192
193
194
195
196
197
 
201
202
203
204
205
206
207
 
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
 
428
429
430
 
 
 
 
 
431
432
433
434
435
436
437
438
439
440
441
442
 
444
445
446
 
 
447
 
448
449
450
451
452
453
454
@@ -188,7 +188,10 @@
  # If there are more than a few character typed into the commit   # message, ask if the exit should continue.   live = False - if self.text.get_buffer().get_char_count() > 10: + buffer = self.text.get_buffer() + begin, end = buffer.get_bounds() + cur_msg = buffer.get_text(begin, end) + if buffer.get_char_count() > 10 and cur_msg != self.qheader:   dialog = Confirm('Exit', [], self, 'Discard commit message and exit?')   if dialog.run() == gtk.RESPONSE_NO:   live = True @@ -198,6 +201,7 @@
  def reload_status(self):   success = GStatus.reload_status(self)   self._check_merge() + self._check_patch_queue()   self._check_undo()   return success   @@ -230,6 +234,19 @@
  self.text.get_buffer().set_text('merge')     + def _check_patch_queue(self): + '''See if an MQ patch is applied, switch to qrefresh mode''' + self.qheader = None + if not hasattr(self.repo, 'mq'): return + if not self.repo.mq.applied: return + patch = self.repo.mq.lookup('qtip') + ph = self.repo.mq.readheaders(patch) + title = os.path.basename(self.repo.root) + ' qrefresh ' + patch + self.set_title(title) + self.qheader = '\n'.join(ph.message) + self.text.get_buffer().set_text(self.qheader) + self.get_toolbutton('_Commit').set_label('QRefresh') +   def _commit_clicked(self, toolbutton, data=None):   if not self._ready_message():   return True @@ -411,11 +428,15 @@
  # call the threaded CmdDialog to do the commit, so the the large commit   # won't get locked up by potential large commit. CmdDialog will also   # display the progress of the commit operation. - cmdline = ["hg", "commit", "--verbose", "--repository", self.repo.root] - if self.opts['addremove']: - cmdline += ['--addremove'] - cmdline += ['--message', fromutf(self.opts['message'])] - cmdline += [self.repo.wjoin(x) for x in files] + if self.qheader: + cmdline = ["hg", "qrefresh", "--verbose", "--repository", self.repo.root] + cmdline += ['--message', fromutf(self.opts['message'])] + else: + cmdline = ["hg", "commit", "--verbose", "--repository", self.repo.root] + if self.opts['addremove']: + cmdline += ['--addremove'] + cmdline += ['--message', fromutf(self.opts['message'])] + cmdline += [self.repo.wjoin(x) for x in files]   dialog = CmdDialog(cmdline, True)   dialog.set_transient_for(self)   dialog.run() @@ -423,10 +444,11 @@
    # refresh overlay icons and commit dialog   if dialog.return_code() == 0: - self.text.set_buffer(gtk.TextBuffer()) - self._update_recent_messages(self.opts['message'])   shell_notify([self.cwd] + files) - self._last_commit_id = self._get_tip_rev(True) + if not self.qheader: + self.text.set_buffer(gtk.TextBuffer()) + self._update_recent_messages(self.opts['message']) + self._last_commit_id = self._get_tip_rev(True)     def _get_tip_rev(self, refresh=False):   if refresh: