Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

fogcreek Merge with stable

Changeset 657f21d0ebde

Parents fe5430688149

Parents 1117c57543f4

by David Golub

Changes to 18 files · Browse files at 657f21d0ebde Showing diff from parent fe5430688149 1117c57543f4 Diff from another changeset...

Change 1 of 1 Show Entire File .hgeol Stacked
 
 
 
 
 
 
 
 
1
2
3
4
5
6
@@ -0,0 +1,6 @@
+[patterns] +**.py = native +**.py.out = native + +[repository] +native = LF
Added image
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​bfprompt.py Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
@@ -0,0 +1,52 @@
+# bfprompt.py - prompt to add large files as bfiles +# +# Copyright 2011 Fog Creek Software +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +import os + +from mercurial import match +from tortoisehg.hgqt import qtlib +from tortoisehg.hgqt.i18n import _ + +class BfilesPrompt(qtlib.CustomPrompt): + def __init__(self, parent, files=None): + qtlib.CustomPrompt.__init__(self, _('Confirm Add'), + _('Some of the files that you have selected are of a size ' + 'over 10 MB. You may make more efficient use of disk space ' + 'by adding these files as bfiles, which will store only the ' + 'most recent revision of each file in your local repository, ' + 'with older revisions available on the server. Do you wish ' + 'to add these files as bfiles?'), parent, + (_('Add as &Bfiles'), _('Add as &Normal Files'), _('Cancel')), + 0, 2, files) + +def promptForBfiles(parent, ui, repo, files): + bfiles = [] + usekbf = os.path.exists(repo.wjoin('.kbf')) + minsize = int(ui.config('kilnbfiles', 'size', default='10')) + patterns = ui.config('kilnbfiles', 'patterns', default=()) + if patterns: + patterns = patterns.split(' ') + matcher = match.match(repo.root, '', list(patterns)) + else: + matcher = None + for wfile in files: + if not matcher or not matcher(wfile) or not usekbf: + filesize = os.path.getsize(repo.wjoin(wfile)) + if filesize >= 10*1024*1024 and (filesize < minsize*1024*1024 or not usekbf): + bfiles.append(wfile) + if bfiles: + ret = BfilesPrompt(parent, files).run() + if ret == 0: + # add as bfiles + for bfile in bfiles: + files.remove(bfile) + elif ret == 1: + # add as normal files + bfiles = [] + elif ret == 2: + return None + return files, bfiles
1
2
3
4
5
6
7
8
 
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
53
54
55
56
57
58
59
60
61
62
63
64
65
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
 
 
 
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
 
 
 
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
 
 
 
