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

status: detect MQ mode at refresh, make shelve aware of qdiffs

fixes #106. Cleaned up the refresh function while I was at it.

Changeset 0ff2308c8c18

Parent 31046bd49a17

by Steve Borho

Changes to 3 files · Browse files at 0ff2308c8c18 Showing diff from parent 31046bd49a17 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​commit.py Stacked
 
35
36
37
 
38
39
40
 
259
260
261
262
 
 
 
263
264
265
 
35
36
37
38
39
40
41
 
260
261
262
 
263
264
265
266
267
268
@@ -35,6 +35,7 @@
    def init(self):   GStatus.init(self) + self.mode = 'commit'   self._last_commit_id = None     def parse_opts(self): @@ -259,7 +260,9 @@
  '''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 + if not self.repo.mq.applied: + self.get_toolbutton('_Commit').set_label('_Commit') + return   patch = self.repo.mq.lookup('qtip')   ph = self.repo.mq.readheaders(patch)   title = os.path.basename(self.repo.root) + ' qrefresh ' + patch
Change 1 of 6 Show Entire File hggtk/​status.py Stacked
 
16
17
18
19
 
20
21
22
 
58
59
60
 
61
62
63
 
151
152
153
154
 
155
156
157
 
518
519
520
521
522
 
 
 
523
524
525
 
 
 
 
 
 
 
 
 
526
527
528
529
530
 
531
532
533
 
534
535
536
 
537
538
539
540
541
542
543
 
 
 
 
 
544
545
546
 
547
548
549
 
560
561
562
563
 
564
565
566
 
587
588
589
590
 
591
592
593
 
16
17
18
 
19
20
21
22
 
58
59
60
61
62
63
64
 
152
153
154
 
155
156
157
158
 
519
520
521
 
 
522
523
524
525
 
 
526
527
528
529
530
531
532
533
534
535
 
 
 
 
536
537
 
 
538
539
540
 
541
542
 
 
 
 
 
 
543
544
545
546
547
548
549
 
550
551
552
553
 
564
565
566
 
567
568
569
570
 
591
592
593
 
594
595
596
597
@@ -16,7 +16,7 @@
 import pango    from mercurial.i18n import _ -from mercurial import cmdutil, util, ui, hg, commands, patch, mdiff +from mercurial import cmdutil, util, ui, hg, commands, patch, mdiff, extensions  from mercurial import merge as merge_  from shlib import shell_notify  from hglib import toutf, fromutf, rootpath, diffexpand @@ -58,6 +58,7 @@
    def init(self):   GDialog.init(self) + self.mode = 'status'     def auto_check(self):   if self.test_opt('check'): @@ -151,7 +152,7 @@
  if revs:   r = ':'.join(revs)   return ' '.join([root, 'status', r]) + ' '.join(self.pats) - elif self.mqmode and hasattr(self, 'text'): + elif self.mqmode and self.mode != 'status':   patch = self.repo.mq.lookup('qtip')   return root + ' applied MQ patch ' + patch   else: @@ -518,32 +519,35 @@
  ### End of overrides ###     def _do_reload_status(self): - """Clear out the existing ListStore model and reload it from the repository status. - Also recheck and reselect files that remain in the list. + """Clear out the existing ListStore model and reload it from the + repository status. Also recheck and reselect files that remain + in the list.   """ - self.repo.dirstate.invalidate() - self.repo.invalidate() + repo = self.repo + # TODO - SJB - just realloc the repository here + repo.dirstate.invalidate() + repo.invalidate() + if hasattr(repo, 'mq'): + mq = extensions.find('mq') + repo.mq = mq.queue(repo.ui, repo.join("")) + self.mqmode = repo.mq.applied + self.set_title(self.get_title())   - # The following code was copied from the status function in - # mercurial\commands.py and modified slightly to work here - - if self.mqmode and not self.opts.get('rev') and hasattr(self, 'text'): + if self.mqmode and self.mode != 'status':   # when a patch is applied, show diffs to parent of top patch - self._node1 = self.repo.lookup(-3) - self._node2 = None + n1, n2 = repo.lookup(-3), None   else:   # node2 is None (the working dir) when 0 or 1 rev is specificed - self._node1, self._node2 = cmdutil.revpair(self.repo, self.opts.get('rev')) + n1, n2 = cmdutil.revpair(repo, self.opts.get('rev'))   - matcher = cmdutil.match(self.repo, self.pats, self.opts) - status = [n for n in self.repo.status(node1=self._node1, node2=self._node2, - match=matcher, - ignored=self.test_opt('ignored'), - clean=self.test_opt('clean'), - unknown=self.test_opt('unknown'))] + matcher = cmdutil.match(repo, self.pats, self.opts) + status = repo.status(node1=n1, node2=n2, match=matcher, + ignored=self.test_opt('ignored'), + clean=self.test_opt('clean'), + unknown=self.test_opt('unknown'))     (modified, added, removed, deleted, unknown, ignored, clean) = status - self.modified = modified + self._node1, self._node2, self.modified = n1, n2, modified     changetypes = (('modified', 'M', modified),   ('added', 'A', added), @@ -560,7 +564,7 @@
  reselect = [model[path][FM_PATH] for path in paths]     # merge-state of files - ms = merge_.mergestate(self.repo) + ms = merge_.mergestate(repo)     # Load the new data into the tree's model   self.filetree.hide() @@ -587,7 +591,7 @@
  self._show_diff_hunks(files)     self.filetree.show() - if hasattr(self, 'text'): + if self.mode == 'commit':   self.text.grab_focus()   else:   self.filetree.grab_focus()
 
32
33
34
 
35
36
37
 
32
33
34
35
36
37
38
@@ -32,6 +32,7 @@
    def init(self):   GStatus.init(self) + self.mode = 'shelve'     def parse_opts(self):   GStatus.parse_opts(self)