Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

treemodel: cache current bookmark, tweak refresh

Changeset 9c7fc8e5e16b

Parent 8429bc48a9d7

by Steve Borho

Changes to one file · Browse files at 9c7fc8e5e16b Showing diff from parent 8429bc48a9d7 Diff from another changeset...

 
53
54
55
56
57
58
59
60
61
62
63
64
65
 
66
67
68
 
74
75
76
77
78
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
81
82
 
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
 
192
193
194
 
53
54
55
 
 
 
56
 
 
 
 
 
 
57
58
59
60
 
66
67
68
 
 
 
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 
178
179
180
 
 
 
 
 
 
 
 
 
 
 
 
 
181
182
183
184
185
186
 
187
188
189
190
@@ -53,16 +53,8 @@
  self.showgraph = opts['show-graph']   self.revisions = {}   self.graphdata = graphdata - self.set_author_color() - self.hidetags = self.repo.ui.config( - 'tortoisehg', 'hidetags', '').split()   self.wcparents, self.tagrevs, self.branchtags = [], [], {} - try: - self.tagrevs = [repo[r].rev() for t, r in repo.tagslist()] - self.branchtags = repo.branchtags() - self.wcparents = [x.rev() for x in repo.parents()] - except util.Abort: - pass + self.refresh()     def refresh(self):   repo = self.repo @@ -74,9 +66,26 @@
    hglib.invalidaterepo(repo)   - self.wcparents = [x.rev() for x in repo.parents()] - self.tagrevs = [repo[r].rev() for t, r in repo.tagslist()] - self.branchtags = repo.branchtags() + self.set_author_color() + self.hidetags = repo.ui.config('tortoisehg', 'hidetags', '').split() + + # Check if we're using bookmarks, and have the 'track.current' + # option set; if so, find what the 'current' bookmark is + self.curbookmark = None + bookmarks = None + try: + bookmarks = hglib.extensions.find('bookmarks') + except KeyError: + pass + if bookmarks: + if repo.ui.configbool('bookmarks', 'track.current'): + self.curbookmark = bookmarks.current(repo) + try: + self.wcparents = [x.rev() for x in repo.parents()] + self.tagrevs = [repo[r].rev() for t, r in repo.tagslist()] + self.branchtags = repo.branchtags() + except util.Abort: + pass   brevs = [repo[n].rev() for n in self.branchtags.values()]   allrevs = set(oldtags + oldparents + oldbranches +   brevs + self.wcparents + self.tagrevs) @@ -169,26 +178,13 @@
  summary = escape(hglib.toutf(summary))   node = ctx.node()   - # Check if we're using bookmarks, and have the - # 'track.current' option set; if so, - # find what the 'current' bookmark is - currentBookmark = None - bookmarks = None - try: - bookmarks = hglib.extensions.find('bookmarks') - except KeyError: - pass - if bookmarks: - if self.repo.ui.configbool('bookmarks', 'track.current'): - currentBookmark = bookmarks.current(self.repo) -   tags = self.repo.nodetags(node)   taglist = hglib.toutf(', '.join(tags))   tstr = ''   for tag in tags:   if tag not in self.hidetags:   style = {'color':'black', 'background':'#ffffaa'} - if tag == currentBookmark: + if tag == self.curbookmark:   style['background'] = '#ffcc99'   tstr += gtklib.markup(' %s ' % tag, **style) + ' '