369
370
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
53
54
55
56
57
58
59
60
61
62
63
64
65
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
 # filedata.py - generate displayable file data  #  # Copyright 2011 Steve Borho <steve@borho.org>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.    import os +import re    from mercurial import error, match, patch, util, mdiff  from mercurial import ui as uimod    from tortoisehg.util import hglib, patchctx  from tortoisehg.hgqt.i18n import _    class FileData(object):   def __init__(self, ctx, ctx2, wfile, status=None):   self.contents = None   self.ucontents = None   self.error = None   self.olddata = None   self.diff = None   self.flabel = u''   self.elabel = u''   try:   self.readStatus(ctx, ctx2, wfile, status)   except (EnvironmentError, error.LookupError), e:   self.error = hglib.tounicode(str(e))     def checkMaxDiff(self, ctx, wfile, maxdiff=None):   p = _('File or diffs not displayed: ')   try:   fctx = ctx.filectx(wfile)   if ctx.rev() is None:   size = fctx.size()   else:   # fctx.size() can read all data into memory in rename cases so   # we read the size directly from the filelog, this is deeper   # under the API than I prefer to go, but seems necessary   size = fctx._filelog.rawsize(fctx.filerev())   except (EnvironmentError, error.LookupError), e:   self.error = p + hglib.tounicode(str(e))   return None   if size > maxdiff:   self.error = p + _('File is larger than the specified max size.\n'   'maxdiff = %s KB') % (maxdiff // 1024)   return None   try:   data = fctx.data() - if '\0' in data: + if '\0' in data or re.match(r'^\.kbf/', wfile):   self.error = p + _('File is binary.\n')   return None   except (EnvironmentError, util.Abort), e:   self.error = p + hglib.tounicode(str(e))   return None   return fctx, data     def isValid(self):   return self.error is None     def readStatus(self, ctx, ctx2, wfile, status):   def getstatus(repo, n1, n2, wfile):   m = match.exact(repo.root, repo.getcwd(), [wfile])   modified, added, removed = repo.status(n1, n2, match=m)[:3]   if wfile in modified:   return 'M'   if wfile in added:   return 'A'   if wfile in removed:   return 'R'   if wfile in ctx:   return 'C'   return None   + isbfile = False   repo = ctx._repo   self.flabel += u'<b>%s</b>' % hglib.tounicode(wfile)     if isinstance(ctx, patchctx.patchctx):   self.diff = ctx.thgmqpatchdata(wfile)   flags = ctx.flags(wfile)   if flags in ('x', '-'):   lbl = _("exec mode has been <font color='red'>%s</font>")   change = (flags == 'x') and _('set') or _('unset')   self.elabel = lbl % change   elif flags == 'l':   self.flabel += _(' <i>(is a symlink)</i>')   return     if ctx2:   # If a revision to compare to was provided, we must put it in   # the context of the subrepo as well   if ctx2._repo.root != ctx._repo.root:   wsub2, wfileinsub2, sctx2 = \   hglib.getDeepestSubrepoContainingFile(wfile, ctx2)   if wsub2:   ctx2 = sctx2     absfile = repo.wjoin(wfile)   if (wfile in ctx and 'l' in ctx.flags(wfile)) or \   os.path.islink(absfile):   if wfile in ctx:   data = ctx[wfile].data()   else:   data = os.readlink(absfile)   self.contents = data   self.flabel += _(' <i>(is a symlink)</i>')   return     if status is None:   status = getstatus(repo, ctx.p1().node(), ctx.node(), wfile)   if ctx2 is None:   ctx2 = ctx.p1()     if status == 'S':   try:   from mercurial import subrepo, commands     def genSubrepoRevChangedDescription(subrelpath, sfrom, sto, repo):   """Generate a subrepository revision change description"""   out = []   def getLog(_ui, srepo, opts):   _ui.pushbuffer()   try:   commands.log(_ui, srepo, **opts)   logOutput = _ui.popbuffer()   except error.ParseError, e:   # Some mercurial versions have a bug that results in   # saving a subrepo node id in the .hgsubstate file   # which ends with a "+" character. If that is the   # case, add a warning to the output, but try to   # get the revision information anyway   logOutput = ''   for n, rev in enumerate(opts['rev']):   if rev.endswith('+'):   logOutput += _('[WARNING] Invalid subrepo '   'revision ID:\n\t%s\n\n') % rev   opts['rev'][n] = rev[:-1]   commands.log(_ui, srepo, **opts)   logOutput += _ui.popbuffer()   return logOutput     opts = {'date':None, 'user':None, 'rev':[sfrom]}   subabspath = os.path.join(repo.root, subrelpath)   missingsub = not os.path.isdir(subabspath)   incompletesub = False   sfromlog = ''   def isinitialrevision(rev):   return all([el == '0' for el in rev])   if isinitialrevision(sfrom):   sfrom = ''   if isinitialrevision(sto):   sto = ''   if not sfrom and not sto:   sstatedesc = 'new'   out.append(_('Subrepo created and set to initial revision.') + u'\n\n')   return out, sstatedesc   elif not sfrom:   sstatedesc = 'new'   out.append(_('Subrepo initialized to revision:') + u'\n\n')   elif not sto:   sstatedesc = 'removed'   out.append(_('Subrepo removed from repository.') + u'\n\n')   return out, sstatedesc   elif sfrom == sto:   sstatedesc = 'unchanged'   out.append(_('Subrepo was not changed.') + u'\n\n')   out.append(_('Subrepo state is:') + u'\n\n')   if missingsub:   out.append(_('changeset: %s') % sfrom + u'\n')   else:   out.append(hglib.tounicode(getLog(_ui, srepo, opts)))   return out, sstatedesc   else:   sstatedesc = 'changed'     out.append(_('Revision has changed to:') + u'\n\n')     if missingsub:   sfromlog = _('changeset: %s') % sfrom + u'\n\n'   else:   sfromlog = hglib.tounicode(getLog(_ui, srepo, opts))   if not sfromlog:   incompletesub = True   sfromlog = _('changeset: %s') % sfrom + u'\n\n'   sfromlog = _('From:') + u'\n' + sfromlog     if missingsub:   stolog = _('changeset: %s') % sto + '\n\n'   sfromlog += _('Subrepository not found in the working '   'directory.') + '\n'   sfromlog += _('Further subrepository revision '   'information cannot be retrieved.') + '\n'   elif incompletesub:   stolog = _('changeset: %s') % sto + '\n\n'   sfromlog += _('Subrepository is either damaged or '   'missing some revisions') + '\n'   sfromlog += _('Further subrepository revision '   'information cannot be retrieved.') + '\n'   sfromlog += _('You may need to open the missing '   'subrepository and manually\n'   'pull the missing revisions from its '   'source repository.') + '\n'   else:   opts['rev'] = [sto]   stolog = getLog(_ui, srepo, opts)     if not stolog:   stolog = _('Initial revision') + u'\n'   out.append(hglib.tounicode(stolog))     if sfromlog:   out.append(hglib.tounicode(sfromlog))     return out, sstatedesc     srev = ctx.substate.get(wfile, subrepo.nullstate)[1]   srepo = None   try:   subabspath = os.path.join(ctx._repo.root, wfile)   if not os.path.isdir(subabspath):   sactual = ''   else:   sub = ctx.sub(wfile)   if isinstance(sub, subrepo.hgsubrepo):   srepo = sub._repo   sactual = srepo['.'].hex()   else:   self.error = _('Not a Mercurial subrepo, not previewable')   return   except (util.Abort), e:   sactual = ''     out = []   _ui = uimod.ui()     if srepo is None or ctx.rev() is not None:   data = []   else:   _ui.pushbuffer()   commands.status(_ui, srepo)   data = _ui.popbuffer()   if data:   out.append(_('File Status:') + u'\n')   out.append(hglib.tounicode(data))   out.append(u'\n')     sstatedesc = 'changed'   if ctx.rev() is not None:   sparent = ctx.p1().substate.get(wfile, subrepo.nullstate)[1]   subrepochange, sstatedesc = \   genSubrepoRevChangedDescription(wfile,   sparent, srev, ctx._repo)   out += subrepochange   else:   sstatedesc = 'dirty'   if srev != sactual:   subrepochange, sstatedesc = \   genSubrepoRevChangedDescription(wfile,   srev, sactual, ctx._repo)   out += subrepochange   if data:   sstatedesc += ' and dirty'   elif srev and not sactual:   sstatedesc = 'removed'   self.ucontents = u''.join(out).strip()     lbl = {   'changed': _('(is a changed sub-repository)'),   'unchanged': _('(is an unchanged sub-repository)'),   'dirty': _('(is a dirty sub-repository)'),   'new': _('(is a new sub-repository)'),   'removed': _('(is a removed sub-repository)'),   'changed and dirty': _('(is a changed and dirty sub-repository)'),   'new and dirty': _('(is a new and dirty sub-repository)')   }[sstatedesc]   self.flabel += ' <i>' + lbl + '</i>'   if sactual:   lbl = _(' <a href="subrepo:%s">open...</a>')   self.flabel += lbl % hglib.tounicode(srepo.root)   except (EnvironmentError, error.RepoError, util.Abort), e:   self.error = _('Error previewing subrepo: %s') % \   hglib.tounicode(str(e))   return     # TODO: elif check if a subdirectory (for manifest tool)     maxdiff = repo.maxdiff   mde = _('File or diffs not displayed: '   'File is larger than the specified max size.\n'   'maxdiff = %s KB') % (maxdiff // 1024)     if status in ('R', '!'):   if wfile in ctx.p1():   fctx = ctx.p1()[wfile]   if fctx._filelog.rawsize(fctx.filerev()) > maxdiff:   self.error = mde   else:   olddata = fctx.data()   if '\0' in olddata:   self.error = 'binary file'   else:   self.contents = olddata   self.flabel += _(' <i>(was deleted)</i>') + elif '.kbf/' + wfile in ctx.p1(): + self.error = 'binary file' + self.flabel += _(' <i>(was deleted)</i>')   else:   self.flabel += _(' <i>(was added, now missing)</i>')   return     if status in ('I', '?', 'C'):   if ctx.rev() is None:   if status in ('I', '?'):   self.flabel += _(' <i>(is unversioned)</i>')   if os.path.getsize(absfile) > maxdiff:   self.error = mde   return   else:   data = util.posixfile(absfile, 'r').read()   else:   data = ctx.filectx(wfile).data()   if '\0' in data:   self.error = 'binary file'   else:   self.contents = data   return     if status in ('M', 'A'): + if '.kbf/' + wfile in ctx: + wfile = '.kbf/' + wfile + isbfile = True   res = self.checkMaxDiff(ctx, wfile, maxdiff)   if res is None:   if status == 'A':   self.flabel += _(' <i>(was added)</i>')   return   fctx, newdata = res   self.contents = newdata   change = None   for pfctx in fctx.parents():   if 'x' in fctx.flags() and 'x' not in pfctx.flags():   change = _('set')   elif 'x' not in fctx.flags() and 'x' in pfctx.flags():   change = _('unset')   if change:   lbl = _("exec mode has been <font color='red'>%s</font>")   self.elabel = lbl % change     if status == 'A':   renamed = fctx.renamed()   if not renamed:   self.flabel += _(' <i>(was added)</i>')   return     oldname, node = renamed   fr = hglib.tounicode(oldname)   self.flabel += _(' <i>(renamed from %s)</i>') % fr   olddata = repo.filectx(oldname, fileid=node).data()   elif status == 'M':   if wfile not in ctx2:   # merge situation where file was added in other branch   self.flabel += _(' <i>(was added)</i>')   return   oldname = wfile   olddata = ctx2[wfile].data()   else:   return     self.olddata = olddata   newdate = util.datestr(ctx.date())   olddate = util.datestr(ctx2.date())   revs = [str(ctx), str(ctx2)]   diffopts = patch.diffopts(repo.ui, {})   diffopts.git = False + if isbfile: + olddata += '\0' + newdata += '\0'   self.diff = mdiff.unidiff(olddata, olddate, newdata, newdate,   oldname, wfile, revs, diffopts)
 
