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

mq: support the qup extension

Allows making an unapplied patch the next in the series.

Changeset 9ea3e9ac237d

Parent f0acd74b033f

by Wagner Bruna

Changes to one file · Browse files at 9ea3e9ac237d Showing diff from parent f0acd74b033f Diff from another changeset...

 
10
11
12
 
 
13
14
15
 
77
78
79
 
 
 
 
 
 
80
81
82
 
371
372
373
 
 
 
 
 
 
 
 
 
 
 
374
375
376
 
383
384
385
 
 
 
 
 
 
386
387
388
 
498
499
500
 
501
502
503
 
510
511
512
 
 
513
514
515
 
667
668
669
 
 
 
 
10
11
12
13
14
15
16
17
 
79
80
81
82
83
84
85
86
87
88
89
90
 
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
 
402
403
404
405
406
407
408
409
410
411
412
413
 
523
524
525
526
527
528
529
 
536
537
538
539
540
541
542
543
 
695
696
697
698
699
700
@@ -10,6 +10,8 @@
 import gobject  import pango   +from mercurial import extensions +  from tortoisehg.util.i18n import _  from tortoisehg.util import hglib   @@ -77,6 +79,12 @@
  self.repo = repo   self.mqloaded = hasattr(repo, 'mq')   + try: + extensions.find('qup') + self.hasqup = True + except KeyError: + self.hasqup = False +   # top toolbar   tbar = gtklib.SlimToolbar(tooltips)   @@ -371,6 +379,17 @@
  cmdline = ['hg', 'qfold', patch]   self.cmd.execute(cmdline, self.cmd_done)   + def mknext(self, patch): + """ + [MQ] Execute 'qup patch' + + patch: the patch name or an index to specify the patch. + """ + if not (self.hasqup and patch and self.is_operable()): + return + cmdline = ['hg', 'qup', patch] + self.cmd.execute(cmdline, self.cmd_done) +   def has_patch(self):   """ return True if MQ has applicable patch """   if self.mqloaded: @@ -383,6 +402,12 @@
  return len(self.repo.mq.applied) > 0   return False   + def number_applied(self): + """ return the number of applied patches """ + if self.mqloaded: + return len(self.repo.mq.applied) + return 0 +   def is_operable(self):   """ return True if MQ is operable """   if self.mqloaded: @@ -498,6 +523,7 @@
  is_qtip = self.is_qtip(row[MQ_NAME])   is_qparent = row[MQ_INDEX] == INDEX_QPARENT   is_applied = row[MQ_STATUS] == 'A' + is_next = row[MQ_INDEX] == self.number_applied()     if is_operable and not is_qtip and (not is_qparent or has_applied):   append(_('_goto'), self.goto_activated) @@ -510,6 +536,8 @@
  append(_('delete --keep'), self.delete_keep_activated)   if has_applied and not is_qparent:   append(_('f_old'), self.fold_activated) + if self.hasqup and not is_next: + append(_('make it _next'), self.mknext_activated)     if len(menu.get_children()) > 0:   menu.show_all() @@ -667,3 +695,6 @@
    def fold_activated(self, menuitem, row):   self.qfold(row[MQ_NAME]) + + def mknext_activated(self, menuitem, row): + self.mknext(row[MQ_NAME])