14
15
16
 
 
17
18
19
 
144
145
146
 
147
148
149
 
14
15
16
17
18
19
20
21
 
146
147
148
149
150
151
152
@@ -14,6 +14,8 @@
 # this program; if not, write to the Free Software Foundation, Inc.,  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.   +import re +  from tortoisehg.util import hglib, patchctx    from tortoisehg.hgqt.qtlib import geticon, getoverlaidicon @@ -144,6 +146,7 @@
  for lst, flag in ((added, 'A'), (modified, 'M'), (removed, 'R')):   for f in filter(func, lst):   wasmerged = ismerge and f in ctxfiles + f = re.sub(r'^\.kbf/', '', f)   files.append({'path': f, 'status': flag, 'parent': parent,   'wasmerged': wasmerged})   return files
 
472
473
474
 
 
475
476
477
 
472
473
474
475
476
477
478
479
@@ -472,6 +472,8 @@
  for wfile in ctx: # walk manifest   if self.canceled:   break + if re.match(r'^\.kbf/', wfile): + continue   self.progress.emit(topic, count, wfile, unit, total)   count += 1   if not matchfn(wfile):
 
9
10
11
 
12
13
14
 
251
252
253
 
 
 
254
255
256
 
258
259
260
261
 
262
263
264
 
9
10
11
12
13
14
15
 
252
253
254
255
256
257
258
259
260
 
262
263
264
 
265
266
267
268
@@ -9,6 +9,7 @@
 # version.    import os, itertools +import re    from PyQt4.QtCore import *  from PyQt4.QtGui import * @@ -251,6 +252,9 @@
  if not pathinstatus(path, status, uncleanpaths):   continue   + origpath = path + path = re.sub(r'^\.kbf/', '', path) +   e = treeroot   for p in hglib.tounicode(path).split('/'):   if not p in e: @@ -258,7 +262,7 @@
  e = e[p]     for st, filesofst in status.iteritems(): - if path in filesofst: + if origpath in filesofst:   e.setstatus(st)   break   else:
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​messageentry.py Stacked
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
53
54
55
56
57
58
59
60
61
62
63
64
65
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
53
54
55
56
57
58
59
60
61
62
63
64
65
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
@@ -1,145 +1,145 @@
-# messageentry.py - TortoiseHg's commit message editng widget -# -# Copyright 2011 Steve Borho <steve@borho.org> -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2, incorporated herein by reference. - -import os - -from PyQt4.QtCore import * -from PyQt4.QtGui import * -from PyQt4.Qsci import QsciScintilla, QsciLexerMakefile - -from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib, qscilib - -class MessageEntry(qscilib.Scintilla): - - def __init__(self, parent, getCheckedFunc=None): - super(MessageEntry, self).__init__(parent) - self.setEdgeColor(QColor('LightSalmon')) - self.setEdgeMode(QsciScintilla.EdgeLine) - self.setReadOnly(False) - self.setMarginWidth(1, 0) - self.setFont(qtlib.getfont('fontcomment').font()) - self.setCaretWidth(10) - self.setCaretLineBackgroundColor(QColor("#e6fff0")) - self.setCaretLineVisible(True) - self.setAutoIndent(True) - self.setAutoCompletionThreshold(2) - self.setAutoCompletionSource(QsciScintilla.AcsAPIs) - self.setAutoCompletionFillupsEnabled(True) - self.setLexer(QsciLexerMakefile(self)) - self.lexer().setFont(qtlib.getfont('fontcomment').font()) - self.lexer().setColor(QColor(Qt.red), QsciLexerMakefile.Error) - self.setMatchedBraceBackgroundColor(Qt.yellow) - self.setIndentationsUseTabs(False) - self.setBraceMatching(QsciScintilla.SloppyBraceMatch) - #self.setIndentationGuidesBackgroundColor(QColor("#e6e6de")) - #self.setFolding(QsciScintilla.BoxedFoldStyle) - # http://www.riverbankcomputing.com/pipermail/qscintilla/2009-February/000461.html - self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) - self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) - # default message entry widgets to word wrap, user may override - self.setWrapMode(QsciScintilla.WrapWord) - - self.getChecked = getCheckedFunc - self.setContextMenuPolicy(Qt.CustomContextMenu) - self.customContextMenuRequested.connect(self.menuRequested) - - def menuRequested(self, point): - line = self.lineAt(point) - point = self.viewport().mapToGlobal(point) - - def apply(): - line = 0 - while True: - line = self.reflowBlock(line) - if line is None: - break; - def paste(): - files = self.getChecked() - self.insert(', '.join(files)) - def settings(): - from tortoisehg.hgqt.settings import SettingsDialog - dlg = SettingsDialog(True, focus='tortoisehg.summarylen') - dlg.exec_() - - menu = self.createStandardContextMenu() - menu.addSeparator() - if self.getChecked: - action = menu.addAction(_('Paste &Filenames')) - action.triggered.connect(paste) - for name, func in [(_('App&ly Format'), apply), - (_('C&onfigure Format'), settings)]: - def add(name, func): - action = menu.addAction(name) - action.triggered.connect(func) - add(name, func) - return menu.exec_(point) - - def refresh(self, repo): - self.setEdgeColumn(repo.summarylen) - self.setIndentationWidth(repo.tabwidth) - self.setTabWidth(repo.tabwidth) - self.summarylen = repo.summarylen - - def reflowBlock(self, line): - lines = self.text().split('\n', QString.KeepEmptyParts) - if line >= len(lines): - return None - if not len(lines[line]) > 1: - return line+1 - - # find boundaries (empty lines or bounds) - b = line - while b and len(lines[b-1]) > 1: - b = b - 1 - e = line - while e+1 < len(lines) and len(lines[e+1]) > 1: - e = e + 1 - group = QStringList([lines[l].simplified() for l in xrange(b, e+1)]) - sentence = group.join(' ') - parts = sentence.split(' ', QString.SkipEmptyParts) - - outlines = QStringList() - line = QStringList() - partslen = 0 - for part in parts: - if partslen + len(line) + len(part) + 1 > self.summarylen: - if line: - outlines.append(line.join(' ')) - line, partslen = QStringList(), 0 - line.append(part) - partslen += len(part) - if line: - outlines.append(line.join(' ')) - - self.beginUndoAction() - self.setSelection(b, 0, e+1, 0) - self.removeSelectedText() - self.insertAt(outlines.join('\n')+'\n', b, 0) - self.endUndoAction() - self.setCursorPosition(b, 0) - return b + len(outlines) + 1 - - def moveCursorToEnd(self): - lines = self.lines() - if lines: - lines -= 1 - pos = self.lineLength(lines) - self.setCursorPosition(lines, pos) - self.ensureLineVisible(lines) - self.horizontalScrollBar().setSliderPosition(0) - - def keyPressEvent(self, event): - if event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_E: - line, col = self.getCursorPosition() - self.reflowBlock(line) - elif event.key() == Qt.Key_Backtab: - event.accept() - newev = QKeyEvent(event.type(), Qt.Key_Tab, Qt.ShiftModifier) - super(MessageEntry, self).keyPressEvent(newev) - else: - super(MessageEntry, self).keyPressEvent(event) +# messageentry.py - TortoiseHg's commit message editng widget +# +# Copyright 2011 Steve Borho <steve@borho.org> +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2, incorporated herein by reference. + +import os + +from PyQt4.QtCore import * +from PyQt4.QtGui import * +from PyQt4.Qsci import QsciScintilla, QsciLexerMakefile + +from tortoisehg.hgqt.i18n import _ +from tortoisehg.hgqt import qtlib, qscilib + +class MessageEntry(qscilib.Scintilla): + + def __init__(self, parent, getCheckedFunc=None): + super(MessageEntry, self).__init__(parent) + self.setEdgeColor(QColor('LightSalmon')) + self.setEdgeMode(QsciScintilla.EdgeLine) + self.setReadOnly(False) + self.setMarginWidth(1, 0) + self.setFont(qtlib.getfont('fontcomment').font()) + self.setCaretWidth(10) + self.setCaretLineBackgroundColor(QColor("#e6fff0")) + self.setCaretLineVisible(True) + self.setAutoIndent(True) + self.setAutoCompletionThreshold(2) + self.setAutoCompletionSource(QsciScintilla.AcsAPIs) + self.setAutoCompletionFillupsEnabled(True) + self.setLexer(QsciLexerMakefile(self)) + self.lexer().setFont(qtlib.getfont('fontcomment').font()) + self.lexer().setColor(QColor(Qt.red), QsciLexerMakefile.Error) + self.setMatchedBraceBackgroundColor(Qt.yellow) + self.setIndentationsUseTabs(False) + self.setBraceMatching(QsciScintilla.SloppyBraceMatch) + #self.setIndentationGuidesBackgroundColor(QColor("#e6e6de")) + #self.setFolding(QsciScintilla.BoxedFoldStyle) + # http://www.riverbankcomputing.com/pipermail/qscintilla/2009-February/000461.html + self.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) + self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) + # default message entry widgets to word wrap, user may override + self.setWrapMode(QsciScintilla.WrapWord) + + self.getChecked = getCheckedFunc + self.setContextMenuPolicy(Qt.CustomContextMenu) + self.customContextMenuRequested.connect(self.menuRequested) + + def menuRequested(self, point): + line = self.lineAt(point) + point = self.viewport().mapToGlobal(point) + + def apply(): + line = 0 + while True: + line = self.reflowBlock(line) + if line is None: + break; + def paste(): + files = self.getChecked() + self.insert(', '.join(files)) + def settings(): + from tortoisehg.hgqt.settings import SettingsDialog + dlg = SettingsDialog(True, focus='tortoisehg.summarylen') + dlg.exec_() + + menu = self.createStandardContextMenu() + menu.addSeparator() + if self.getChecked: + action = menu.addAction(_('Paste &Filenames')) + action.triggered.connect(paste) + for name, func in [(_('App&ly Format'), apply), + (_('C&onfigure Format'), settings)]: + def add(name, func): + action = menu.addAction(name) + action.triggered.connect(func) + add(name, func) + return menu.exec_(point) + + def refresh(self, repo): + self.setEdgeColumn(repo.summarylen) + self.setIndentationWidth(repo.tabwidth) + self.setTabWidth(repo.tabwidth) + self.summarylen = repo.summarylen + + def reflowBlock(self, line): + lines = self.text().split('\n', QString.KeepEmptyParts) + if line >= len(lines): + return None + if not len(lines[line]) > 1: + return line+1 + + # find boundaries (empty lines or bounds) + b = line + while b and len(lines[b-1]) > 1: + b = b - 1 + e = line + while e+1 < len(lines) and len(lines[e+1]) > 1: + e = e + 1 + group = QStringList([lines[l].simplified() for l in xrange(b, e+1)]) + sentence = group.join(' ') + parts = sentence.split(' ', QString.SkipEmptyParts) + + outlines = QStringList() + line = QStringList() + partslen = 0 + for part in parts: + if partslen + len(line) + len(part) + 1 > self.summarylen: + if line: + outlines.append(line.join(' ')) + line, partslen = QStringList(), 0 + line.append(part) + partslen += len(part) + if line: + outlines.append(line.join(' ')) + + self.beginUndoAction() + self.setSelection(b, 0, e+1, 0) + self.removeSelectedText() + self.insertAt(outlines.join('\n')+'\n', b, 0) + self.endUndoAction() + self.setCursorPosition(b, 0) + return b + len(outlines) + 1 + + def moveCursorToEnd(self): + lines = self.lines() + if lines: + lines -= 1 + pos = self.lineLength(lines) + self.setCursorPosition(lines, pos) + self.ensureLineVisible(lines) + self.horizontalScrollBar().setSliderPosition(0) + + def keyPressEvent(self, event): + if event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_E: + line, col = self.getCursorPosition() + self.reflowBlock(line) + elif event.key() == Qt.Key_Backtab: + event.accept() + newev = QKeyEvent(event.type(), Qt.Key_Tab, Qt.ShiftModifier) + super(MessageEntry, self).keyPressEvent(newev) + else: + super(MessageEntry, self).keyPressEvent(event)
 
89
90
91
92
93
 
 
 
94
95
96
97
98
99
 
100
101
102
 
205
206
207
 
208
209
 
210
211
212
 
89
90
91
 
 
92
93
94
95
96
97
98
99
 
100
101
102
103
 
206
207
208
209
210
211
212
213
214
215
@@ -89,14 +89,15 @@
    def run(self):   try: - wctx = repo[None] - wctx.status(ignored=True, unknown=True) + repo.bfstatus = True + stat = repo.status(ignored=True, unknown=True) + repo.bfstatus = False   trashcan = repo.join('Trashcan')   if os.path.isdir(trashcan):   trash = os.listdir(trashcan)   else:   trash = [] - self.files = wctx.unknown(), wctx.ignored(), trash + self.files = stat[4], stat[5], trash   except Exception, e:   self.error = str(e)   @@ -205,8 +206,10 @@
  self.showMessage.emit('')   match = hglib.matchall(repo)   match.dir = directories.append + repo.bfstatus = True   status = repo.status(match=match, ignored=opts['ignored'],   unknown=opts['unknown'], clean=False) + repo.bfstatus = False   files = status[4] + status[5]     def remove(remove_func, name):
Show Entire File tortoisehg/​hgqt/​qtlib.py Stacked
(No changes)
 
12
13
14
15
 
16
17
18
 
96
97
98
 
 
 
 
 
99
100
101
 
136
137
138
139
 
 
 
 
140
141
 
142
143
144
145
146
 
 
 
147
148
149
 
164
165
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
168
169
 
12
13
14
 
15
16
17
18
 
96
97
98
99
100
101
102
103
104
105
106
 
141
142
143
 
144
145
146
147
148
 
149
150
151
152
153
154
155
156
157
158
159
160
 
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
@@ -12,7 +12,7 @@
   from tortoisehg.util import hglib, shlib  from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib, status, cmdui +from tortoisehg.hgqt import qtlib, status, cmdui, bfprompt    from PyQt4.QtCore import *  from PyQt4.QtGui import * @@ -96,6 +96,11 @@
  bb.button(BB.Ok).setText(LABELS[command][1])   layout.addWidget(bb)   self.bb = bb + + if self.command == 'add' and 'kbfiles' in self.repo.extensions(): + self.addBfilesButton = QPushButton(_("Add &Bfiles")) + self.addBfilesButton.clicked.connect(self.addBfiles) + bb.addButton(self.addBfilesButton, BB.ActionRole)     hbox = QHBoxLayout()   hbox.setMargin(0) @@ -136,14 +141,20 @@
  parent=self)   return   if self.command == 'remove': - wctx = self.repo[None] + self.repo.bfstatus = True + repostate = self.repo.status() + self.repo.bfstatus = False + unknown, ignored = repostate[4:6]   for wfile in files: - if wfile not in wctx: + if wfile in unknown or wfile in ignored:   try:   util.unlink(wfile)   except EnvironmentError:   pass   files.remove(wfile) + elif self.command == 'add' and 'kbfiles' in self.repo.extensions(): + self.addWithPrompt(files) + return   if files:   cmdline.extend(files)   self.files = files @@ -164,6 +175,33 @@
  s.setValue('quickop/nobackup', self.chk.isChecked())   QDialog.reject(self)   + def addBfiles(self): + cmdline = ['add', '--bf'] + files = self.stwidget.getChecked() + if not files: + qtlib.WarningMsgBox(_('No files selected'), + _('No operation to perform'), + parent=self) + return + cmdline.extend(files) + self.files = files + self.cmd.run(cmdline) + + def addWithPrompt(self, files): + result = bfprompt.promptForBfiles(self, self.repo.ui, self.repo, files) + if not result: + return + files, bfiles = result + if files: + cmdline = ['add'] + cmdline.extend(files) + self.files = files + self.cmd.run(cmdline) + if bfiles: + cmdline = ['add', '--bf'] + cmdline.extend(bfiles) + self.files = bfiles + self.cmd.run(cmdline)    instance = None  class HeadlessQuickop(QWidget):
 
7
8
9
10
 
11
12
13
 
24
25
26
 
 
 
 
 
 
27
28
29
 
258
259
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
262
263
 
297
298
299
 
 
 
300
301
302
 
678
679
680
 
 
 
 
 
 
 
 
 
 
681
682
683
 
856
857
858
 
 
859
860
861
 
7
8
9
 
10
11
12
13
 
24
25
26
27
28
29
30
31
32
33
34
35
 
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
 
343
344
345
346
347
348
349
350
351
 
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
 
915
916
917
918
919
920
921
922
@@ -7,7 +7,7 @@
   import os   -from mercurial import ui, util, error +from mercurial import ui, util, error, extensions    from tortoisehg.util import hglib, settings, paths, wconfig, i18n, bugtraq  from tortoisehg.hgqt.i18n import _ @@ -24,6 +24,12 @@
 _unspecstr = _('<unspecified>')  ENTRY_WIDTH = 300   +def hasExtension(extname): + for name, module in extensions.extensions(): + if name == extname: + return True + return False +  class SettingsCombo(QComboBox):   def __init__(self, parent=None, **opts):   QComboBox.__init__(self, parent, toolTip=opts['tooltip']) @@ -258,6 +264,46 @@
  return self.value() != self.curvalue     +class PathBrowser(QWidget): + def __init__(self, parent=None, **opts): + QWidget.__init__(self, parent, toolTip=opts['tooltip']) + self.opts = opts + + self.lineEdit = QLineEdit() + completer = QCompleter(self) + completer.setModel(QDirModel(completer)) + self.lineEdit.setCompleter(completer) + + self.browseButton = QPushButton(_('&Browse...')) + self.browseButton.clicked.connect(self.browse) + + layout = QHBoxLayout() + layout.setContentsMargins(0, 0, 0, 0) + layout.addWidget(self.lineEdit) + layout.addWidget(self.browseButton) + self.setLayout(layout) + + def browse(self): + dir = QFileDialog.getExistingDirectory(self, directory=self.lineEdit.text(), + options=QFileDialog.ShowDirsOnly) + if dir: + self.lineEdit.setText(dir) + + ## common APIs for all edit widgets + def setValue(self, curvalue): + self.curvalue = curvalue + if curvalue: + self.lineEdit.setText(hglib.tounicode(curvalue)) + else: + self.lineEdit.setText('') + + def value(self): + utext = self.lineEdit.text() + return utext and hglib.fromunicode(utext) or None + + def isDirty(self): + return self.value() != self.curvalue +  def genEditCombo(opts, defaults=[]):   opts['canedit'] = True   opts['defaults'] = defaults @@ -297,6 +343,9 @@
 def genBugTraqEdit(opts):   return BugTraqConfigureEntry(**opts)   +def genPathBrowser(opts): + return PathBrowser(**opts) +  def findIssueTrackerPlugins():   plugins = bugtraq.get_issue_plugins_with_names()   names = [("%s %s" % (key[0], key[1])) for key in plugins] @@ -678,6 +727,16 @@
  _fi(_('Target People'), 'reviewboard.target_people', genEditCombo,   _('A comma separated list of target people')),   )), + +({'name': 'kbfiles', 'label': _('Kiln Bfiles'), 'icon': 'kiln', 'extension': 'kbfiles'}, ( + _fi(_('Patterns'), 'kilnbfiles.patterns', genEditCombo, + _('Files with names meeting the specified patterns will be automatically ' + 'added as bfiles')), + _fi(_('Size'), 'kilnbfiles.size', genEditCombo, + _('Files of at least the specified size (in megabytes) will be added as bfiles')), + _fi(_('System Cache'), 'kilnbfiles.systemcache', genPathBrowser, + _('Path to the directory where a system-wide cache of bfiles will be stored')), + )),    )   @@ -856,6 +915,8 @@
    # add page items to treeview   for meta, info in INFO: + if 'extension' in meta and not hasExtension(meta['extension']): + continue   if isinstance(meta['icon'], str):   icon = qtlib.geticon(meta['icon'])   else:
 
413
414
415
 
416
 
417
418
419
 
425
426
427
 
428
 
429
430
431
 
432
 
433
434
435
 
413
414
415
416
417
418
419
420
421
 
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
@@ -413,7 +413,9 @@
  # status and commit only pre-check MAR files   precheckfn = lambda x: x < 4   m = hglib.match(self.repo[None], self.pats) + self.repo.bfstatus = True   status = self.repo.status(match=m, **stopts) + self.repo.bfstatus = False   # Record all matched files as initially checked   for i, stat in enumerate(StatusType.preferredOrder):   if stat == 'S': @@ -425,11 +427,15 @@
  wctx = context.workingctx(self.repo, changes=status)   self.patchecked = patchecked   elif self.pctx: + self.repo.bfstatus = True   status = self.repo.status(node1=self.pctx.p1().node(), **stopts) + self.repo.bfstatus = False   wctx = context.workingctx(self.repo, changes=status)   else:   wctx = self.repo[None] + self.repo.bfstatus = True   wctx.status(**stopts) + self.repo.bfstatus = False   self.wctx = wctx     wctx.dirtySubrepos = []
 
8
9
10
11
12
 
 
13
14
15
 
52
53
54
 
 
55
56
57
 
268
269
270
 
 
 
 
 
 
 
 
 
 
 
 
 
271
272
273
 
 
 
 
 
 
 
 
274
275
276
 
8
9
10
 
 
11
12
13
14
15
 
52
53
54
55
56
57
58
59
 
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
@@ -8,8 +8,8 @@
 import os  import re   -from mercurial import util, error, merge, commands -from tortoisehg.hgqt import qtlib, htmlui, visdiff +from mercurial import util, error, merge, commands, extensions +from tortoisehg.hgqt import qtlib, htmlui, visdiff, bfprompt  from tortoisehg.util import hglib, shlib  from tortoisehg.hgqt.i18n import _   @@ -52,6 +52,8 @@
  allactions.append(None)   make(_('&Forget'), forget, frozenset('MAC!'), 'filedelete')   make(_('&Add'), add, frozenset('I?'), 'fileadd') + if 'kbfiles' in self.repo.extensions(): + make(_('Add &Bfiles'), addbf, frozenset('I?'))   make(_('&Detect Renames...'), guessRename, frozenset('A?!'),   'detect_rename')   make(_('&Ignore...'), ignore, frozenset('?'), 'ignore') @@ -268,9 +270,30 @@
  return True    def add(parent, ui, repo, files): + if 'kbfiles' in repo.extensions(): + result = bfprompt.promptForBfiles(parent, ui, repo, files) + if not result: + return False + files, bfiles = result + for name, module in extensions.extensions(): + if name == 'kbfiles': + override_add = module.bfsetup.override_add + if files: + override_add(commands.add, ui, repo, *files) + if bfiles: + override_add(commands.add, ui, repo, *bfiles, bf=1) + return True   commands.add(ui, repo, *files)   return True   +def addbf(parent, ui, repo, files): + for name, module in extensions.extensions(): + if name == 'kbfiles': + override_add = module.bfsetup.override_add + override_add(commands.add, ui, repo, *files, bf=True) + return True + return False +  def guessRename(parent, ui, repo, files):   from tortoisehg.hgqt.guess import DetectRenameDialog   dlg = DetectRenameDialog(repo, parent, *files)
 
90
91
92
 
93
 
94
95
96
 
90
91
92
93
94
95
96
97
98
@@ -90,7 +90,9 @@
  time.sleep(tdelta)     repo = hg.repository(ui, root) # a fresh repo object is needed + repo.bfstatus = True   repostate = repo.status() # will update .hg/dirstate as a side effect + repo.bfstatus = False   modified, added, removed, deleted = repostate[:4]     dirstatus = {}
 
31
32
33
34
 
 
35
36
37
 
40
41
42
43
 
44
45
46
47
48
 
 
49
50
51
 
71
72
73
 
74
75
76
 
159
160
161
162
 
163
164
165
 
168
169
170
171
 
172
173
174
 
31
32
33
 
34
35
36
37
38
 
41
42
43
 
44
45
46
47
48
 
49
50
51
52
53
 
73
74
75
76
77
78
79
 
162
163
164
 
165
166
167
168
 
171
172
173
 
174
175
176
177
@@ -31,7 +31,8 @@
     Dirstate* Dirstatecache::get( - const std::string& hgroot, const std::string& cwd, bool& unset) + const std::string& hgroot, const std::string& cwd, bool& unset, + bool usekbfiles)  {   unset = false;   @@ -40,12 +41,13 @@
  Iter iter = cache().begin();   for (;iter != cache().end(); ++iter)   { - if (hgroot == iter->hgroot) + if (hgroot == iter->hgroot && usekbfiles == iter->usekbfiles)   break;   }     Winstat64 stat; - std::string path = hgroot + "\\.hg\\dirstate"; + std::string path = hgroot + (usekbfiles ? "\\.hg\\kilnbfiles\\dirstate" + : "\\.hg\\dirstate");     unsigned tc = GetTickCount();   bool new_stat = false; @@ -71,6 +73,7 @@
    E e;   e.hgroot = hgroot; + e.usekbfiles = usekbfiles;   cache().push_front(e);   iter = cache().begin();   iter->tickcount = tc; @@ -159,7 +162,7 @@
 }     -void Dirstatecache::invalidate(const std::string& hgroot) +void Dirstatecache::invalidate(const std::string& hgroot, bool usekbfiles)  {   typedef std::list<E>::iterator Iter;   @@ -168,7 +171,7 @@
    for (Iter i = cache().begin(); i != cache().end(); ++i)   { - if (hgroot == i->hgroot) + if (hgroot == i->hgroot && usekbfiles == i->usekbfiles)   {   delete i->dstate;   i->dstate = 0;
 
34
35
36
 
37
38
39
40
41
42
43
 
 
44
45
46
 
48
49
50
51
52
 
 
 
53
54
55
 
34
35
36
37
38
39
40
41
42
43
 
44
45
46
47
48
 
50
51
52
 
 
53
54
55
56
57
58
@@ -34,13 +34,15 @@
  std::string hgroot;   unsigned tickcount;   bool unset; + bool usekbfiles;     E():   dstate(0),   dstate_mtime(0),   dstate_size(0),   tickcount(0), - unset(false) + unset(false), + usekbfiles(false)   {}   };   @@ -48,8 +50,9 @@
   public:   static Dirstate* get( - const std::string& hgroot, const std::string& cwd, bool& unset); - static void invalidate(const std::string& hgroot); + const std::string& hgroot, const std::string& cwd, bool& unset, + bool usekbfiles = false); + static void invalidate(const std::string& hgroot, bool usekbfiles = false);  };    #endif
 
83
84
85
86
 
87
88
 
89
90
91
 
301
302
303
304
305
 
 
 
 
 
 
 
306
307
308
 
312
313
314
315
 
316
317
318
319
 
 
 
 
 
 
 
 
 
 
 
320
321
322
 
83
84
85
 
86
87
 
88
89
90
91
 
301
302
303
 
 
304
305
306
307
308
309
310
311
312
313
 
317
318
319
 
320
321
322
 
 
323
324
325
326
327
328
329
330
331
332
333
334
335
336
@@ -83,9 +83,9 @@
  {   std::string p = cur.path;   p.push_back('\\'); - if (p.find("\\.hg\\") != std::string::npos) + if (p.find("\\.hg\\") != std::string::npos || p.find("\\.kbf\\") != std::string::npos)   { - // ignore files and dirs named '.hg' + // ignore files and dirs named '.hg' or '.kbf'   last = cur;   return 0;   } @@ -301,8 +301,13 @@
  {   if (!relpath.empty() && !pds->root().getdir(relpath))   { - last = cur; - return 0; // unknown dir -> no icon + // attempt to get status from kbfiles + pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset, true); + if (!pds || !pds->root().getdir(relpath)) + { + last = cur; + return 0; // unknown dir -> no icon + }   }     outStatus = (pdirsta ? pdirsta->status(relpath) : '?'); @@ -312,11 +317,20 @@
  return 1;   }   - const Direntry* const e = pds->root().get(relpath); + const Direntry* e = pds->root().get(relpath);   if (!e)   { - last = cur; - return 0; + // attempt to get status from kbfiles + pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset, true); + if (pds) + { + e = pds->root().get(relpath); + } + if (!e) + { + last = cur; + return 0; + }   }     outStatus = e->status(stat);